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 IQuery) error
- func (b *Base) Find(model interface{}, where IQuery, sel ISelect) error
- func (b *Base) First(model interface{}, where IQuery, sel ISelect) 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) UpdateColumn(model interface{}, where IQuery, column string, value interface{}) error
- func (b *Base) Updates(model interface{}, where IQuery, opts ...Option) error
- func (b *Base) WithOrder(order interface{}) *Base
- func (b *Base) WithResult(result interface{}) *Base
- type Condition
- func (sq *Condition) And(column, operator string, value interface{}) *Condition
- func (sq *Condition) AndEq(column string, value interface{}) *Condition
- func (sq *Condition) AndGt(column string, value interface{}) *Condition
- func (sq *Condition) AndGtEq(column string, value interface{}) *Condition
- func (sq *Condition) AndLt(column string, value interface{}) *Condition
- func (sq *Condition) AndLtEq(column string, value interface{}) *Condition
- func (sq *Condition) AndNEq(column 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) ComposeFrom(src *Condition, operator string) *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) IsFirst() 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) ModifierF(f string, m ...interface{}) *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) OrEq(column string, value interface{}) *Condition
- func (sq *Condition) OrGt(column string, value interface{}) *Condition
- func (sq *Condition) OrGtEq(column string, value interface{}) *Condition
- func (sq *Condition) OrLt(column string, value interface{}) *Condition
- func (sq *Condition) OrLtEq(column string, value interface{}) *Condition
- func (sq *Condition) OrNEq(column string, value interface{}) *Condition
- func (sq *Condition) Query() string
- func (sq *Condition) Reset() *Condition
- func (sq *Condition) Value() []interface{}
- func (sq *Condition) Values(value ...interface{}) *Condition
- type IQuery
- type ISelect
- type Option
- type OptionFunc
- type Options
- type Page
- type Select
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) ComposeFrom ¶ added in v0.5.39
ComposeFrom 组合
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) WithOffset ¶
Click to show internal directories.
Click to hide internal directories.