Documentation ¶
Index ¶
- Variables
- func DeleteObject(object base.Base) error
- func DeleteObjects(args ...ObjectsOrOptions) []error
- func GetObject(object base.Base, idValue interface{}) error
- func ObjectChanged(object base.Base) bool
- func Query(objects ...base.Base) *query.Query
- func SaveObject(object base.Base) error
- func SaveObjects(args ...ObjectsOrOptions) []error
- func Saved(object base.Base) bool
- func Transactionized(fn func(*sqlx.Tx) error) (err error)
- func UpdateObject(object base.Base) error
- type ColumnFilter
- type ObjectsOrOptions
- type QueryParts
- type Session
- func (self Session) DeleteObject(object base.Base) error
- func (self Session) DeleteObjects(args ...ObjectsOrOptions) []error
- func (self Session) GetObject(object base.Base, idValue interface{}) error
- func (self Session) Manager() (*database.Manager, error)
- func (self Session) Query(objects ...base.Base) *query.Query
- func (self Session) SaveObject(object base.Base) error
- func (self Session) SaveObjects(args ...ObjectsOrOptions) []error
- func (self Session) Transactionized(fn func(*sqlx.Tx) error) (err error)
- func (self Session) UpdateObject(object base.Base) error
Constants ¶
This section is empty.
Variables ¶
var BaseIdentifierUnsetError = errors.New(
"The base provided has an identifier but it hasn't been set.",
)
var BaseNoIdentifierError = errors.New(
"The base provided has no understandable identifier.",
)
var StopOnFailure = func() ([]actionOption, []base.Base) { return []actionOption{ func(ops *actionOptions) { ops.stopOnFailure = true }, }, nil }
Functions ¶
func DeleteObject ¶
DeleteObject deletes the object provided from the DB using a new session from the global connection pool.
func DeleteObjects ¶
func DeleteObjects(args ...ObjectsOrOptions) []error
DeleteObjects deletes the objects provided from the DB using a new session from the global connection pool.
func GetObject ¶
GetObject gets the object with the provided id from the DB using a new session from the global connection pool.
func ObjectChanged ¶
func SaveObject ¶
SaveObject saves the given object to the DB new session from the global connection pool.
func SaveObjects ¶
func SaveObjects(args ...ObjectsOrOptions) []error
SaveObjects saves the provided objects to the DB using a new session from the global connection pool.
func UpdateObject ¶
UpdateObject updates the object provided in the DB using a new session from the global connection pool.
Types ¶
type ObjectsOrOptions ¶ added in v0.1.2
func Objs ¶ added in v0.1.2
func Objs(objs ...base.Base) ObjectsOrOptions
type QueryParts ¶
func QueryPartsFromObject ¶
func QueryPartsFromObject( object base.Base, filters ...ColumnFilter, ) QueryParts
func (*QueryParts) AddColumnName ¶
func (self *QueryParts) AddColumnName(columnNames ...string)
func (*QueryParts) AddValue ¶
func (self *QueryParts) AddValue(values ...sql.NamedArg)
func (QueryParts) AsInsert ¶
func (self QueryParts) AsInsert() string
func (QueryParts) AsUpdate ¶
func (self QueryParts) AsUpdate() string
type Session ¶
type Session struct {
Pool *pool.ConnectionPool
}
Session is a helper wrapper for a connection pool that has common helper functions.
func NewSession ¶
func NewSessionFromGlobal ¶
func NewSessionFromPool ¶
func NewSessionFromPool(connPool *pool.ConnectionPool) *Session
func (Session) DeleteObject ¶
DeleteObject deletes the object provided from the DB.
func (Session) DeleteObjects ¶
func (self Session) DeleteObjects(args ...ObjectsOrOptions) []error
DeleteObjects deletes the objects provided from the DB.
func (Session) SaveObject ¶
SaveObject saves the given object to the DB.
func (Session) SaveObjects ¶
func (self Session) SaveObjects(args ...ObjectsOrOptions) []error
SaveObjects saves the provided objects to the DB.