forked from ghetzel/pivot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapper.go
34 lines (31 loc) · 1.24 KB
/
mapper.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
package backends
import (
"github.com/PerformLine/pivot/v3/dal"
"github.com/PerformLine/pivot/v3/filter"
)
type ResultFunc func(ptrToInstance interface{}, err error) // {}
type Mapper interface {
GetBackend() Backend
GetCollection() *dal.Collection
Migrate() error
Drop() error
Exists(id interface{}) bool
Create(from interface{}) error
Get(id interface{}, into interface{}) error
Update(from interface{}) error
CreateOrUpdate(id interface{}, from interface{}) error
Delete(ids ...interface{}) error
DeleteQuery(flt interface{}) error
Find(flt interface{}, into interface{}) error
FindFunc(flt interface{}, destZeroValue interface{}, resultFn ResultFunc) error
All(into interface{}) error
Each(destZeroValue interface{}, resultFn ResultFunc) error
List(fields []string) (map[string][]interface{}, error)
ListWithFilter(fields []string, flt interface{}) (map[string][]interface{}, error)
Sum(field string, flt interface{}) (float64, error)
Count(flt interface{}) (uint64, error)
Minimum(field string, flt interface{}) (float64, error)
Maximum(field string, flt interface{}) (float64, error)
Average(field string, flt interface{}) (float64, error)
GroupBy(fields []string, aggregates []filter.Aggregate, flt interface{}) (*dal.RecordSet, error)
}