assist

package module
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 10 Imported by: 0

README

gorm-assist

gorm assist is an assist for gorm.

GoDoc Go.Dev reference codecov Tests Go Report Card Licence Tag

Usage

Installation

Use go get.

    go get github.com/things-go/gorm-assist

Then import the package into your own code.

    import "github.com/things-go/gorm-assist"
Example

Reference

License

This project is under MIT License. See the LICENSE file for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultPerPage 默认页大小
	DefaultPerPage = int64(50)
	// DefaultPageSize 默认最大页大小
	DefaultMaxPerPage = int64(500)
)
View Source
var All = Star
View Source
var One = NewRaw("1")

One a symbol of "1"

View Source
var Star = NewAsterisk("")

Star/All a symbol of "*"

Functions

func IntoExpression

func IntoExpression(conds ...Expr) []clause.Expression

IntoExpression convert Expr to clause.Expression

func IntoIntegerSlice added in v0.0.6

func IntoIntegerSlice[T constraints.Integer, R constraints.Integer](values []T) []R

func IntoSlice added in v0.0.3

func IntoSlice[T any, R any](values []T, f func(T) R) []R

func Paginate

func Paginate(page, perPage int64, maxPerPages ...int64) clause.Expression

Paginate 分页器 分页索引: page >= 1 分页大小: perPage >= 1 && <= DefaultMaxPerPage

Types

type Asterisk

type Asterisk struct {
	// contains filtered or unexported fields
}

Asterisk a type of xxx.*

func NewAsterisk

func NewAsterisk(table string, opts ...Option) Asterisk

NewAsterisk new * field

func (Asterisk) As

func (e Asterisk) As(alias string) Expr

As use expr AS ?

func (Asterisk) Avg

func (e Asterisk) Avg() Float64

Avg use AVG(expr)

func (Asterisk) Build

func (e Asterisk) Build(builder clause.Builder)

func (Asterisk) BuildColumn

func (e Asterisk) BuildColumn(stmt *gorm.Statement, opts ...BuildOption) string

func (Asterisk) BuildWithArgs

func (e Asterisk) BuildWithArgs(stmt *gorm.Statement) (string, []any)

func (Asterisk) ColumnName

func (e Asterisk) ColumnName() string

func (Asterisk) Count

func (a Asterisk) Count() Asterisk

Count use COUNT(expr)

func (Asterisk) Desc

func (e Asterisk) Desc() Expr

Desc use expr DESC

func (Asterisk) Distinct

func (a Asterisk) Distinct() Asterisk

Distinct use DISTINCT expr

func (Asterisk) EqCol

func (e Asterisk) EqCol(e2 Expr) Expr

EqCol use expr1 = expr2

func (Asterisk) EqSubQuery added in v0.3.0

func (e Asterisk) EqSubQuery(subQuery *gorm.DB) Expr

EqSubQuery use expr1 = (subQuery)

func (Asterisk) Expression

func (e Asterisk) Expression() clause.Expression

func (Asterisk) FieldName added in v0.5.5

func (e Asterisk) FieldName(prefixes ...string) string

FieldName hold model column name. if prefixes not exist returns same as ColumnName(), others {prefixes[0]}_{ColumnName}

func (Asterisk) FindInSetCol added in v0.3.1

func (e Asterisk) FindInSetCol(e2 Expr) Expr

FindInSetCol use FIND_IN_SET(expr1, expr2)

func (Asterisk) FindInSetColWith added in v0.3.1

func (e Asterisk) FindInSetColWith(e2 Expr) Expr

FindInSetColWith use FIND_IN_SET(expr2, expr1)

func (Asterisk) FindInSetSubQuery added in v0.3.0

func (e Asterisk) FindInSetSubQuery(subQuery *gorm.DB) Expr

FindInSetSubQuery FIND_IN_SET(column, (subQuery))

func (Asterisk) GroupConcat

func (e Asterisk) GroupConcat() Expr

GroupConcat use GROUP_CONCAT(expr)

func (Asterisk) GtCol

func (e Asterisk) GtCol(e2 Expr) Expr

GtCol use expr1 > expr2

func (Asterisk) GtSubQuery added in v0.3.0

func (e Asterisk) GtSubQuery(subQuery *gorm.DB) Expr

GtSubQuery use expr1 > (subQuery)

func (Asterisk) GteCol

func (e Asterisk) GteCol(e2 Expr) Expr

GteCol use expr1 >= expr2

func (Asterisk) GteSubQuery added in v0.3.0

func (e Asterisk) GteSubQuery(subQuery *gorm.DB) Expr

GteSubQuery use expr1 >= (subQuery)

func (Asterisk) InSubQuery added in v0.3.0

func (e Asterisk) InSubQuery(subQuery *gorm.DB) Expr

InSubQuery use expr1 IN (subQuery)

func (Asterisk) IsNotNull

func (e Asterisk) IsNotNull() Expr

IsNotNull use expr IS NOT NULL

func (Asterisk) IsNull

func (e Asterisk) IsNull() Expr

IsNull use expr IS NULL

func (Asterisk) Length

func (e Asterisk) Length() Int

Length use LENGTH(expr)

func (Asterisk) LtCol

func (e Asterisk) LtCol(e2 Expr) Expr

LtCol use expr1 < expr2

func (Asterisk) LtSubQuery added in v0.3.0

func (e Asterisk) LtSubQuery(subQuery *gorm.DB) Expr

LtSubQuery use expr1 < (subQuery)

func (Asterisk) LteCol

func (e Asterisk) LteCol(e2 Expr) Expr

LteCol use expr1 <= expr2

func (Asterisk) LteSubQuery added in v0.3.0

func (e Asterisk) LteSubQuery(subQuery *gorm.DB) Expr

LteSubQuery use expr1 <= (subQuery)

func (Asterisk) Max

func (e Asterisk) Max() Float64

Max use MAX(expr)

func (Asterisk) Min

func (e Asterisk) Min() Float64

Min use MIN(expr)

func (Asterisk) NeqCol

func (e Asterisk) NeqCol(e2 Expr) Expr

NeqCol use expr1 <> expr2

func (Asterisk) NeqSubQuery added in v0.3.0

func (e Asterisk) NeqSubQuery(subQuery *gorm.DB) Expr

NeqSubQuery use expr1 <> (subQuery)

func (Asterisk) NotInSubQuery added in v0.3.0

func (e Asterisk) NotInSubQuery(subQuery *gorm.DB) Expr

NotInSubQuery use expr1 NOT IN (subQuery)

func (Asterisk) RawExpr

func (e Asterisk) RawExpr() any

func (Asterisk) SetCol added in v0.4.0

func (e Asterisk) SetCol(e2 Expr) SetExpr

SetCol expr1=expr2

func (Asterisk) SetExpr added in v0.3.2

func (e Asterisk) SetExpr() any

func (Asterisk) SetSubQuery added in v0.3.2

func (e Asterisk) SetSubQuery(subQuery *gorm.DB) SetExpr

setSubQuery set with subQuery

func (Asterisk) ValueAny added in v0.3.3

func (e Asterisk) ValueAny(value any) SetExpr

ValueAny set any value. Deprecated: use other ValueXXX instead.

func (Asterisk) ValueNull added in v0.3.3

func (e Asterisk) ValueNull() SetExpr

ValueNull set value NULL

func (Asterisk) WithTable

func (e Asterisk) WithTable(table string) Expr

type Bool

type Bool Field

Bool boolean type field

func NewBool

func NewBool(table, column string, opts ...Option) Bool

NewBool new bool field.

func (Bool) And

func (field Bool) And(value bool) Expr

And use expr AND ?

func (Bool) BitAnd

func (field Bool) BitAnd(value bool) Expr

BitAnd use expr expr&?

func (Bool) BitOr

func (field Bool) BitOr(value bool) Expr

BitOr use expr expr|?

func (Bool) BitXor

func (field Bool) BitXor(value bool) Expr

BitXor use expr expr^?

func (Bool) Eq

func (field Bool) Eq(value bool) Expr

Eq equal to, use expr = ?

func (Bool) FindInSet added in v0.1.7

func (field Bool) FindInSet(targetList string) Expr

FindInSet use FIND_IN_SET(expr, ?)

func (Bool) IfNull

func (field Bool) IfNull(value bool) Expr

IfNull use IFNULL(expr,?)

func (Bool) Is

func (field Bool) Is(value bool) Expr

Is use expr = ?

func (Bool) Neq

func (field Bool) Neq(value bool) Expr

Neq not equal to, use expr <> ?

func (Bool) Not

func (field Bool) Not() Expr

Not use NOT expr

func (Bool) Or

func (field Bool) Or(value bool) Expr

Or use expr OR ?

func (Bool) Value added in v0.3.2

func (field Bool) Value(value bool) SetExpr

Value set value

func (Bool) ValuePointer added in v0.4.1

func (field Bool) ValuePointer(value *bool) SetExpr

Value set value use pointer

func (Bool) ValueZero added in v0.3.2

func (field Bool) ValueZero() SetExpr

ValueZero set value zero

func (Bool) Xor

func (field Bool) Xor(value bool) Expr

Xor use expr XOR ?

type BuildOption

type BuildOption uint

BuildOption build option

const (
	// WithTable build column with table
	WithTable BuildOption = iota

	// WithAll build column with table and alias(if have)
	WithAll

	// WithoutQuote build column without quote
	WithoutQuote
)

type Bytes

type Bytes Field

Bytes []byte type field

func NewBytes

func NewBytes(table, column string, opts ...Option) Bytes

NewBytes new bytes field.

func (Bytes) Between

func (field Bytes) Between(left []byte, right []byte) Expr

Between use expr BETWEEN ? AND ?

func (Bytes) Eq

func (field Bytes) Eq(value []byte) Expr

Eq equal to, use expr = ?

func (Bytes) FindInSet

func (field Bytes) FindInSet(targetList string) Expr

FindInSet FIND_IN_SET(expr, ?)

func (Bytes) FindInSetWith

func (field Bytes) FindInSetWith(target string) Expr

FindInSetWith FIND_IN_SET(?, expr)

func (Bytes) FuzzyLike

func (field Bytes) FuzzyLike(value string) Expr

FuzzyLike use expr LIKE ?, ? contain prefix % and suffix % e.g. expr LIKE %value%

func (Bytes) Gt

func (field Bytes) Gt(value []byte) Expr

Gt greater than, use expr > ?

func (Bytes) Gte

func (field Bytes) Gte(value []byte) Expr

Gte greater or equal to, use expr >= ?

func (Bytes) IfNull

func (field Bytes) IfNull(value []byte) Expr

IfNull use IFNULL(expr,?)

func (Bytes) In

func (field Bytes) In(values ...[]byte) Expr

In use expr IN (?)

func (Bytes) InAny added in v0.1.6

func (field Bytes) InAny(value any) Expr

InAny use expr IN (?) value must be a array/slice

func (Bytes) LeftLike

func (field Bytes) LeftLike(value string) Expr

LeftLike use expr LIKE ?, ? contain suffix %. e.g. expr LIKE value%

func (Bytes) Like

func (field Bytes) Like(value string) Expr

Like use expr LIKE ?

func (Bytes) Lt

func (field Bytes) Lt(value []byte) Expr

Lt less than, use expr < ?

func (Bytes) Lte

func (field Bytes) Lte(value []byte) Expr

Lte less or equal to, use expr <= ?

func (Bytes) Neq

func (field Bytes) Neq(value []byte) Expr

Neq not equal to, use expr <> ?

func (Bytes) NotBetween

func (field Bytes) NotBetween(left []byte, right []byte) Expr

NotBetween use NOT (expr BETWEEN ? AND ?)

func (Bytes) NotIn

func (field Bytes) NotIn(values ...[]byte) Expr

NotIn use expr NOT IN (?)

func (Bytes) NotInAny added in v0.1.6

func (field Bytes) NotInAny(value any) Expr

NotInAny use expr NOT IN (?) value must be a array/slice

func (Bytes) NotLike

func (field Bytes) NotLike(value string) Expr

NotLike use expr NOT LIKE ?

func (Bytes) NotRegxp

func (field Bytes) NotRegxp(value string) Expr

NotRegxp use NOT expr REGEXP ?

func (Bytes) Regexp

func (field Bytes) Regexp(value string) Expr

Regexp use expr REGEXP ?

func (Bytes) SubstringIndex

func (field Bytes) SubstringIndex(delim string, count int) Bytes

SubstringIndex use SUBSTRING_INDEX(expr,?,?) https://dev.mysql.com/doc/refman/8.0/en/functions.html#function_substring-index

func (Bytes) Value added in v0.3.2

func (field Bytes) Value(value []byte) SetExpr

Value set value

func (Bytes) ValueZero added in v0.3.2

func (field Bytes) ValueZero() SetExpr

ValueZero set value zero

type Columns

type Columns []Expr

Columns columns array

func NewColumns

func NewColumns(cols ...Expr) Columns

NewColumns new columns instance.

func (Columns) In

func (cs Columns) In(subQueryOrValue any) Expr

IN return contains subQuery or value when len(columns) == 1, equal to columns[0] IN (subQuery/value) when len(columns) > 1, equal to (columns[0], columns[1], ...) IN (subQuery/value)

func (Columns) NotIn

func (cs Columns) NotIn(subQueryOrValue any) Expr

IN return contains subQuery or value when len(columns) == 1, equal to NOT columns[0] IN (subQuery/value) when len(columns) > 1, equal to NOT (columns[0], columns[1], ...) IN (subQuery/value)

func (Columns) Set added in v0.3.2

func (cs Columns) Set(subQuery *gorm.DB) SetExpr

SetSubQuery set with subQuery

type Condition

type Condition = func(*gorm.DB) *gorm.DB

Condition alias func(*gorm.DB) *gorm.DB

func CrossJoinsExpr added in v0.2.0

func CrossJoinsExpr(table schema.Tabler, conds ...Expr) Condition

CrossJoinsExpr cross joins condition

func CrossJoinsXExpr added in v0.2.0

func CrossJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) Condition

CrossJoinsXExpr cross joins condition

func DistinctExpr added in v0.2.0

func DistinctExpr(columns ...Expr) Condition

DistinctExpr with field

func GormClauses added in v0.1.7

func GormClauses(conds ...clause.Expression) Condition

func GormDistinct added in v0.1.7

func GormDistinct(args ...any) Condition

func GormGroup added in v0.1.7

func GormGroup(name string) Condition

func GormHaving added in v0.1.7

func GormHaving(query any, args ...any) Condition

func GormInnerJoins added in v0.1.7

func GormInnerJoins(query string, args ...any) Condition

func GormJoins added in v0.1.7

func GormJoins(query string, args ...any) Condition

func GormLimit added in v0.1.7

func GormLimit(limit int) Condition

func GormNot added in v0.1.7

func GormNot(query any, args ...any) Condition

func GormOffset added in v0.1.7

func GormOffset(offset int) Condition

func GormOmit added in v0.1.7

func GormOmit(columns ...string) Condition

func GormOr added in v0.1.7

func GormOr(query any, args ...any) Condition

func GormOrder added in v0.1.7

func GormOrder(value any) Condition

func GormPreload added in v0.1.7

func GormPreload(query string, args ...any) Condition

func GormSelect added in v0.1.7

func GormSelect(query any, args ...any) Condition

func GormTable added in v0.1.7

func GormTable(name string, args ...any) Condition

func GormUnscoped added in v0.1.7

func GormUnscoped() Condition

func GormWhere added in v0.1.7

func GormWhere(query any, args ...any) Condition

func GroupExpr added in v0.2.0

func GroupExpr(columns ...Expr) Condition

GroupExpr with field

func InnerJoinsExpr added in v0.2.0

func InnerJoinsExpr(table schema.Tabler, conds ...Expr) Condition

InnerJoinsExpr inner joins condition

func InnerJoinsXExpr added in v0.2.0

func InnerJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) Condition

InnerJoinsXExpr inner joins condition

func LeftJoinsExpr added in v0.2.0

func LeftJoinsExpr(table schema.Tabler, conds ...Expr) Condition

LeftJoinsExpr left join condition

func LeftJoinsXExpr added in v0.2.0

func LeftJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) Condition

LeftJoinsXExpr left join condition

func LockingShare

func LockingShare() Condition

LockingShare specify the lock strength to SHARE

func LockingUpdate

func LockingUpdate() Condition

LockingUpdate specify the lock strength to UPDATE

func OmitExpr added in v0.3.2

func OmitExpr(columns ...Expr) Condition

OmitExpr with field

func OrderExpr added in v0.2.0

func OrderExpr(columns ...Expr) Condition

OrderExpr with field

func Pagination

func Pagination(page, perPage int64, maxPerPages ...int64) Condition

Pagination 分页器 分页索引: page >= 1 分页大小: perPage >= 1 && <= DefaultMaxPerPage

func RightJoinsExpr added in v0.2.0

func RightJoinsExpr(table schema.Tabler, conds ...Expr) Condition

RightJoinsExpr right join condition

func RightJoinsXExpr added in v0.2.0

func RightJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) Condition

RightJoinsXExpr right join condition

func SelectExpr added in v0.2.0

func SelectExpr(columns ...Expr) Condition

SelectExpr with field

func TableExpr added in v0.2.1

func TableExpr(fromSubs ...From) Condition

TableExpr return a table produced by SubQuery.

type Conditions

type Conditions struct {
	// contains filtered or unexported fields
}

Conditions hold Condition slice

func NewConditions

func NewConditions(cs ...Condition) *Conditions

NewConditions new condition instance.

func (*Conditions) Build

func (c *Conditions) Build() []Condition

Table with field

func (*Conditions) Clauses added in v0.2.1

func (c *Conditions) Clauses(conds ...clause.Expression) *Conditions

func (*Conditions) Configure added in v0.5.1

func (c *Conditions) Configure(funcs ...func(*Conditions) *Conditions) *Conditions

Configure the conditions in the scope

func (*Conditions) CrossJoinsExpr added in v0.2.0

func (c *Conditions) CrossJoinsExpr(table schema.Tabler, conds ...Expr) *Conditions

CrossJoinsExpr cross joins condition

func (*Conditions) CrossJoinsXExpr added in v0.2.0

func (c *Conditions) CrossJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Conditions

CrossJoinsXExpr cross joins condition

func (*Conditions) Distinct added in v0.1.5

func (c *Conditions) Distinct(args ...any) *Conditions

Distinct with field

func (*Conditions) DistinctExpr added in v0.2.0

func (c *Conditions) DistinctExpr(columns ...Expr) *Conditions

DistinctExpr with field

func (*Conditions) Group

func (c *Conditions) Group(name string) *Conditions

func (*Conditions) GroupExpr added in v0.2.0

func (c *Conditions) GroupExpr(columns ...Expr) *Conditions

GroupExpr with field

func (*Conditions) Having

func (c *Conditions) Having(query any, args ...any) *Conditions

func (*Conditions) InnerJoins added in v0.0.8

func (c *Conditions) InnerJoins(query string, args ...any) *Conditions

func (*Conditions) InnerJoinsExpr added in v0.2.0

func (c *Conditions) InnerJoinsExpr(table schema.Tabler, conds ...Expr) *Conditions

InnerJoinsExpr inner joins condition

func (*Conditions) InnerJoinsXExpr added in v0.2.0

func (c *Conditions) InnerJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Conditions

InnerJoinsXExpr inner joins condition

func (*Conditions) Joins added in v0.2.1

func (c *Conditions) Joins(query string, args ...any) *Conditions

func (*Conditions) LeftJoinsExpr added in v0.2.0

func (c *Conditions) LeftJoinsExpr(table schema.Tabler, conds ...Expr) *Conditions

LeftJoinsExpr left join condition

func (*Conditions) LeftJoinsXExpr added in v0.2.0

func (c *Conditions) LeftJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Conditions

LeftJoinsXExpr left join condition

func (*Conditions) Limit added in v0.2.1

func (c *Conditions) Limit(limit int) *Conditions

func (*Conditions) LockingShare

func (c *Conditions) LockingShare() *Conditions

LockingShare specify the lock strength to SHARE

func (*Conditions) LockingUpdate

func (c *Conditions) LockingUpdate() *Conditions

LockingUpdate specify the lock strength to UPDATE

func (*Conditions) Not added in v0.2.1

func (c *Conditions) Not(query any, args ...any) *Conditions

func (*Conditions) Offset added in v0.2.1

func (c *Conditions) Offset(offset int) *Conditions

func (*Conditions) Omit added in v0.2.1

func (c *Conditions) Omit(columns ...string) *Conditions

func (*Conditions) OmitExpr added in v0.3.2

func (c *Conditions) OmitExpr(columns ...Expr) *Conditions

OmitExpr with field

func (*Conditions) Or added in v0.2.1

func (c *Conditions) Or(query any, args ...any) *Conditions

func (*Conditions) Order

func (c *Conditions) Order(value any) *Conditions

func (*Conditions) OrderExpr added in v0.2.0

func (c *Conditions) OrderExpr(columns ...Expr) *Conditions

OrderExpr with field

func (*Conditions) Pagination

func (c *Conditions) Pagination(page, perPage int64, maxPages ...int64) *Conditions

Pagination 分页器 分页索引: page >= 1 分页大小: perPage >= 1 && <= DefaultMaxPerPage

func (*Conditions) Preload added in v0.2.1

func (c *Conditions) Preload(query string, args ...any) *Conditions

func (*Conditions) RightJoinsExpr added in v0.2.0

func (c *Conditions) RightJoinsExpr(table schema.Tabler, conds ...Expr) *Conditions

RightJoinsExpr right join condition

func (*Conditions) RightJoinsXExpr added in v0.2.0

func (c *Conditions) RightJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Conditions

RightJoinsXExpr right join condition

func (*Conditions) Scopes added in v0.2.1

func (c *Conditions) Scopes(cs ...Condition) *Conditions

Scopes more condition

func (*Conditions) Select

func (c *Conditions) Select(query any, args ...any) *Conditions

Select with field

func (*Conditions) SelectExpr added in v0.2.0

func (c *Conditions) SelectExpr(columns ...Expr) *Conditions

SelectExpr with field

func (*Conditions) Unscoped added in v0.2.1

func (c *Conditions) Unscoped() *Conditions

func (*Conditions) Where

func (c *Conditions) Where(query any, args ...any) *Conditions

type Decimal

type Decimal = Float[string]

func NewDecimal

func NewDecimal(table, column string, opts ...Option) Decimal

NewDecimal new decimal field

type Executor added in v0.1.0

type Executor[T any] struct {
	// contains filtered or unexported fields
}

func NewExecutor added in v0.1.0

func NewExecutor[T any](db *gorm.DB) *Executor[T]

Executor new executor

func (*Executor[T]) Assign added in v0.1.1

func (x *Executor[T]) Assign(attrs ...any) *Executor[T]

AttrsExpr provide attributes used in [FirstOrCreate] or [FirstOrInit]

func (*Executor[T]) AssignExpr added in v0.3.2

func (x *Executor[T]) AssignExpr(attrs ...SetExpr) *Executor[T]

AssignExpr with SetExpr provide attributes used in [FirstOrCreate] or [FirstOrInit]

func (*Executor[T]) Attrs added in v0.1.1

func (x *Executor[T]) Attrs(attrs ...any) *Executor[T]

Attrs provide attributes used in [FirstOrCreate] or [FirstOrInit]

func (*Executor[T]) AttrsExpr added in v0.3.2

func (x *Executor[T]) AttrsExpr(attrs ...SetExpr) *Executor[T]

AttrsExpr with SetExpr provide attributes used in [FirstOrCreate] or [FirstOrInit]

func (*Executor[T]) Clauses added in v0.1.0

func (x *Executor[T]) Clauses(conds ...clause.Expression) *Executor[T]

func (*Executor[T]) Count added in v0.1.0

func (x *Executor[T]) Count() (count int64, err error)

func (*Executor[T]) Create added in v0.1.0

func (x *Executor[T]) Create(values ...*T) error

func (*Executor[T]) CreateInBatches added in v0.1.0

func (x *Executor[T]) CreateInBatches(value []*T, batchSize int) error

func (*Executor[T]) CrossJoinsExpr added in v0.1.0

func (x *Executor[T]) CrossJoinsExpr(table schema.Tabler, conds ...Expr) *Executor[T]

func (*Executor[T]) CrossJoinsXExpr added in v0.1.0

func (x *Executor[T]) CrossJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Executor[T]

func (*Executor[T]) Debug added in v0.1.0

func (x *Executor[T]) Debug() *Executor[T]

func (*Executor[T]) Delete added in v0.1.0

func (x *Executor[T]) Delete() (rowsAffected int64, err error)

func (*Executor[T]) Distinct added in v0.1.0

func (x *Executor[T]) Distinct(args ...any) *Executor[T]

func (*Executor[T]) DistinctExpr added in v0.1.5

func (x *Executor[T]) DistinctExpr(columns ...Expr) *Executor[T]

func (*Executor[T]) Exist added in v0.1.0

func (x *Executor[T]) Exist() (exist bool, err error)

func (*Executor[T]) Find added in v0.1.0

func (x *Executor[T]) Find(dest any) error

func (*Executor[T]) FindAll added in v0.1.0

func (x *Executor[T]) FindAll() ([]*T, error)

func (*Executor[T]) FindInBatches added in v0.1.1

func (x *Executor[T]) FindInBatches(dest any, batchSize int, fc func(tx *gorm.DB, batch int) error) error

func (*Executor[T]) First added in v0.1.0

func (x *Executor[T]) First(dest any) error

func (*Executor[T]) FirstBool added in v0.1.2

func (x *Executor[T]) FirstBool() (v bool, err error)

func (*Executor[T]) FirstFloat32 added in v0.1.5

func (x *Executor[T]) FirstFloat32() (v float32, err error)

func (*Executor[T]) FirstFloat64 added in v0.1.2

func (x *Executor[T]) FirstFloat64() (v float64, err error)

func (*Executor[T]) FirstInt added in v0.1.2

func (x *Executor[T]) FirstInt() (v int, err error)

func (*Executor[T]) FirstInt16 added in v0.1.5

func (x *Executor[T]) FirstInt16() (v int16, err error)

func (*Executor[T]) FirstInt32 added in v0.1.5

func (x *Executor[T]) FirstInt32() (v int32, err error)

func (*Executor[T]) FirstInt64 added in v0.1.2

func (x *Executor[T]) FirstInt64() (v int64, err error)

func (*Executor[T]) FirstInt8 added in v0.1.5

func (x *Executor[T]) FirstInt8() (v int8, err error)

func (*Executor[T]) FirstOne added in v0.1.0

func (x *Executor[T]) FirstOne() (*T, error)

func (*Executor[T]) FirstOrCreate added in v0.1.1

func (x *Executor[T]) FirstOrCreate() (*T, error)

func (*Executor[T]) FirstOrInit added in v0.1.1

func (x *Executor[T]) FirstOrInit() (*T, error)

func (*Executor[T]) FirstString added in v0.1.2

func (x *Executor[T]) FirstString() (v string, err error)

func (*Executor[T]) FirstUint added in v0.1.5

func (x *Executor[T]) FirstUint() (v uint, err error)

func (*Executor[T]) FirstUint16 added in v0.1.5

func (x *Executor[T]) FirstUint16() (v uint16, err error)

func (*Executor[T]) FirstUint32 added in v0.1.5

func (x *Executor[T]) FirstUint32() (v uint32, err error)

func (*Executor[T]) FirstUint64 added in v0.1.5

func (x *Executor[T]) FirstUint64() (v uint64, err error)

func (*Executor[T]) FirstUint8 added in v0.1.5

func (x *Executor[T]) FirstUint8() (v uint8, err error)

func (*Executor[T]) Group added in v0.1.0

func (x *Executor[T]) Group(name string) *Executor[T]

func (*Executor[T]) GroupExpr added in v0.1.0

func (x *Executor[T]) GroupExpr(columns ...Expr) *Executor[T]

func (*Executor[T]) Having added in v0.1.0

func (x *Executor[T]) Having(query any, args ...any) *Executor[T]

func (*Executor[T]) InnerJoins added in v0.1.0

func (x *Executor[T]) InnerJoins(query string, args ...any) *Executor[T]

func (*Executor[T]) InnerJoinsExpr added in v0.1.0

func (x *Executor[T]) InnerJoinsExpr(table schema.Tabler, conds ...Expr) *Executor[T]

func (*Executor[T]) InnerJoinsXExpr added in v0.1.0

func (x *Executor[T]) InnerJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Executor[T]

func (*Executor[T]) IntoDB added in v0.1.3

func (x *Executor[T]) IntoDB() *gorm.DB

IntoDB with model or table

func (*Executor[T]) IntoExistExpr added in v0.3.0

func (x *Executor[T]) IntoExistExpr() Expr

func (*Executor[T]) IntoNotExistExpr added in v0.3.0

func (x *Executor[T]) IntoNotExistExpr() Expr

func (*Executor[T]) IntoRawDB added in v0.5.1

func (x *Executor[T]) IntoRawDB() *gorm.DB

IntoRawDB without model or table

func (*Executor[T]) IntoSubQueryExpr added in v0.3.0

func (x *Executor[T]) IntoSubQueryExpr() Field

func (*Executor[T]) Joins added in v0.1.0

func (x *Executor[T]) Joins(query string, args ...any) *Executor[T]

func (*Executor[T]) Last added in v0.1.0

func (x *Executor[T]) Last(dest any) error

func (*Executor[T]) LastOne added in v0.1.0

func (x *Executor[T]) LastOne() (*T, error)

func (*Executor[T]) LeftJoinsExpr added in v0.1.0

func (x *Executor[T]) LeftJoinsExpr(table schema.Tabler, conds ...Expr) *Executor[T]

func (*Executor[T]) LeftJoinsXExpr added in v0.1.0

func (x *Executor[T]) LeftJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Executor[T]

func (*Executor[T]) Limit added in v0.1.0

func (x *Executor[T]) Limit(limit int) *Executor[T]

func (*Executor[T]) LockingShare added in v0.1.0

func (x *Executor[T]) LockingShare() *Executor[T]

func (*Executor[T]) LockingUpdate added in v0.1.0

func (x *Executor[T]) LockingUpdate() *Executor[T]

func (*Executor[T]) Not added in v0.1.0

func (x *Executor[T]) Not(query any, args ...any) *Executor[T]

func (*Executor[T]) Offset added in v0.1.0

func (x *Executor[T]) Offset(offset int) *Executor[T]

func (*Executor[T]) Omit added in v0.1.0

func (x *Executor[T]) Omit(columns ...string) *Executor[T]

func (*Executor[T]) OmitExpr added in v0.3.2

func (x *Executor[T]) OmitExpr(columns ...Expr) *Executor[T]

func (*Executor[T]) Or added in v0.1.0

func (x *Executor[T]) Or(query any, args ...any) *Executor[T]

func (*Executor[T]) Order added in v0.1.0

func (x *Executor[T]) Order(value any) *Executor[T]

func (*Executor[T]) OrderExpr added in v0.1.0

func (x *Executor[T]) OrderExpr(columns ...Expr) *Executor[T]

func (*Executor[T]) Pagination added in v0.1.0

func (x *Executor[T]) Pagination(page, perPage int64, maxPerPages ...int64) *Executor[T]

func (*Executor[T]) Pluck added in v0.1.0

func (x *Executor[T]) Pluck(column string, value any) error

func (*Executor[T]) PluckBool added in v0.1.2

func (x *Executor[T]) PluckBool(column string) (slice []bool, err error)

func (*Executor[T]) PluckExpr added in v0.3.0

func (x *Executor[T]) PluckExpr(column Expr, value any) error

func (*Executor[T]) PluckExprBool added in v0.3.0

func (x *Executor[T]) PluckExprBool(column Expr) (slice []bool, err error)

func (*Executor[T]) PluckExprInt added in v0.3.0

func (x *Executor[T]) PluckExprInt(column Expr) (slice []int, err error)

func (*Executor[T]) PluckExprInt16 added in v0.3.0

func (x *Executor[T]) PluckExprInt16(column Expr) (slice []int16, err error)

func (*Executor[T]) PluckExprInt32 added in v0.3.0

func (x *Executor[T]) PluckExprInt32(column Expr) (slice []int32, err error)

func (*Executor[T]) PluckExprInt64 added in v0.3.0

func (x *Executor[T]) PluckExprInt64(column Expr) (slice []int64, err error)

func (*Executor[T]) PluckExprInt8 added in v0.3.0

func (x *Executor[T]) PluckExprInt8(column Expr) (slice []int8, err error)

func (*Executor[T]) PluckExprString added in v0.3.0

func (x *Executor[T]) PluckExprString(column Expr) (slice []string, err error)

func (*Executor[T]) PluckExprUint added in v0.3.0

func (x *Executor[T]) PluckExprUint(column Expr) (slice []uint, err error)

func (*Executor[T]) PluckExprUint16 added in v0.3.0

func (x *Executor[T]) PluckExprUint16(column Expr) (slice []uint16, err error)

func (*Executor[T]) PluckExprUint32 added in v0.3.0

func (x *Executor[T]) PluckExprUint32(column Expr) (slice []uint32, err error)

func (*Executor[T]) PluckExprUint64 added in v0.3.0

func (x *Executor[T]) PluckExprUint64(column Expr) (slice []uint64, err error)

func (*Executor[T]) PluckExprUint8 added in v0.3.0

func (x *Executor[T]) PluckExprUint8(column Expr) (slice []uint8, err error)

func (*Executor[T]) PluckInt added in v0.1.2

func (x *Executor[T]) PluckInt(column string) (slice []int, err error)

func (*Executor[T]) PluckInt16 added in v0.1.5

func (x *Executor[T]) PluckInt16(column string) (slice []int16, err error)

func (*Executor[T]) PluckInt32 added in v0.1.5

func (x *Executor[T]) PluckInt32(column string) (slice []int32, err error)

func (*Executor[T]) PluckInt64 added in v0.1.2

func (x *Executor[T]) PluckInt64(column string) (slice []int64, err error)

func (*Executor[T]) PluckInt8 added in v0.1.5

func (x *Executor[T]) PluckInt8(column string) (slice []int8, err error)

func (*Executor[T]) PluckString added in v0.1.2

func (x *Executor[T]) PluckString(column string) (slice []string, err error)

func (*Executor[T]) PluckUint added in v0.1.5

func (x *Executor[T]) PluckUint(column string) (slice []uint, err error)

func (*Executor[T]) PluckUint16 added in v0.1.5

func (x *Executor[T]) PluckUint16(column string) (slice []uint16, err error)

func (*Executor[T]) PluckUint32 added in v0.1.5

func (x *Executor[T]) PluckUint32(column string) (slice []uint32, err error)

func (*Executor[T]) PluckUint64 added in v0.1.5

func (x *Executor[T]) PluckUint64(column string) (slice []uint64, err error)

func (*Executor[T]) PluckUint8 added in v0.1.5

func (x *Executor[T]) PluckUint8(column string) (slice []uint8, err error)

func (*Executor[T]) Preload added in v0.1.1

func (x *Executor[T]) Preload(query string, args ...any) *Executor[T]

func (*Executor[T]) RightJoinsExpr added in v0.1.0

func (x *Executor[T]) RightJoinsExpr(table schema.Tabler, conds ...Expr) *Executor[T]

func (*Executor[T]) RightJoinsXExpr added in v0.1.0

func (x *Executor[T]) RightJoinsXExpr(table schema.Tabler, alias string, conds ...Expr) *Executor[T]

func (*Executor[T]) Save added in v0.1.0

func (x *Executor[T]) Save(value *T) error

func (*Executor[T]) Scan added in v0.1.0

func (x *Executor[T]) Scan(dest any) error

func (*Executor[T]) ScanBool added in v0.1.2

func (x *Executor[T]) ScanBool() (v bool, err error)

func (*Executor[T]) ScanFloat32 added in v0.1.5

func (x *Executor[T]) ScanFloat32() (v float32, err error)

func (*Executor[T]) ScanFloat64 added in v0.1.2

func (x *Executor[T]) ScanFloat64() (v float64, err error)

func (*Executor[T]) ScanInt added in v0.1.2

func (x *Executor[T]) ScanInt() (v int, err error)

func (*Executor[T]) ScanInt16 added in v0.1.5

func (x *Executor[T]) ScanInt16() (v int16, err error)

func (*Executor[T]) ScanInt32 added in v0.1.5

func (x *Executor[T]) ScanInt32() (v int32, err error)

func (*Executor[T]) ScanInt64 added in v0.1.2

func (x *Executor[T]) ScanInt64() (v int64, err error)

func (*Executor[T]) ScanInt8 added in v0.1.5

func (x *Executor[T]) ScanInt8() (v int8, err error)

func (*Executor[T]) ScanOne added in v0.1.0

func (x *Executor[T]) ScanOne() (*T, error)

func (*Executor[T]) ScanString added in v0.1.2

func (x *Executor[T]) ScanString() (v string, err error)

func (*Executor[T]) ScanUint added in v0.1.5

func (x *Executor[T]) ScanUint() (v uint, err error)

func (*Executor[T]) ScanUint16 added in v0.1.5

func (x *Executor[T]) ScanUint16() (v uint16, err error)

func (*Executor[T]) ScanUint32 added in v0.1.5

func (x *Executor[T]) ScanUint32() (v uint32, err error)

func (*Executor[T]) ScanUint64 added in v0.1.5

func (x *Executor[T]) ScanUint64() (v uint64, err error)

func (*Executor[T]) ScanUint8 added in v0.1.5

func (x *Executor[T]) ScanUint8() (v uint8, err error)

func (*Executor[T]) Scopes added in v0.1.0

func (x *Executor[T]) Scopes(cs ...Condition) *Executor[T]

func (*Executor[T]) Select added in v0.1.0

func (x *Executor[T]) Select(query any, args ...any) *Executor[T]

func (*Executor[T]) SelectExpr added in v0.1.0

func (x *Executor[T]) SelectExpr(columns ...Expr) *Executor[T]

func (*Executor[T]) Session added in v0.1.0

func (x *Executor[T]) Session(config *gorm.Session) *Executor[T]

func (*Executor[T]) Table added in v0.1.0

func (x *Executor[T]) Table(name string, args ...any) *Executor[T]

func (*Executor[T]) TableExpr added in v0.1.0

func (x *Executor[T]) TableExpr(fromSubs ...From) *Executor[T]

func (*Executor[T]) Take added in v0.1.0

func (x *Executor[T]) Take(dest any) error

func (*Executor[T]) TakeBool added in v0.1.2

func (x *Executor[T]) TakeBool() (v bool, err error)

func (*Executor[T]) TakeFloat32 added in v0.1.5

func (x *Executor[T]) TakeFloat32() (v float32, err error)

func (*Executor[T]) TakeFloat64 added in v0.1.2

func (x *Executor[T]) TakeFloat64() (v float64, err error)

func (*Executor[T]) TakeInt added in v0.1.2

func (x *Executor[T]) TakeInt() (v int, err error)

func (*Executor[T]) TakeInt16 added in v0.1.5

func (x *Executor[T]) TakeInt16() (v int16, err error)

func (*Executor[T]) TakeInt32 added in v0.1.5

func (x *Executor[T]) TakeInt32() (v int32, err error)

func (*Executor[T]) TakeInt64 added in v0.1.2

func (x *Executor[T]) TakeInt64() (v int64, err error)

func (*Executor[T]) TakeInt8 added in v0.1.5

func (x *Executor[T]) TakeInt8() (v int8, err error)

func (*Executor[T]) TakeOne added in v0.1.0

func (x *Executor[T]) TakeOne() (*T, error)

func (*Executor[T]) TakeString added in v0.1.2

func (x *Executor[T]) TakeString() (v string, err error)

func (*Executor[T]) TakeUint added in v0.1.5

func (x *Executor[T]) TakeUint() (v uint, err error)

func (*Executor[T]) TakeUint16 added in v0.1.5

func (x *Executor[T]) TakeUint16() (v uint16, err error)

func (*Executor[T]) TakeUint32 added in v0.1.5

func (x *Executor[T]) TakeUint32() (v uint32, err error)

func (*Executor[T]) TakeUint64 added in v0.1.5

func (x *Executor[T]) TakeUint64() (v uint64, err error)

func (*Executor[T]) TakeUint8 added in v0.1.5

func (x *Executor[T]) TakeUint8() (v uint8, err error)

func (*Executor[T]) Unscoped added in v0.1.1

func (x *Executor[T]) Unscoped() *Executor[T]

func (*Executor[T]) Update added in v0.1.0

func (x *Executor[T]) Update(column string, value any) (rowsAffected int64, err error)

func (*Executor[T]) UpdateColumn added in v0.1.0

func (x *Executor[T]) UpdateColumn(column string, value any) (rowsAffected int64, err error)

func (*Executor[T]) UpdateColumnExpr added in v0.3.2

func (x *Executor[T]) UpdateColumnExpr(column Expr, value any) (rowsAffected int64, err error)

func (*Executor[T]) UpdateColumns added in v0.1.0

func (x *Executor[T]) UpdateColumns(value *T) (rowsAffected int64, err error)

func (*Executor[T]) UpdateColumnsExpr added in v0.3.2

func (x *Executor[T]) UpdateColumnsExpr(columns ...SetExpr) (rowsAffected int64, err error)

func (*Executor[T]) UpdateColumnsMap added in v0.1.3

func (x *Executor[T]) UpdateColumnsMap(value map[string]any) (rowsAffected int64, err error)

func (*Executor[T]) UpdateExpr added in v0.3.2

func (x *Executor[T]) UpdateExpr(column Expr, value any) (rowsAffected int64, err error)

func (*Executor[T]) Updates added in v0.1.0

func (x *Executor[T]) Updates(value *T) (rowsAffected int64, err error)

func (*Executor[T]) UpdatesExpr added in v0.3.2

func (x *Executor[T]) UpdatesExpr(columns ...SetExpr) (rowsAffected int64, err error)

func (*Executor[T]) UpdatesMap added in v0.1.3

func (x *Executor[T]) UpdatesMap(value map[string]any) (rowsAffected int64, err error)

func (*Executor[T]) Where added in v0.1.0

func (x *Executor[T]) Where(query any, args ...any) *Executor[T]

func (*Executor[T]) WithContext added in v0.1.0

func (x *Executor[T]) WithContext(ctx context.Context) *Executor[T]

type Expr

type Expr interface {
	clause.Expression

	As(alias string) Expr
	ColumnName() string
	Expression() clause.Expression
	RawExpr() any
	BuildColumn(*gorm.Statement, ...BuildOption) string
	BuildWithArgs(*gorm.Statement) (query string, args []any)
}

Expr a query expression about field

func And

func And(exprs ...Expr) Expr

And return and condition form example: (`id1` AND `id2`)

func EmptyExpr

func EmptyExpr() Expr

EmptyExpr return a empty expression. it is nil

func Exist

func Exist(subQuery *gorm.DB) Expr

Exist equivalent EXISTS(subQuery)

func Not

func Not(exprs ...Expr) Expr

Not return not condition form example: (NOT `id1` AND NOT `id2`)

func NotExist

func NotExist(subQuery *gorm.DB) Expr

NotExist equivalent NOT EXISTS(subQuery)

func Or

func Or(exprs ...Expr) Expr

Or return or condition form example: (`id1` OR `id2`)

type Field

type Field struct {
	// contains filtered or unexported fields
}

Field a standard field struct

func NewField

func NewField(table, column string, opts ...Option) Field

NewField new field

func SubQuery added in v0.3.0

func SubQuery(db *gorm.DB) Field

func (Field) Add

func (field Field) Add(value any) Field

Add use value type:

time.Duration: use DATE_ADD(expr, INTERVAL ? MICROSECOND)
other: use expr+?

func (Field) AddCol

func (e Field) AddCol(col Expr) Field

AddCol use expr1 + expr2

func (Field) As

func (e Field) As(alias string) Expr

As use expr AS ?

func (Field) Avg

func (e Field) Avg() Float64

Avg use AVG(expr)

func (Field) Between

func (field Field) Between(left any, right any) Expr

Between use expr BETWEEN ? AND ?

func (Field) BitAnd

func (field Field) BitAnd(value any) Field

BitAnd use expr expr&?

func (Field) BitFlip

func (field Field) BitFlip() Field

BitFlip use expr ~expr

func (Field) BitOr

func (field Field) BitOr(value any) Field

BitOr use expr expr|?

func (Field) BitXor

func (field Field) BitXor(value any) Field

BitXor use expr expr^?

func (Field) Build

func (e Field) Build(builder clause.Builder)

func (Field) BuildColumn

func (e Field) BuildColumn(stmt *gorm.Statement, opts ...BuildOption) string

func (Field) BuildWithArgs

func (e Field) BuildWithArgs(stmt *gorm.Statement) (string, []any)

func (Field) ColumnName

func (e Field) ColumnName() string

func (Field) Concat

func (field Field) Concat(before, after string) String

Concat use CONCAT(?,?,?)

func (Field) ConcatCol

func (e Field) ConcatCol(cols ...Expr) Field

ConcatCol use CONCAT(expr1,exp2...exprN)

func (Field) Count

func (e Field) Count() Int

Count use COUNT(expr)

func (Field) Date

func (field Field) Date() Time

Date use DATE(expr) return the date.

func (Field) DateDiff

func (field Field) DateDiff(expr2 time.Time) Int

DateDiff use DATEDIFF(expr1, expr2)

func (Field) DateFormat

func (field Field) DateFormat(format string) String

DateFormat use DATE_FORMAT(date,format)

func (Field) Day

func (field Field) Day() Int

Day use DAY(date) return the day.

func (Field) DayName

func (field Field) DayName() String

DayName use DAYNAME(date) return the name of the day of the week.

func (Field) DayOfMonth

func (field Field) DayOfMonth() Int

DayOfMonth use DAYOFMONTH(date)

func (Field) DayOfWeek

func (field Field) DayOfWeek() Int

DayOfWeek use DAYOFWEEK(date)

func (Field) DayOfYear

func (field Field) DayOfYear() Int

DayOfYear use DAYOFYEAR(date)

func (Field) Desc

func (e Field) Desc() Expr

Desc use expr DESC

func (Field) Distinct

func (e Field) Distinct() Int

Distinct use DISTINCT(expr)

func (Field) Div

func (field Field) Div(value any) Field

Div use expr/?

func (Field) DivCol

func (e Field) DivCol(col Expr) Field

DivCol use (expr1) / (expr2)

func (Field) Eq

func (field Field) Eq(value any) Expr

Eq use expr = ?

func (Field) EqCol

func (e Field) EqCol(e2 Expr) Expr

EqCol use expr1 = expr2

func (Field) EqSubQuery added in v0.3.0

func (e Field) EqSubQuery(subQuery *gorm.DB) Expr

EqSubQuery use expr1 = (subQuery)

func (Field) Expression

func (e Field) Expression() clause.Expression

func (Field) FieldName added in v0.5.5

func (e Field) FieldName(prefixes ...string) string

FieldName hold model column name. if prefixes not exist returns same as ColumnName(), others {prefixes[0]}_{ColumnName}

func (Field) FindInSet

func (field Field) FindInSet(targetList string) Expr

FindInSet use FIND_IN_SET(expr, ?)

func (Field) FindInSetCol added in v0.3.1

func (e Field) FindInSetCol(e2 Expr) Expr

FindInSetCol use FIND_IN_SET(expr1, expr2)

func (Field) FindInSetColWith added in v0.3.1

func (e Field) FindInSetColWith(e2 Expr) Expr

FindInSetColWith use FIND_IN_SET(expr2, expr1)

func (Field) FindInSetSubQuery added in v0.3.0

func (e Field) FindInSetSubQuery(subQuery *gorm.DB) Expr

FindInSetSubQuery FIND_IN_SET(column, (subQuery))

func (Field) FindInSetWith

func (field Field) FindInSetWith(target string) Expr

FindInSetWith use FIND_IN_SET(?, expr)

func (Field) Floor

func (field Field) Floor() Field

Floor se FLOOR(expr)

func (Field) FloorDiv

func (field Field) FloorDiv(value any) Field

FloorDiv use expr DIV ?

func (Field) FromDays

func (field Field) FromDays() Time

FromDays use FROM_DAYS(value)

func (Field) FromUnixTime

func (field Field) FromUnixTime(format ...string) String

FromUnixTime use FromUnixTime(unix_timestamp[, format])

func (Field) GroupConcat

func (e Field) GroupConcat() Expr

GroupConcat use GROUP_CONCAT(expr)

func (Field) Gt

func (field Field) Gt(value any) Expr

Gt use expr > ?

func (Field) GtCol

func (e Field) GtCol(e2 Expr) Expr

GtCol use expr1 > expr2

func (Field) GtSubQuery added in v0.3.0

func (e Field) GtSubQuery(subQuery *gorm.DB) Expr

GtSubQuery use expr1 > (subQuery)

func (Field) Gte

func (field Field) Gte(value any) Expr

Gte use expr >= ?

func (Field) GteCol

func (e Field) GteCol(e2 Expr) Expr

GteCol use expr1 >= expr2

func (Field) GteSubQuery added in v0.3.0

func (e Field) GteSubQuery(subQuery *gorm.DB) Expr

GteSubQuery use expr1 >= (subQuery)

func (Field) Hour

func (field Field) Hour() Int

Hour use HOUR(date) return the hour.

func (Field) IfNull

func (field Field) IfNull(value any) Expr

IfNull use IFNULL(expr,?)

func (Field) In

func (field Field) In(values ...any) Expr

In use expr IN (?)

func (Field) InSubQuery added in v0.3.0

func (e Field) InSubQuery(subQuery *gorm.DB) Expr

InSubQuery use expr1 IN (subQuery)

func (Field) IsNotNull

func (e Field) IsNotNull() Expr

IsNotNull use expr IS NOT NULL

func (Field) IsNull

func (e Field) IsNull() Expr

IsNull use expr IS NULL

func (Field) LTrim added in v0.0.7

func (field Field) LTrim(remStr string) String

LTrim use TRIM(LEADING ? FROM ?)

func (Field) LTrimSpace added in v0.0.7

func (field Field) LTrimSpace() String

LTrimSpace use LTRIM(?)

func (Field) LeftShift

func (field Field) LeftShift(value any) Field

LeftShift use expr<<?

func (Field) Length

func (e Field) Length() Int

Length use LENGTH(expr)

func (Field) Like

func (field Field) Like(value any) Expr

Like use expr LIKE ?

func (Field) Lt

func (field Field) Lt(value any) Expr

Lt use expr < ?

func (Field) LtCol

func (e Field) LtCol(e2 Expr) Expr

LtCol use expr1 < expr2

func (Field) LtSubQuery added in v0.3.0

func (e Field) LtSubQuery(subQuery *gorm.DB) Expr

LtSubQuery use expr1 < (subQuery)

func (Field) Lte

func (field Field) Lte(value any) Expr

Lte use expr <= ?

func (Field) LteCol

func (e Field) LteCol(e2 Expr) Expr

LteCol use expr1 <= expr2

func (Field) LteSubQuery added in v0.3.0

func (e Field) LteSubQuery(subQuery *gorm.DB) Expr

LteSubQuery use expr1 <= (subQuery)

func (Field) Max

func (e Field) Max() Float64

Max use MAX(expr)

func (Field) MicroSecond

func (field Field) MicroSecond() Int

MicroSecond use MICROSECOND(date) return the microsecond.

func (Field) Min

func (e Field) Min() Float64

Min use MIN(expr)

func (Field) Minute

func (field Field) Minute() Int

Minute use MINUTE(date) return the minute.

func (Field) Mod

func (field Field) Mod(value any) Field

Mod use expr%?

func (Field) Month

func (field Field) Month() Int

Month use MONTH(date) return the month.

func (Field) MonthName

func (field Field) MonthName() String

MonthName use MONTHNAME(date) return the name of the month of the year.

func (Field) Mul

func (field Field) Mul(value any) Field

Mul use expr*?

func (Field) MulCol

func (e Field) MulCol(col Expr) Field

MulCol use (expr1) * (expr2)

func (Field) Neq

func (field Field) Neq(value any) Expr

Neq use expr <> ?

func (Field) NeqCol

func (e Field) NeqCol(e2 Expr) Expr

NeqCol use expr1 <> expr2

func (Field) NeqSubQuery added in v0.3.0

func (e Field) NeqSubQuery(subQuery *gorm.DB) Expr

NeqSubQuery use expr1 <> (subQuery)

func (Field) NotBetween

func (field Field) NotBetween(left any, right any) Expr

NotBetween use NOT (expr BETWEEN ? AND ?)

func (Field) NotIn

func (field Field) NotIn(values ...any) Expr

NotIn use expr NOT IN (?)

func (Field) NotInSubQuery added in v0.3.0

func (e Field) NotInSubQuery(subQuery *gorm.DB) Expr

NotInSubQuery use expr1 NOT IN (subQuery)

func (Field) NotLike

func (field Field) NotLike(value any) Expr

NotLike use expr NOT LIKE ?

func (Field) NotRegxp

func (field Field) NotRegxp(value string) Expr

NotRegxp use NOT expr REGEXP ?

func (Field) RTrim added in v0.0.7

func (field Field) RTrim(remStr string) String

RTrim use TRIM(TRAILING ? FROM ?)

func (Field) RTrimSpace added in v0.0.7

func (field Field) RTrimSpace() String

RTrimSpace use RTRIM(?)

func (Field) RawExpr

func (e Field) RawExpr() any

func (Field) Regexp

func (field Field) Regexp(value any) Expr

Regexp use expr REGEXP ?

func (Field) Replace

func (field Field) Replace(from, to string) String

Replace use REPLACE(expr,?,?)

func (Field) RightShift

func (field Field) RightShift(value any) Field

RightShift use expr>>?

func (Field) Round

func (field Field) Round(decimals int) Field

Round use ROUND(expr, ?)

func (Field) Second

func (field Field) Second() Int

Second use SECOND(date) return the second.

func (Field) SetCol added in v0.4.0

func (e Field) SetCol(e2 Expr) SetExpr

SetCol expr1=expr2

func (Field) SetExpr added in v0.3.2

func (e Field) SetExpr() any

func (Field) SetSubQuery added in v0.3.2

func (e Field) SetSubQuery(subQuery *gorm.DB) SetExpr

setSubQuery set with subQuery

func (Field) Sub

func (field Field) Sub(value any) Field

Sub use below value type:

time.Duration: use DATE_SUB(expr, INTERVAL ? MICROSECOND)
other: use expr-?

func (Field) SubCol

func (e Field) SubCol(col Expr) Field

SubCol use expr1 - expr2

func (Field) SubstringIndex

func (field Field) SubstringIndex(delim string, count int) String

SubstringIndex use SUBSTRING_INDEX(expr,?,?) https://dev.mysql.com/doc/refman/8.0/en/functions.html#function_substring-index

func (Field) Sum

func (field Field) Sum() Field

Sum use SUM(expr)

func (Field) Trim added in v0.0.7

func (field Field) Trim(remStr string) String

Trim use TRIM(BOTH ? FROM ?)

func (Field) TrimSpace added in v0.0.7

func (field Field) TrimSpace() String

TrimSpace use TRIM(?)

func (Field) UnixTimestamp

func (field Field) UnixTimestamp() Int64

UnixTimestamp use UnixTimestamp(date)

func (Field) Value added in v0.3.2

func (field Field) Value(value any) SetExpr

Value set value

func (Field) ValueAny added in v0.3.3

func (e Field) ValueAny(value any) SetExpr

ValueAny set any value. Deprecated: use other ValueXXX instead.

func (Field) ValueNull added in v0.3.3

func (e Field) ValueNull() SetExpr

ValueNull set value NULL

func (Field) WithTable

func (e Field) WithTable(table string) Expr

func (Field) Year

func (field Field) Year() Int

Year use YEAR(date) return the year.

type Float

type Float[T constraints.Float | ~string] Field

Float type field

func NewFloat

func NewFloat[T constraints.Float | ~string](table, column string, opts ...Option) Float[T]

NewFloat new float field.

func (Float[T]) Add

func (field Float[T]) Add(value T) Float[T]

Add use expr+?

func (Float[T]) AddCol added in v0.1.8

func (e Float[T]) AddCol(col Expr) Float[T]

AddCol use expr1 + expr2

func (Float[T]) Between

func (field Float[T]) Between(left T, right T) Expr

Between use expr BETWEEN ? AND ?

func (Float[T]) Div

func (field Float[T]) Div(value T) Float[T]

Div use expr/?

func (Float[T]) DivCol added in v0.1.8

func (e Float[T]) DivCol(col Expr) Float[T]

DivCol use (expr1) / (expr2)

func (Float[T]) Eq

func (field Float[T]) Eq(value T) Expr

Eq equal to, use expr = ?

func (Float[T]) FindInSet added in v0.1.7

func (field Float[T]) FindInSet(targetList string) Expr

FindInSet use FIND_IN_SET(expr, ?)

func (Float[T]) Floor

func (field Float[T]) Floor() Int

Floor se FLOOR(expr)

func (Float[T]) FloorDiv

func (field Float[T]) FloorDiv(value T) Int

FloorDiv use expr DIV ?

func (Float[T]) Gt

func (field Float[T]) Gt(value T) Expr

Gt greater than, use expr > ?

func (Float[T]) Gte

func (field Float[T]) Gte(value T) Expr

Gte greater or equal to, use expr >= ?

func (Float[T]) IfNull

func (field Float[T]) IfNull(value T) Expr

IfNull use IFNULL(expr,?)

func (Float[T]) In

func (field Float[T]) In(values ...T) Expr

In use expr IN (?)

func (Float[T]) InAny added in v0.1.6

func (field Float[T]) InAny(value any) Expr

InAny use expr IN (?) value must be a array/slice

func (Float[T]) Like

func (field Float[T]) Like(value T) Expr

Like use expr LIKE ?

func (Float[T]) Lt

func (field Float[T]) Lt(value T) Expr

Lt less than, use expr < ?

func (Float[T]) Lte

func (field Float[T]) Lte(value T) Expr

Lte less or equal to, use expr <= ?

func (Float[T]) Mul

func (field Float[T]) Mul(value T) Float[T]

Mul use expr*?

func (Float[T]) MulCol added in v0.1.8

func (e Float[T]) MulCol(col Expr) Float[T]

MulCol use (expr1) * (expr2)

func (Float[T]) Neq

func (field Float[T]) Neq(value T) Expr

Neq not equal to, use expr <> ?

func (Float[T]) NotBetween

func (field Float[T]) NotBetween(left T, right T) Expr

NotBetween use NOT (expr BETWEEN ? AND ?).

func (Float[T]) NotIn

func (field Float[T]) NotIn(values ...T) Expr

NotIn use expr NOT IN (?)

func (Float[T]) NotInAny added in v0.1.6

func (field Float[T]) NotInAny(value any) Expr

NotInAny use expr NOT IN (?) value must be a array/slice

func (Float[T]) NotLike

func (field Float[T]) NotLike(value T) Expr

NotLike use expr NOT LIKE ?

func (Float[T]) Round

func (field Float[T]) Round(decimals int) Float[T]

Round use ROUND(expr, ?)

func (Float[T]) Sub

func (field Float[T]) Sub(value T) Float[T]

Sub use expr-?

func (Float[T]) SubCol added in v0.1.8

func (e Float[T]) SubCol(col Expr) Float[T]

SubCol use expr1 - expr2

func (Float[T]) Sum

func (field Float[T]) Sum() Float[T]

Sum use SUM(expr)

func (Float[T]) Value added in v0.3.2

func (field Float[T]) Value(value T) SetExpr

Value set value

func (Float[T]) ValuePointer added in v0.4.1

func (field Float[T]) ValuePointer(value *T) SetExpr

Value set value use pointer

func (Float[T]) ValueZero added in v0.3.2

func (field Float[T]) ValueZero() SetExpr

ValueZero set value zero

type Float32

type Float32 = Float[float32]

func NewFloat32

func NewFloat32(table, column string, opts ...Option) Float32

NewFloat32 new float32 field

type Float64

type Float64 = Float[float64]

func NewFloat64

func NewFloat64(table, column string, opts ...Option) Float64

NewFloat64 new float64 field

type From

type From struct {
	Alias    string
	SubQuery *gorm.DB
}

From hold subQuery

type Int

type Int = Integer[int]

func NewInt

func NewInt(table, column string, opts ...Option) Int

NewField new int field

type Int16

type Int16 = Integer[int16]

func NewInt16

func NewInt16(table, column string, opts ...Option) Int16

NewField new int16 field

type Int32

type Int32 = Integer[int32]

func NewInt32

func NewInt32(table, column string, opts ...Option) Int32

NewField new int32 field

type Int64

type Int64 = Integer[int64]

func NewInt64

func NewInt64(table, column string, opts ...Option) Int64

NewField new int64 field

func UnixTimestamp

func UnixTimestamp(date ...string) Int64

UnixTimestamp use UNIX_TIMESTAMP([date])

type Int8

type Int8 = Integer[int8]

func NewInt8

func NewInt8(table, column string, opts ...Option) Int8

NewField new int8 field

type Integer

type Integer[T constraints.Integer] Field

Integer type field

func NewInteger

func NewInteger[T constraints.Integer](table, column string, opts ...Option) Integer[T]

NewInt new Integer

func (Integer[T]) Add

func (field Integer[T]) Add(value T) Integer[T]

Add use expr+?

func (Integer[T]) AddCol added in v0.1.8

func (e Integer[T]) AddCol(col Expr) Integer[T]

AddCol use expr1 + expr2

func (Integer[T]) Between

func (field Integer[T]) Between(left T, right T) Expr

Between use expr BETWEEN ? AND ?

func (Integer[T]) BitAnd

func (field Integer[T]) BitAnd(value T) Integer[T]

BitAnd use expr expr&?

func (Integer[T]) BitFlip

func (field Integer[T]) BitFlip() Integer[T]

BitFlip use expr ~expr

func (Integer[T]) BitOr

func (field Integer[T]) BitOr(value T) Integer[T]

BitOr use expr expr|?

func (Integer[T]) BitXor

func (field Integer[T]) BitXor(value T) Integer[T]

BitXor use expr expr^?

func (Integer[T]) Div

func (field Integer[T]) Div(value T) Integer[T]

Div use expr/?

func (Integer[T]) DivCol added in v0.1.8

func (e Integer[T]) DivCol(col Expr) Integer[T]

DivCol use (expr1) / (expr2)

func (Integer[T]) Eq

func (field Integer[T]) Eq(value T) Expr

Eq equal to, use expr = ?

func (Integer[T]) FindInSet added in v0.1.7

func (field Integer[T]) FindInSet(targetList string) Expr

FindInSet equal to FIND_IN_SET(expr, ?)

func (Integer[T]) FloorDiv

func (field Integer[T]) FloorDiv(value T) Integer[T]

FloorDiv use expr DIV ?

func (Integer[T]) FromDays

func (field Integer[T]) FromDays() Time

FromDays use FROM_DAYS(value)

func (Integer[T]) FromUnixTime

func (field Integer[T]) FromUnixTime(format ...string) String

FromUnixTime use FromUnixTime(unix_timestamp[, format])

func (Integer[T]) Gt

func (field Integer[T]) Gt(value T) Expr

Gt greater than, use expr > ?

func (Integer[T]) Gte

func (field Integer[T]) Gte(value T) Expr

Gte greater or equal to, use expr >= ?

func (Integer[T]) IfNull

func (field Integer[T]) IfNull(value T) Expr

IfNull use IFNULL(expr,?)

func (Integer[T]) In

func (field Integer[T]) In(values ...T) Expr

In use expr IN (?)

func (Integer[T]) InAny added in v0.1.6

func (field Integer[T]) InAny(value any) Expr

InAny use expr IN (?) value must be a array/slice

func (Integer[T]) LeftShift

func (field Integer[T]) LeftShift(value T) Integer[T]

LeftShift use expr<<?

func (Integer[T]) Like

func (field Integer[T]) Like(value T) Expr

Like use expr LIKE ?

func (Integer[T]) Lt

func (field Integer[T]) Lt(value T) Expr

Lt less than, use expr < ?

func (Integer[T]) Lte

func (field Integer[T]) Lte(value T) Expr

Lte less or equal to, use expr <= ?

func (Integer[T]) Mod

func (field Integer[T]) Mod(value T) Integer[T]

Mod use expr%?

func (Integer[T]) Mul

func (field Integer[T]) Mul(value T) Integer[T]

Mul use expr*?

func (Integer[T]) MulCol added in v0.1.8

func (e Integer[T]) MulCol(col Expr) Integer[T]

MulCol use (expr1) * (expr2)

func (Integer[T]) Neq

func (field Integer[T]) Neq(value T) Expr

Neq not equal to, use expr <> ?

func (Integer[T]) NotBetween

func (field Integer[T]) NotBetween(left T, right T) Expr

NotBetween use NOT (expr BETWEEN ? AND ?)

func (Integer[T]) NotIn

func (field Integer[T]) NotIn(values ...T) Expr

NotIn use expr NOT IN (?)

func (Integer[T]) NotInAny added in v0.1.6

func (field Integer[T]) NotInAny(value any) Expr

NotInAny use expr NOT IN (?) value must be a array/slice

func (Integer[T]) NotLike

func (field Integer[T]) NotLike(value T) Expr

NotLike use expr NOT LIKE ?

func (Integer[T]) RightShift

func (field Integer[T]) RightShift(value T) Integer[T]

RightShift use expr>>?

func (Integer[T]) Round

func (field Integer[T]) Round(value int) Integer[T]

Round use ROUND(expr, ?)

func (Integer[T]) Sub

func (field Integer[T]) Sub(value T) Integer[T]

Add use expr-?

func (Integer[T]) SubCol added in v0.1.8

func (e Integer[T]) SubCol(col Expr) Integer[T]

SubCol use expr1 - expr2

func (Integer[T]) Sum

func (field Integer[T]) Sum() Integer[T]

Sum use SUM(expr)

func (Integer[T]) Value added in v0.3.2

func (field Integer[T]) Value(value T) SetExpr

Value set value

func (Integer[T]) ValuePointer added in v0.4.1

func (field Integer[T]) ValuePointer(value *T) SetExpr

Value set value use pointer

func (Integer[T]) ValueZero added in v0.3.2

func (field Integer[T]) ValueZero() SetExpr

ValueZero set value zero

type Option

type Option func(clause.Column) clause.Column

Option field option

type Raw

type Raw = Field

func NewRaw

func NewRaw(sql string, vars ...any) Raw

NewRaw new raw

type SetExpr added in v0.3.2

type SetExpr interface {
	Expr

	SetExpr() any
}

type String

type String Field

String string type field

func FromUnixTime

func FromUnixTime(date int64, format ...string) String

FromUnixTime use FROM_UNIXTIME(unix_timestamp[,format])

func NewString

func NewString(table, column string, opts ...Option) String

NewString new string field.

func (String) AddCol added in v0.1.8

func (field String) AddCol(col Expr) String

AddCol use expr1 + expr2

func (String) Between

func (field String) Between(left, right string) Expr

Between use expr BETWEEN ? AND ?

func (String) Concat

func (field String) Concat(before, after string) String

Concat use CONCAT(?,?,?)

func (String) ConcatCol added in v0.1.8

func (field String) ConcatCol(cols ...Expr) String

ConcatCol use CONCAT(expr1,exp2...exprN)

func (String) DivCol added in v0.1.8

func (field String) DivCol(col Expr) String

DivCol use (expr1) / (expr2)

func (String) Eq

func (field String) Eq(value string) Expr

Eq equal to, use expr = ?

func (String) FindInSet

func (field String) FindInSet(targetList string) Expr

FindInSet equal to FIND_IN_SET(expr, ?)

func (String) FindInSetWith

func (field String) FindInSetWith(target string) Expr

FindInSetWith equal to FIND_IN_SET(?, expr)

func (String) FuzzyLike

func (field String) FuzzyLike(value string) Expr

FuzzyLike use expr LIKE ?, ? contain prefix % and suffix % e.g. expr LIKE %value%

func (String) Gt

func (field String) Gt(value string) Expr

Gt greater than, use expr > ?

func (String) Gte

func (field String) Gte(value string) Expr

Gte greater or equal to, use expr >= ?

func (String) Hidden added in v0.2.2

func (field String) Hidden(left, right int, pad string) String

Hidden use CONCAT(LEFT(expr,left),pad,RIGHT(expr,right)) detail see innerHidden

func (String) HiddenPrefix added in v0.2.2

func (field String) HiddenPrefix(right int, pad string) String

HiddenPrefix use CONCAT(pad,RIGHT(expr,right))

func (String) HiddenSuffix added in v0.2.2

func (field String) HiddenSuffix(left int, pad string) String

HiddenSuffix use CONCAT(LEFT(expr,left),pad)

func (String) IfNull

func (field String) IfNull(value string) Expr

IfNull use IFNULL(expr,?)

func (String) In

func (field String) In(values ...string) Expr

In use expr IN (?)

func (String) InAny added in v0.1.6

func (field String) InAny(value any) Expr

InAny use expr IN (?) value must be a array/slice

func (String) LTrim added in v0.0.7

func (field String) LTrim(remStr string) String

LTrim use TRIM(LEADING ? FROM ?)

func (String) LTrimSpace added in v0.0.7

func (field String) LTrimSpace() String

LTrimSpace use LTRIM(?)

func (String) LeftLike

func (field String) LeftLike(value string) Expr

LeftLike use expr LIKE ?, ? contain suffix %. e.g. expr LIKE value%

func (String) Like

func (field String) Like(value string) Expr

Like use expr LIKE ?

func (String) Lt

func (field String) Lt(value string) Expr

Lt less than, use expr < ?

func (String) Lte

func (field String) Lte(value string) Expr

Lte less or equal to, use expr <= ?

func (String) MulCol added in v0.1.8

func (field String) MulCol(col Expr) String

MulCol use (expr1) * (expr2)

func (String) Neq

func (field String) Neq(value string) Expr

Neq not equal to, use expr <> ?

func (String) NotBetween

func (field String) NotBetween(left, right string) Expr

NotBetween use NOT (expr BETWEEN ? AND ?)

func (String) NotIn

func (field String) NotIn(values ...string) Expr

NotIn use expr NOT IN (?)

func (String) NotInAny added in v0.1.6

func (field String) NotInAny(value any) Expr

NotInAny use expr NOT IN (?) value must be a array/slice

func (String) NotLike

func (field String) NotLike(value string) Expr

NotLike use expr NOT LIKE ?

func (String) NotRegxp

func (field String) NotRegxp(value string) Expr

NotRegxp use NOT expr REGEXP ?

func (String) RTrim added in v0.0.7

func (field String) RTrim(remStr string) String

RTrim use TRIM(TRAILING ? FROM ?)

func (String) RTrimSpace added in v0.0.7

func (field String) RTrimSpace() String

RTrimSpace use RTRIM(?)

func (String) Regexp

func (field String) Regexp(value string) Expr

Regexp use expr REGEXP ?

func (String) Replace

func (field String) Replace(from, to string) String

Replace use REPLACE(expr,?,?)

func (String) SubCol added in v0.1.8

func (field String) SubCol(col Expr) String

SubCol use expr1 - expr2

func (String) SubstringIndex

func (field String) SubstringIndex(delim string, count int) String

SubstringIndex use SUBSTRING_INDEX(expr,?,?) https://dev.mysql.com/doc/refman/8.0/en/functions.html#function_substring-index

func (String) Trim added in v0.0.7

func (field String) Trim(remStr string) String

Trim use TRIM(BOTH ? FROM ?)

func (String) TrimSpace added in v0.0.7

func (field String) TrimSpace() String

TrimSpace use TRIM(?)

func (String) Value added in v0.3.2

func (field String) Value(value string) SetExpr

Value set value

func (String) ValuePointer added in v0.4.1

func (field String) ValuePointer(value *string) SetExpr

Value set value use pointer

func (String) ValueZero added in v0.3.2

func (field String) ValueZero() SetExpr

ValueZero set value zero

type Time

type Time Field

Time time type field

func CurDate

func CurDate() Time

CurDate return result of CURDATE()

func CurTime

func CurTime() Time

CurTime return result of CURTIME()

func FromDays

func FromDays(value int) Time

FromDays equal to FROM_DAYS(value)

func NewTime

func NewTime(table, column string, opts ...Option) Time

NewTime bew time field

func Now

func Now() Time

Now return result of NOW()

func (Time) Add

func (field Time) Add(value time.Duration) Time

Add use DATE_ADD(date, INTERVAL ? MICROSECOND)

func (Time) AddCol added in v0.1.8

func (e Time) AddCol(col Expr) Time

AddCol use expr1 + expr2

func (Time) Between

func (field Time) Between(left time.Time, right time.Time) Expr

Between use expr BETWEEN ? AND ?

func (Time) Date

func (field Time) Date() Time

Date use DATE(expr) return the date.

func (Time) DateDiff

func (field Time) DateDiff(expr2 time.Time) Int

DateDiff use DATEDIFF(expr1, expr2)

func (Time) DateFormat

func (field Time) DateFormat(format string) String

DateFormat use DATE_FORMAT(date,format)

func (Time) Day

func (field Time) Day() Int

Day use DAY(date) return the day.

func (Time) DayName

func (field Time) DayName() String

DayName use DAYNAME(date) return the name of the day of the week.

func (Time) DayOfMonth

func (field Time) DayOfMonth() Int

DayOfMonth use DAYOFMONTH(date)

func (Time) DayOfWeek

func (field Time) DayOfWeek() Int

DayOfWeek use DAYOFWEEK(date)

func (Time) DayOfYear

func (field Time) DayOfYear() Int

DayOfYear use DAYOFYEAR(date)

func (Time) DivCol added in v0.1.8

func (e Time) DivCol(col Expr) Time

DivCol use (expr1) / (expr2)

func (Time) Eq

func (field Time) Eq(value time.Time) Expr

Eq equal to, use expr = ?

func (Time) FindInSet added in v0.1.7

func (field Time) FindInSet(targetList string) Expr

FindInSet use FIND_IN_SET(expr, ?)

func (Time) Gt

func (field Time) Gt(value time.Time) Expr

Gt greater than, use expr > ?

func (Time) Gte

func (field Time) Gte(value time.Time) Expr

Gte greater or equal to, use expr >= ?

func (Time) Hour

func (field Time) Hour() Int

Hour use HOUR(date) return the hour.

func (Time) IfNull

func (field Time) IfNull(value time.Time) Expr

IfNull use IFNULL(expr,?)

func (Time) In

func (field Time) In(values ...time.Time) Expr

In use expr IN (?)

func (Time) InAny added in v0.1.6

func (field Time) InAny(value any) Expr

InAny use expr IN (?) value must be a array/slice

func (Time) Lt

func (field Time) Lt(value time.Time) Expr

Lt less than, use expr < ?

func (Time) Lte

func (field Time) Lte(value time.Time) Expr

Lte less or equal to, use expr <= ?

func (Time) MicroSecond

func (field Time) MicroSecond() Int

MicroSecond use MICROSECOND(date) return the microsecond.

func (Time) Minute

func (field Time) Minute() Int

Minute use MINUTE(date) return the minute.

func (Time) Month

func (field Time) Month() Int

Month use MONTH(date) return the month.

func (Time) MonthName

func (field Time) MonthName() String

MonthName use MONTHNAME(date) return the name of the month of the year.

func (Time) MulCol added in v0.1.8

func (e Time) MulCol(col Expr) Time

MulCol use (expr1) * (expr2)

func (Time) Neq

func (field Time) Neq(value time.Time) Expr

Neq not equal to, use expr <> ?

func (Time) NotBetween

func (field Time) NotBetween(left time.Time, right time.Time) Expr

NotBetween use NOT (expr BETWEEN ? AND ?)

func (Time) NotIn

func (field Time) NotIn(values ...time.Time) Expr

NotIn use expr NOT IN (?)

func (Time) NotInAny added in v0.1.6

func (field Time) NotInAny(value any) Expr

NotInAny use expr NOT IN (?) value must be a array/slice

func (Time) Second

func (field Time) Second() Int

Second use SECOND(date) return the second.

func (Time) Sub

func (field Time) Sub(value time.Duration) Time

Sub use DATE_SUB(date, INTERVAL ? MICROSECOND)

func (Time) SubCol added in v0.1.8

func (e Time) SubCol(col Expr) Time

SubCol use expr1 - expr2

func (Time) Sum

func (field Time) Sum() Time

Sum use SUM(expr)

func (Time) UnixTimestamp

func (field Time) UnixTimestamp() Int64

UnixTimestamp use UnixTimestamp(date)

func (Time) Value added in v0.3.2

func (field Time) Value(value time.Time) SetExpr

Value set value

func (Time) ValuePointer added in v0.4.1

func (field Time) ValuePointer(value *time.Time) SetExpr

ValuePointer set value use pointer

func (Time) ValueZero added in v0.3.2

func (field Time) ValueZero() SetExpr

ValueZero set value zero

func (Time) Year

func (field Time) Year() Int

Year use YEAR(date) return the year.

type Uint

type Uint = Integer[uint]

func NewUint

func NewUint(table, column string, opts ...Option) Uint

NewField new uint field

type Uint16

type Uint16 = Integer[uint16]

func NewUint16

func NewUint16(table, column string, opts ...Option) Uint16

NewField new uint16 field

type Uint32

type Uint32 = Integer[uint32]

func NewUint32

func NewUint32(table, column string, opts ...Option) Uint32

NewField new uint32 field

type Uint64

type Uint64 = Integer[uint64]

func NewUint64

func NewUint64(table, column string, opts ...Option) Uint64

NewField new uint64 field

type Uint8

type Uint8 = Integer[uint8]

func NewUint8

func NewUint8(table, column string, opts ...Option) Uint8

NewField new uint8 field

type Value

type Value clause.Expr

func Values

func Values(value any) Value

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL