Documentation ¶
Index ¶
- Constants
- func IsNotFound(db *gorm.DB) int
- func IsValid(r interface{}) bool
- type Base
- func (b *Base) Cancel()
- func (b *Base) Count(model interface{}, count *int64) error
- func (b *Base) Create(model interface{}, opts ...Option) error
- func (b *Base) Delete(model interface{}, cond *Condition) error
- func (b *Base) First(model interface{}, cond *Condition) error
- func (b *Base) Get(model interface{}) (result interface{}, err error)
- func (b *Base) Gets(model interface{}) (results []*interface{}, err error)
- func (b *Base) NewDB() *gorm.DB
- func (b *Base) Select(model interface{}, cond *Condition) error
- func (b *Base) UpdateColumn(model interface{}, cond *Condition, column string, value interface{}) error
- func (b *Base) Updates(model interface{}, cond *Condition, opts ...Option) error
- func (b *Base) WithOrder(order string) *Base
- func (b *Base) WithResult(result interface{}) *Base
- type Condition
- func (sq *Condition) And(column, operator string, value interface{}) *Condition
- func (sq *Condition) Column(column string) *Condition
- func (sq *Condition) Compose(column string, operator string, value interface{}) *Condition
- func (sq *Condition) Cond() string
- func (sq *Condition) Eq(column string, value interface{}) *Condition
- func (sq *Condition) Gt(column string, value interface{}) *Condition
- func (sq *Condition) GtEq(column string, value interface{}) *Condition
- func (sq *Condition) In(column string, value interface{}) *Condition
- func (sq *Condition) Is() bool
- func (sq *Condition) Like(column string, value interface{}) *Condition
- func (sq *Condition) Lt(column string, value interface{}) *Condition
- func (sq *Condition) LtEq(column string, value interface{}) *Condition
- func (sq *Condition) Modifier(m string) *Condition
- func (sq *Condition) NEq(column string, value interface{}) *Condition
- func (sq *Condition) Operate(operator string) *Condition
- func (sq *Condition) Or(column, operator string, value interface{}) *Condition
- func (sq *Condition) Reset() *Condition
- func (sq *Condition) Value() []interface{}
- func (sq *Condition) Values(value ...interface{}) *Condition
- type Option
- type OptionFunc
- type Options
- type Page
Constants ¶
View Source
const ( Eq = "=" NEq = "<>" Lt = "<" LtEq = "<=" Gt = ">" GtEq = ">=" In = "IN" Like = "LIKE" Between = "BETWEEN" And = "AND" Or = "OR" )
Operate
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
Types ¶
type Base ¶
func (*Base) UpdateColumn ¶
func (*Base) WithResult ¶
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
func (*Condition) Column ¶
Column
- @example db.Where("created_at BETWEEN ? AND ?", lastWeek, today).Find(&users)
func (*Condition) Like ¶
Like
@example db.Where("name LIKE ?", "%jin%").Find(&users) * Condition.Like("name","%jin%")
func (*Condition) Operate ¶
Operate
@param operator * @example created_at BETWEEN ? AND ? * Condition.Column("created_at").Operate("BETWEEN").Operate("AND").Values(11333,34444)
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option overrides behavior of Connect.
type OptionFunc ¶
type OptionFunc func(*Options)
type Page ¶
func (*Page) SelectPage ¶
SelectPage param results := make([]object, 0)
func (*Page) WithOffset ¶
Click to show internal directories.
Click to hide internal directories.