-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbond.go
57 lines (43 loc) · 892 Bytes
/
bond.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
package bond
import (
"errors"
)
var (
ErrUnknownCollection = errors.New("unknown collection")
ErrInvalidQuery = errors.New("invalid query")
ErrZeroItemID = errors.New("item id is empty")
)
type Model interface {
HasStore
}
type HasCollectionName interface {
CollectionName() string
}
type HasStore interface {
Store(sess Session) Store
}
type HasSave interface {
Save(sess Session) error
}
type HasValidate interface {
Validate() error
}
type HasBeforeCreate interface {
BeforeCreate(Session) error
}
type HasAfterCreate interface {
AfterCreate(Session) error
}
type HasBeforeUpdate interface {
BeforeUpdate(Session) error
}
type HasAfterUpdate interface {
AfterUpdate(Session) error
}
type HasBeforeDelete interface {
BeforeDelete(Session) error
}
type HasAfterDelete interface {
AfterDelete(Session) error
}
type StoreFunc func(sess Session) Store