Documentation ¶
Overview ¶
Package meth is a thin wrapper around upper.io/db to ease some repettitive tasks
Index ¶
- Variables
- func All(p Persistent, rows interface{}, cond ...interface{}) error
- func AllBy(p Persistent, rows interface{}, cond ...interface{}) error
- func AllOp(p Persistent, operation resFunc, rows interface{}, cond ...interface{}) error
- func Exists(p Persistent, cond ...interface{}) bool
- func Group(i ...interface{}) resFunc
- func Limit(u uint) resFunc
- func One(p Persistent) error
- func OneBy(p Persistent, cond ...interface{}) error
- func OneOp(p Persistent, operation resFunc, row interface{}, cond ...interface{}) error
- func Paginate(limit, skip uint) resFunc
- func Select(i ...interface{}) resFunc
- func Skip(n uint) resFunc
- func Sort(i ...interface{}) resFunc
- func Where(i ...interface{}) resFunc
- type Persistent
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoID = errors.New(`no id field found`) ErrNoSlice = errors.New(`slice expected`) )
Shared error codes
Functions ¶
func All ¶
func All(p Persistent, rows interface{}, cond ...interface{}) error
All works as an alias for AllBy
func AllBy ¶
func AllBy(p Persistent, rows interface{}, cond ...interface{}) error
AllBy fills rows with data from the result set matching the given conditions
func AllOp ¶
func AllOp(p Persistent, operation resFunc, rows interface{}, cond ...interface{}) error
AllOp works like All but applies an operation in form of:
func(db.Result)
to work with the result set [for things like select, group, limit]
func Exists ¶
func Exists(p Persistent, cond ...interface{}) bool
Exists returns true if a record exists matching either id or the given conditions
func Group ¶
func Group(i ...interface{}) resFunc
Group is used to group results that have the same value in the same column or columns.
func Limit ¶
func Limit(u uint) resFunc
Limit defines the maximum number of results returns a resFunc
func OneBy ¶
func OneBy(p Persistent, cond ...interface{}) error
OneBy fills p with one element matching the given conditions
func OneOp ¶
func OneOp(p Persistent, operation resFunc, row interface{}, cond ...interface{}) error
OneOp works like AllOp but returns only one row
func Paginate ¶
func Paginate(limit, skip uint) resFunc
Paginate applies a limit and skip to a result set
func Select ¶
func Select(i ...interface{}) resFunc
Select defines specific fields to be fulfilled on results in this result set.
Types ¶
type Persistent ¶
type Persistent interface {
Collection() db.Collection
}
Persistent is the interface that allows us to communicate with upper.io/db collection