Documentation ¶
Index ¶
- type Mapper
- type Model
- func (self *Model) All(into interface{}) error
- func (self *Model) Average(field string, flt interface{}) (float64, error)
- func (self *Model) Count(flt interface{}) (uint64, error)
- func (self *Model) Create(from interface{}) error
- func (self *Model) CreateOrUpdate(id interface{}, from interface{}) error
- func (self *Model) Delete(ids ...interface{}) error
- func (self *Model) Drop() error
- func (self *Model) Each(destZeroValue interface{}, resultFn ResultFunc) error
- func (self *Model) Exists(id interface{}) bool
- func (self *Model) Find(flt interface{}, into interface{}) error
- func (self *Model) FindFunc(flt interface{}, destZeroValue interface{}, resultFn ResultFunc) error
- func (self *Model) Get(id interface{}, into interface{}) error
- func (self *Model) GetBackend() backends.Backend
- func (self *Model) GetCollection() *dal.Collection
- func (self *Model) GroupBy(fields []string, aggregates []filter.Aggregate, flt interface{}) (*dal.RecordSet, error)
- func (self *Model) List(fields []string) (map[string][]interface{}, error)
- func (self *Model) ListWithFilter(fields []string, flt interface{}) (map[string][]interface{}, error)
- func (self *Model) Maximum(field string, flt interface{}) (float64, error)
- func (self *Model) Migrate() error
- func (self *Model) Minimum(field string, flt interface{}) (float64, error)
- func (self *Model) NewInstance(inits ...dal.InitializerFunc) interface{}
- func (self *Model) Sum(field string, flt interface{}) (float64, error)
- func (self *Model) Update(from interface{}) error
- type ResultFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapper ¶
type Mapper interface { NewInstance(inits ...dal.InitializerFunc) interface{} GetBackend() backends.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 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) }
type Model ¶
type Model struct { Mapper // contains filtered or unexported fields }
func (*Model) Create ¶
Creates and saves a new instance of the model from the given struct or dal.Record.
func (*Model) CreateOrUpdate ¶
Creates or updates an instance of the model depending on whether it exists or not.
func (*Model) Each ¶
func (self *Model) Each(destZeroValue interface{}, resultFn ResultFunc) error
func (*Model) Find ¶
Perform a query for instances of the model that match the given filter.Filter. Results will be returned in the slice or array pointed to by the into parameter, or if into points to a dal.RecordSet, the RecordSet resulting from the query will be returned as-is.
func (*Model) FindFunc ¶
func (self *Model) FindFunc(flt interface{}, destZeroValue interface{}, resultFn ResultFunc) error
Perform a query for instances of the model that match the given filter.Filter. The given callback function will be called once per result.
func (*Model) Get ¶
Retrieves an instance of the model identified by the given ID and populates the value pointed to by the into parameter. Structs and dal.Record instances can be populated.
func (*Model) GetBackend ¶
func (*Model) GetCollection ¶
func (self *Model) GetCollection() *dal.Collection
func (*Model) ListWithFilter ¶
func (*Model) NewInstance ¶
func (self *Model) NewInstance(inits ...dal.InitializerFunc) interface{}
type ResultFunc ¶
type ResultFunc func(ptrToInstance interface{}, err error) // {}