Documentation ¶
Overview ¶
SRM struct relation manager
Index ¶
- func Scheme(typ IModel, defFn func(*scheme.Def)) *scheme.Def
- type IModel
- type Model
- type Result
- type Session
- func (db *Session) Begin() error
- func (db *Session) Commit() error
- func (db *Session) Remove(p IModel) error
- func (db *Session) Retrieve(m IModel, fields ...string) error
- func (db *Session) RowBack() error
- func (db *Session) Search(m IModel, q *query.Query) Result
- func (db *Session) SearchAndModify(s IModel, q *query.Query, changes ...change.Operation) (int, error)
- func (db *Session) SearchAndRemove(s IModel, q *query.Query) (int, error)
- func (db *Session) Store(m IModel) (validation.Result, error)
- func (db *Session) Use(entityName string, model IModel) *scheme.Scheme
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IModel ¶
type IModel interface {
// contains filtered or unexported methods
}
IModel represents a struct containing a Model data
type Model ¶
type Model struct {
PrimaryKey string
}
Model holds database data, like relations, primary key
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) NumOfRecords ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
AbstractDB holds a database context, an AbstractDB is responsible to operate on a database
func (*Session) Retrieve ¶
Retrieve retrieves a stored model or any decedent field specified by the fields ...key
func (*Session) Search ¶
Search search's for the records matching the specified query and returns the matching records in the result set
func (*Session) SearchAndModify ¶
func (db *Session) SearchAndModify(s IModel, q *query.Query, changes ...change.Operation) (int, error)
SearchAndModify search's and modify the records matching the passed query expression with a list of changes passed as variadic list of operations
func (*Session) SearchAndRemove ¶
SearchAndRemove search's and remove the records matching the passed query expression