forked from eaciit/dbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cursor.go
71 lines (56 loc) · 1.13 KB
/
cursor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package dbox
import (
"github.com/eaciit/errorlib"
)
const (
modCursor = "Cursor"
)
type ICursor interface {
Close()
Count() int
ResetFetch() error
Fetch(interface{}, int, bool) error
//--- getter
Connection() IConnection
//-- setter
SetConnection(IConnection) ICursor
SetThis(ICursor) ICursor
}
type Cursor struct {
connection IConnection
thisO ICursor
}
func NewCursor(c ICursor) ICursor {
c.SetThis(c)
return c
}
func (c *Cursor) this() ICursor {
if c.thisO == nil {
return c
} else {
return c.thisO
}
}
func (c *Cursor) SetThis(cursor ICursor) ICursor {
c.thisO = cursor
return cursor
}
func (c *Cursor) Connection() IConnection {
return c.connection
}
func (c *Cursor) SetConnection(conn IConnection) ICursor {
c.connection = conn
return c.this()
}
func (c *Cursor) Close() {
}
func (c *Cursor) Count() int {
return 0
}
func (c *Cursor) ResetFetch() error {
return errorlib.Error(packageName, modCursor, "ResetFetch", errorlib.NotYetImplemented)
}
func (c *Cursor) Fetch(o interface{}, n int,
closeWhenDone bool) error {
return errorlib.Error(packageName, modCursor, "Fetch", errorlib.NotYetImplemented)
}