field

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package field implement all type field and method

Index

Constants

View Source
const (
	TagKeyGorm = "gorm"
	TagKeyJson = "json"

	//gorm tag
	TagKeyGormColumn        = "column"
	TagKeyGormType          = "type"
	TagKeyGormPrimaryKey    = "primaryKey"
	TagKeyGormAutoIncrement = "autoIncrement"
	TagKeyGormNotNull       = "not null"
	TagKeyGormUniqueIndex   = "uniqueIndex"
	TagKeyGormIndex         = "index"
	TagKeyGormDefault       = "default"
	TagKeyGormComment       = "comment"
)

Variables

View Source
var (
	// Star a symbol of "*"
	Star = NewAsterisk("")
	// ALL same with Star
	ALL = Star
)
View Source
var Func = new(function)

Func sql functions

View Source
var (
	// RelationFieldUnscoped relation fild unscoped
	RelationFieldUnscoped relationScope = func(tx *gorm.DB) *gorm.DB {
		return tx.Unscoped()
	}
)

Functions

func Attrs

func Attrs(attr interface{}) *attrs

Types

type AssignExpr

type AssignExpr interface {
	Expr

	AssignExpr() expression
}

AssignExpr assign expression

func AssignSubQuery

func AssignSubQuery(columns []Expr, subQuery *gorm.DB) AssignExpr

AssignSubQuery assign with subquery

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 create new * field

func (Asterisk) BuildWithArgs

func (e Asterisk) BuildWithArgs(*gorm.Statement) (query sql, args []interface{})

func (Asterisk) Count

func (a Asterisk) Count() Asterisk

Count count

func (Asterisk) Distinct

func (a Asterisk) Distinct() Asterisk

Distinct distinct

type Bool

type Bool Field

Bool boolean type field

func NewBool

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

NewBool ...

func (Bool) And

func (field Bool) And(value bool) Expr

And boolean and

func (Bool) BitAnd

func (field Bool) BitAnd(value bool) Expr

BitAnd ...

func (Bool) BitOr

func (field Bool) BitOr(value bool) Expr

BitOr ...

func (Bool) BitXor

func (field Bool) BitXor(value bool) Expr

BitXor ...

func (Bool) Is

func (field Bool) Is(value bool) Expr

Is ...

func (Bool) Not

func (field Bool) Not() Bool

Not ...

func (Bool) Or

func (field Bool) Or(value bool) Expr

Or boolean or

func (Bool) Value

func (field Bool) Value(value bool) AssignExpr

Value ...

func (Bool) Xor

func (field Bool) Xor(value bool) Expr

Xor ...

func (Bool) Zero

func (field Bool) Zero() AssignExpr

Zero ...

type BuildOpt

type BuildOpt uint

BuildOpt build option

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

	// WithAll build column with table and alias
	WithAll

	// WithoutQuote build column without quote
	WithoutQuote
)

type Bytes

type Bytes String

Bytes []byte type field

func NewBytes

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

NewBytes ...

func (Bytes) Between

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

Between ...

func (Bytes) Eq

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

Eq equal to

func (Bytes) Field

func (field Bytes) Field(values ...[]byte) Bytes

Field ...

func (Bytes) FindInSet

func (field Bytes) FindInSet(targetList string) Expr

FindInSet FIND_IN_SET(field_name, input_string_list)

func (Bytes) FindInSetWith

func (field Bytes) FindInSetWith(target string) Expr

FindInSetWith FIND_IN_SET(input_string, field_name)

func (Bytes) Gt

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

Gt greater than

func (Bytes) Gte

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

Gte greater or equal to

func (Bytes) IfNull

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

IfNull ...

func (Bytes) In

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

In ...

func (Bytes) Like

func (field Bytes) Like(value string) Expr

Like ...

func (Bytes) Lower

func (field Bytes) Lower() String

Lower converts a string to lower-case.

func (Bytes) Lt

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

Lt less than

func (Bytes) Lte

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

Lte less or equal to

func (Bytes) Neq

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

Neq not equal to

func (Bytes) NotBetween

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

NotBetween ...

func (Bytes) NotIn

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

NotIn ...

func (Bytes) NotLike

func (field Bytes) NotLike(value string) Expr

NotLike ...

func (Bytes) NotRegxp

func (field Bytes) NotRegxp(value string) Expr

NotRegxp ...

func (Bytes) Regexp

func (field Bytes) Regexp(value string) Expr

Regexp ...

func (Bytes) SubstringIndex

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

SubstringIndex SUBSTRING_INDEX https://dev.mysql.com/doc/refman/8.0/en/functions.html#function_substring-index

func (Bytes) Upper

func (field Bytes) Upper() String

Upper converts a string to upper-case.

func (Bytes) Value

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

Value ...

func (Bytes) Zero

func (field Bytes) Zero() AssignExpr

Zero ...

type CompareOperator

type CompareOperator string

CompareOperator compare operator

const (
	// EqOp =
	EqOp CompareOperator = " = "
	// NeqOp <>
	NeqOp CompareOperator = " <> "
	// GtOp >
	GtOp CompareOperator = " > "
	// GteOp >=
	GteOp CompareOperator = " >= "
	// LtOp <
	LtOp CompareOperator = " < "
	// LteOp <=
	LteOp CompareOperator = " <= "
	// ExistsOp EXISTS
	ExistsOp CompareOperator = "EXISTS "
)

type Expr

type Expr interface {
	// Clause Expression interface
	Build(clause.Builder)

	As(alias string) Expr
	IColumnName
	BuildColumn(*gorm.Statement, ...BuildOpt) sql
	BuildWithArgs(*gorm.Statement) (query sql, args []interface{})
	RawExpr() expression

	// col operate expression
	AddCol(col Expr) Expr
	SubCol(col Expr) Expr
	MulCol(col Expr) Expr
	DivCol(col Expr) Expr
	ConcatCol(cols ...Expr) Expr

	// implement Condition
	BeCond() interface{}
	CondError() error
	// contains filtered or unexported methods
}

Expr a query expression about field

var AssociationFields Expr = NewString("", clause.Associations).appendBuildOpts(WithoutQuote)

AssociationFields all association

func And

func And(exprs ...Expr) Expr

And return and condition

func CompareSubQuery

func CompareSubQuery(op CompareOperator, column Expr, subQuery *gorm.DB) Expr

CompareSubQuery compare with sub query

func ContainsSubQuery

func ContainsSubQuery(columns []Expr, subQuery *gorm.DB) Expr

ContainsSubQuery return contains subquery when len(columns) == 1, equal to columns[0] IN (subquery) when len(columns) > 1, equal to (columns[0], columns[1], ...) IN (subquery)

func ContainsValue

func ContainsValue(columns []Expr, value Value) Expr

ContainsValue return expression which compare with value

func EmptyExpr

func EmptyExpr() Expr

EmptyExpr return a empty expression

func Not

func Not(exprs ...Expr) Expr

Not return not condition

func Or

func Or(exprs ...Expr) Expr

Or return or condition

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 create new field

func (Field) Abs

func (e Field) Abs() Float64

func (Field) AddCol

func (e Field) AddCol(col Expr) Expr

======================== operate columns ========================

func (Field) As

func (e Field) As(alias string) Expr

======================== keyword ========================

func (Field) Asc

func (e Field) Asc() Expr

Asc sort by asc

func (Field) AssignExpr

func (e Field) AssignExpr() expression

func (Field) Avg

func (e Field) Avg() Float64

func (Field) BeCond

func (e Field) BeCond() interface{}

func (Field) Build

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

func (Field) BuildColumn

func (e Field) BuildColumn(stmt *gorm.Statement, opts ...BuildOpt) sql

func (Field) BuildWithArgs

func (e Field) BuildWithArgs(stmt *gorm.Statement) (sql, []interface{})

func (Field) ColumnName

func (e Field) ColumnName() sql

func (Field) ConcatCol

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

func (Field) CondError

func (Field) CondError() error

func (Field) Count

func (e Field) Count() Int

func (Field) Desc

func (e Field) Desc() Expr

Desc sort by desc

func (Field) Distinct

func (e Field) Distinct() Int

func (Field) DivCol

func (e Field) DivCol(col Expr) Expr

func (Field) Eq

func (field Field) Eq(value driver.Valuer) Expr

Eq judge equal

func (Field) EqCol

func (e Field) EqCol(col Expr) Expr

======================== comparison between columns ========================

func (Field) Field

func (field Field) Field(value []interface{}) Expr

Field ...

func (Field) GroupConcat

func (e Field) GroupConcat() Expr

func (Field) Gt

func (field Field) Gt(value driver.Valuer) Expr

Gt ...

func (Field) GtCol

func (e Field) GtCol(col Expr) Expr

func (Field) Gte

func (field Field) Gte(value driver.Valuer) Expr

Gte ...

func (Field) GteCol

func (e Field) GteCol(col Expr) Expr

func (Field) IfNull

func (field Field) IfNull(value driver.Valuer) Expr

IfNull ...

func (Field) In

func (field Field) In(values ...driver.Valuer) Expr

In ...

func (Field) IsNotNull

func (e Field) IsNotNull() Expr

func (Field) IsNull

func (e Field) IsNull() Expr

func (Field) Length

func (e Field) Length() Int

func (Field) Like

func (field Field) Like(value driver.Valuer) Expr

Like ...

func (Field) Lt

func (field Field) Lt(value driver.Valuer) Expr

Lt ...

func (Field) LtCol

func (e Field) LtCol(col Expr) Expr

func (Field) Lte

func (field Field) Lte(value driver.Valuer) Expr

Lte ...

func (Field) LteCol

func (e Field) LteCol(col Expr) Expr

func (Field) Max

func (e Field) Max() Float64

func (Field) Min

func (e Field) Min() Float64

func (Field) MulCol

func (e Field) MulCol(col Expr) Expr

func (Field) Neq

func (field Field) Neq(value driver.Valuer) Expr

Neq judge not equal

func (Field) NeqCol

func (e Field) NeqCol(col Expr) Expr

func (Field) NotIn

func (field Field) NotIn(values ...driver.Valuer) Expr

NotIn ...

func (Field) Null

func (e Field) Null() AssignExpr

func (Field) RawExpr

func (e Field) RawExpr() expression

func (Field) SetCol

func (e Field) SetCol(col Expr) AssignExpr

func (Field) SubCol

func (e Field) SubCol(col Expr) Expr

func (Field) Sum

func (field Field) Sum() Field

Sum ...

func (Field) Value

func (field Field) Value(value driver.Valuer) AssignExpr

Value ...

func (Field) WithTable

func (e Field) WithTable(table string) Expr

======================== basic function ========================

type Float32

type Float32 Float64

Float32 float32 type field

func NewFloat32

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

NewFloat32 ...

func (Float32) Add

func (field Float32) Add(value float32) Float32

Add ...

func (Float32) Between

func (field Float32) Between(left float32, right float32) Expr

Between ...

func (Float32) Div

func (field Float32) Div(value float32) Float32

Div ...

func (Float32) Eq

func (field Float32) Eq(value float32) Expr

Eq equal to

func (Float32) Field

func (field Float32) Field(values ...float32) Float32

Field ...

func (Float32) Floor

func (field Float32) Floor() Int

Floor ...

func (Float32) FloorDiv

func (field Float32) FloorDiv(value float32) Int

FloorDiv ...

func (Float32) Gt

func (field Float32) Gt(value float32) Expr

Gt greater than

func (Float32) Gte

func (field Float32) Gte(value float32) Expr

Gte greater or equal to

func (Float32) IfNull

func (field Float32) IfNull(value float32) Expr

IfNull ...

func (Float32) In

func (field Float32) In(values ...float32) Expr

In ...

func (Float32) Like

func (field Float32) Like(value float32) Expr

Like ...

func (Float32) Lt

func (field Float32) Lt(value float32) Expr

Lt less than

func (Float32) Lte

func (field Float32) Lte(value float32) Expr

Lte less or equal to

func (Float32) Mul

func (field Float32) Mul(value float32) Float32

Mul ...

func (Float32) Neq

func (field Float32) Neq(value float32) Expr

Neq not equal to

func (Float32) NotBetween

func (field Float32) NotBetween(left float32, right float32) Expr

NotBetween ...

func (Float32) NotIn

func (field Float32) NotIn(values ...float32) Expr

NotIn ...

func (Float32) NotLike

func (field Float32) NotLike(value float32) Expr

NotLike ...

func (Float32) Sub

func (field Float32) Sub(value float32) Float32

Sub ...

func (Float32) Sum

func (field Float32) Sum() Float32

Sum ...

func (Float32) Value

func (field Float32) Value(value float32) AssignExpr

Value set value

func (Float32) Zero

func (field Float32) Zero() AssignExpr

Zero set zero value

type Float64

type Float64 Field

Float64 float64 type field

func NewFloat64

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

NewFloat64 ...

func (Float64) Add

func (field Float64) Add(value float64) Float64

Add ...

func (Float64) Between

func (field Float64) Between(left float64, right float64) Expr

Between ...

func (Float64) Div

func (field Float64) Div(value float64) Float64

Div ...

func (Float64) Eq

func (field Float64) Eq(value float64) Expr

Eq equal to

func (Float64) Field

func (field Float64) Field(values ...float64) Float64

Field ...

func (Float64) Floor

func (field Float64) Floor() Int

Floor ...

func (Float64) FloorDiv

func (field Float64) FloorDiv(value float64) Int

FloorDiv ...

func (Float64) Gt

func (field Float64) Gt(value float64) Expr

Gt greater than

func (Float64) Gte

func (field Float64) Gte(value float64) Expr

Gte greater or equal to

func (Float64) IfNull

func (field Float64) IfNull(value float64) Expr

IfNull ...

func (Float64) In

func (field Float64) In(values ...float64) Expr

In ...

func (Float64) Like

func (field Float64) Like(value float64) Expr

Like ...

func (Float64) Lt

func (field Float64) Lt(value float64) Expr

Lt less than

func (Float64) Lte

func (field Float64) Lte(value float64) Expr

Lte less or equal to

func (Float64) Mul

func (field Float64) Mul(value float64) Float64

Mul ...

func (Float64) Neq

func (field Float64) Neq(value float64) Expr

Neq not equal to

func (Float64) NotBetween

func (field Float64) NotBetween(left float64, right float64) Expr

NotBetween ...

func (Float64) NotIn

func (field Float64) NotIn(values ...float64) Expr

NotIn ...

func (Float64) NotLike

func (field Float64) NotLike(value float64) Expr

NotLike ...

func (Float64) Sub

func (field Float64) Sub(value float64) Float64

Sub ...

func (Float64) Sum

func (field Float64) Sum() Float64

Sum ...

func (Float64) Value

func (field Float64) Value(value float64) AssignExpr

Value set value

func (Float64) Zero

func (field Float64) Zero() AssignExpr

Zero set zero value

type GormTag

type GormTag map[string][]string

func (GormTag) Append

func (tag GormTag) Append(key string, values ...string) GormTag

func (GormTag) Build

func (tag GormTag) Build() string

func (GormTag) Remove

func (tag GormTag) Remove(key string) GormTag

func (GormTag) Set

func (tag GormTag) Set(key string, values ...string) GormTag

type IColumnName

type IColumnName interface {
	ColumnName() sql
}

type IValues

type IValues interface {
	Values() interface{}
}

type Int

type Int Field

Int int type field

func NewInt

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

NewInt create new Int

func (Int) Add

func (field Int) Add(value int) Int

Add ...

func (Int) Between

func (field Int) Between(left int, right int) Expr

Between ...

func (Int) BitAnd

func (field Int) BitAnd(value int) Int

BitAnd ...

func (Int) BitFlip

func (field Int) BitFlip() Int

BitFlip ...

func (Int) BitOr

func (field Int) BitOr(value int) Int

BitOr ...

func (Int) BitXor

func (field Int) BitXor(value int) Int

BitXor ...

func (Int) Div

func (field Int) Div(value int) Int

Div ...

func (Int) Eq

func (field Int) Eq(value int) Expr

Eq equal to

func (Int) Field

func (field Int) Field(values ...int) Int

Field ...

func (Int) FloorDiv

func (field Int) FloorDiv(value int) Int

FloorDiv ...

func (Int) Gt

func (field Int) Gt(value int) Expr

Gt greater than

func (Int) Gte

func (field Int) Gte(value int) Expr

Gte greater or equal to

func (Int) IfNull

func (field Int) IfNull(value int) Expr

IfNull ...

func (Int) In

func (field Int) In(values ...int) Expr

In ...

func (Int) LeftShift

func (field Int) LeftShift(value int) Int

LeftShift ...

func (Int) Like

func (field Int) Like(value int) Expr

Like ...

func (Int) Lt

func (field Int) Lt(value int) Expr

Lt less than

func (Int) Lte

func (field Int) Lte(value int) Expr

Lte less or equal to

func (Int) Mod

func (field Int) Mod(value int) Int

Mod ...

func (Int) Mul

func (field Int) Mul(value int) Int

Mul ...

func (Int) Neq

func (field Int) Neq(value int) Expr

Neq not equal to

func (Int) NotBetween

func (field Int) NotBetween(left int, right int) Expr

NotBetween ...

func (Int) NotIn

func (field Int) NotIn(values ...int) Expr

NotIn ...

func (Int) NotLike

func (field Int) NotLike(value int) Expr

NotLike ...

func (Int) RightShift

func (field Int) RightShift(value int) Int

RightShift ...

func (Int) Sub

func (field Int) Sub(value int) Int

Sub ...

func (Int) Sum

func (field Int) Sum() Int

Sum ...

func (Int) Value

func (field Int) Value(value int) AssignExpr

Value set value

func (Int) Zero

func (field Int) Zero() AssignExpr

Zero set zero value

type Int16

type Int16 Int

Int16 int16 type field

func NewInt16

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

NewInt16 ...

func (Int16) Add

func (field Int16) Add(value int16) Int16

Add ...

func (Int16) Between

func (field Int16) Between(left int16, right int16) Expr

Between ...

func (Int16) BitAnd

func (field Int16) BitAnd(value int16) Int16

BitAnd ...

func (Int16) BitFlip

func (field Int16) BitFlip() Int16

BitFlip ...

func (Int16) BitOr

func (field Int16) BitOr(value int16) Int16

BitOr ...

func (Int16) BitXor

func (field Int16) BitXor(value int16) Int16

BitXor ...

func (Int16) Div

func (field Int16) Div(value int16) Int16

Div ...

func (Int16) Eq

func (field Int16) Eq(value int16) Expr

Eq equal to

func (Int16) Field

func (field Int16) Field(values ...int16) Int16

Field ...

func (Int16) FloorDiv

func (field Int16) FloorDiv(value int16) Int16

FloorDiv ...

func (Int16) Gt

func (field Int16) Gt(value int16) Expr

Gt greater than

func (Int16) Gte

func (field Int16) Gte(value int16) Expr

Gte greater or equal to

func (Int16) IfNull

func (field Int16) IfNull(value int16) Expr

IfNull ...

func (Int16) In

func (field Int16) In(values ...int16) Expr

In ...

func (Int16) LeftShift

func (field Int16) LeftShift(value int16) Int16

LeftShift ...

func (Int16) Like

func (field Int16) Like(value int16) Expr

Like ...

func (Int16) Lt

func (field Int16) Lt(value int16) Expr

Lt less than

func (Int16) Lte

func (field Int16) Lte(value int16) Expr

Lte less or equal to

func (Int16) Mod

func (field Int16) Mod(value int16) Int16

Mod ...

func (Int16) Mul

func (field Int16) Mul(value int16) Int16

Mul ...

func (Int16) Neq

func (field Int16) Neq(value int16) Expr

Neq not equal to

func (Int16) NotBetween

func (field Int16) NotBetween(left int16, right int16) Expr

NotBetween ...

func (Int16) NotIn

func (field Int16) NotIn(values ...int16) Expr

NotIn ...

func (Int16) NotLike

func (field Int16) NotLike(value int16) Expr

NotLike ...

func (Int16) RightShift

func (field Int16) RightShift(value int16) Int16

RightShift ...

func (Int16) Sub

func (field Int16) Sub(value int16) Int16

Sub ...

func (Int16) Sum

func (field Int16) Sum() Int16

Sum ...

func (Int16) Value

func (field Int16) Value(value int16) AssignExpr

Value set value

func (Int16) Zero

func (field Int16) Zero() AssignExpr

Zero set zero value

type Int32

type Int32 Int

Int32 int32 type field

func NewInt32

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

NewInt32 ...

func (Int32) Add

func (field Int32) Add(value int32) Int32

Add ...

func (Int32) Between

func (field Int32) Between(left int32, right int32) Expr

Between ...

func (Int32) BitAnd

func (field Int32) BitAnd(value int32) Int32

BitAnd ...

func (Int32) BitFlip

func (field Int32) BitFlip() Int32

BitFlip ...

func (Int32) BitOr

func (field Int32) BitOr(value int32) Int32

BitOr ...

func (Int32) BitXor

func (field Int32) BitXor(value int32) Int32

BitXor ...

func (Int32) Div

func (field Int32) Div(value int32) Int32

Div ...

func (Int32) Eq

func (field Int32) Eq(value int32) Expr

Eq equal to

func (Int32) Field

func (field Int32) Field(values ...int32) Int32

Field ...

func (Int32) FloorDiv

func (field Int32) FloorDiv(value int32) Int32

FloorDiv ...

func (Int32) Gt

func (field Int32) Gt(value int32) Expr

Gt greater than

func (Int32) Gte

func (field Int32) Gte(value int32) Expr

Gte greater or equal to

func (Int32) IfNull

func (field Int32) IfNull(value int32) Expr

IfNull ...

func (Int32) In

func (field Int32) In(values ...int32) Expr

In ...

func (Int32) LeftShift

func (field Int32) LeftShift(value int32) Int32

LeftShift ...

func (Int32) Like

func (field Int32) Like(value int32) Expr

Like ...

func (Int32) Lt

func (field Int32) Lt(value int32) Expr

Lt less than

func (Int32) Lte

func (field Int32) Lte(value int32) Expr

Lte less or equal to

func (Int32) Mod

func (field Int32) Mod(value int32) Int32

Mod ...

func (Int32) Mul

func (field Int32) Mul(value int32) Int32

Mul ...

func (Int32) Neq

func (field Int32) Neq(value int32) Expr

Neq not equal to

func (Int32) NotBetween

func (field Int32) NotBetween(left int32, right int32) Expr

NotBetween ...

func (Int32) NotIn

func (field Int32) NotIn(values ...int32) Expr

NotIn ...

func (Int32) NotLike

func (field Int32) NotLike(value int32) Expr

NotLike ...

func (Int32) RightShift

func (field Int32) RightShift(value int32) Int32

RightShift ...

func (Int32) Sub

func (field Int32) Sub(value int32) Int32

Sub ...

func (Int32) Sum

func (field Int32) Sum() Int32

Sum ...

func (Int32) Value

func (field Int32) Value(value int32) AssignExpr

Value set value

func (Int32) Zero

func (field Int32) Zero() AssignExpr

Zero set zero value

type Int64

type Int64 Int

Int64 int64 type field

func NewInt64

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

NewInt64 ...

func (Int64) Add

func (field Int64) Add(value int64) Int64

Add ...

func (Int64) Between

func (field Int64) Between(left int64, right int64) Expr

Between ...

func (Int64) BitAnd

func (field Int64) BitAnd(value int64) Int64

BitAnd ...

func (Int64) BitFlip

func (field Int64) BitFlip() Int64

BitFlip ...

func (Int64) BitOr

func (field Int64) BitOr(value int64) Int64

BitOr ...

func (Int64) BitXor

func (field Int64) BitXor(value int64) Int64

BitXor ...

func (Int64) Div

func (field Int64) Div(value int64) Int64

Div ...

func (Int64) Eq

func (field Int64) Eq(value int64) Expr

Eq equal to

func (Int64) Field

func (field Int64) Field(values ...int64) Int64

Field ...

func (Int64) FloorDiv

func (field Int64) FloorDiv(value int64) Int64

FloorDiv ...

func (Int64) Gt

func (field Int64) Gt(value int64) Expr

Gt greater than

func (Int64) Gte

func (field Int64) Gte(value int64) Expr

Gte greater or equal to

func (Int64) IfNull

func (field Int64) IfNull(value int64) Expr

IfNull ...

func (Int64) In

func (field Int64) In(values ...int64) Expr

In ...

func (Int64) LeftShift

func (field Int64) LeftShift(value int64) Int64

LeftShift ...

func (Int64) Like

func (field Int64) Like(value int64) Expr

Like ...

func (Int64) Lt

func (field Int64) Lt(value int64) Expr

Lt less than

func (Int64) Lte

func (field Int64) Lte(value int64) Expr

Lte less or equal to

func (Int64) Mod

func (field Int64) Mod(value int64) Int64

Mod ...

func (Int64) Mul

func (field Int64) Mul(value int64) Int64

Mul ...

func (Int64) Neq

func (field Int64) Neq(value int64) Expr

Neq not equal to

func (Int64) NotBetween

func (field Int64) NotBetween(left int64, right int64) Expr

NotBetween ...

func (Int64) NotIn

func (field Int64) NotIn(values ...int64) Expr

NotIn ...

func (Int64) NotLike

func (field Int64) NotLike(value int64) Expr

NotLike ...

func (Int64) RightShift

func (field Int64) RightShift(value int64) Int64

RightShift ...

func (Int64) Sub

func (field Int64) Sub(value int64) Int64

Sub ...

func (Int64) Sum

func (field Int64) Sum() Int64

Sum ...

func (Int64) Value

func (field Int64) Value(value int64) AssignExpr

Value set value

func (Int64) Zero

func (field Int64) Zero() AssignExpr

Zero set zero value

type Int8

type Int8 Int

Int8 int8 type field

func NewInt8

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

NewInt8 create new Int8

func (Int8) Add

func (field Int8) Add(value int8) Int8

Add ...

func (Int8) Between

func (field Int8) Between(left int8, right int8) Expr

Between ...

func (Int8) BitAnd

func (field Int8) BitAnd(value int8) Int8

BitAnd ...

func (Int8) BitFlip

func (field Int8) BitFlip() Int8

BitFlip ...

func (Int8) BitOr

func (field Int8) BitOr(value int8) Int8

BitOr ...

func (Int8) BitXor

func (field Int8) BitXor(value int8) Int8

BitXor ...

func (Int8) Div

func (field Int8) Div(value int8) Int8

Div ...

func (Int8) Eq

func (field Int8) Eq(value int8) Expr

Eq equal to

func (Int8) Field

func (field Int8) Field(values ...int8) Int8

Field ...

func (Int8) FloorDiv

func (field Int8) FloorDiv(value int8) Int8

FloorDiv ...

func (Int8) Gt

func (field Int8) Gt(value int8) Expr

Gt greater than

func (Int8) Gte

func (field Int8) Gte(value int8) Expr

Gte greater or equal to

func (Int8) IfNull

func (field Int8) IfNull(value int8) Expr

IfNull ...

func (Int8) In

func (field Int8) In(values ...int8) Expr

In ...

func (Int8) LeftShift

func (field Int8) LeftShift(value int8) Int8

LeftShift ...

func (Int8) Like

func (field Int8) Like(value int8) Expr

Like ...

func (Int8) Lt

func (field Int8) Lt(value int8) Expr

Lt less than

func (Int8) Lte

func (field Int8) Lte(value int8) Expr

Lte less or equal to

func (Int8) Mod

func (field Int8) Mod(value int8) Int8

Mod ...

func (Int8) Mul

func (field Int8) Mul(value int8) Int8

Mul ...

func (Int8) Neq

func (field Int8) Neq(value int8) Expr

Neq not equal to

func (Int8) NotBetween

func (field Int8) NotBetween(left int8, right int8) Expr

NotBetween ...

func (Int8) NotIn

func (field Int8) NotIn(values ...int8) Expr

NotIn ...

func (Int8) NotLike

func (field Int8) NotLike(value int8) Expr

NotLike ...

func (Int8) RightShift

func (field Int8) RightShift(value int8) Int8

RightShift ...

func (Int8) Sub

func (field Int8) Sub(value int8) Int8

Sub ...

func (Int8) Sum

func (field Int8) Sum() Int8

Sum ...

func (Int8) Value

func (field Int8) Value(value int8) AssignExpr

Value set value

func (Int8) Zero

func (field Int8) Zero() AssignExpr

Zero set zero value

type Option

type Option func(clause.Column) clause.Column

Option field option

type OrderExpr

type OrderExpr interface {
	Expr
	Desc() Expr
	Asc() Expr
}

OrderExpr order expression used in Order()

type RelateConfig

type RelateConfig struct {
	RelatePointer      bool
	RelateSlice        bool
	RelateSlicePointer bool

	JSONTag      string
	GORMTag      GormTag
	Tag          Tag
	OverwriteTag Tag
}

RelateConfig config for relationship

func (*RelateConfig) GetTag

func (c *RelateConfig) GetTag(fieldName string) Tag

func (*RelateConfig) RelateFieldPrefix

func (c *RelateConfig) RelateFieldPrefix(relationshipType RelationshipType) string

RelateFieldPrefix return generated relation field's type

type Relation

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

Relation relation meta info

func NewRelation

func NewRelation(fieldName string, fieldType string, relations ...Relation) *Relation

NewRelation return a new Relation for association

func NewRelationWithModel

func NewRelationWithModel(relationship RelationshipType, fieldName string, fieldType string, fieldModel interface{}, relations ...Relation) *Relation

NewRelationWithModel return a Relation with specified model struct

func NewRelationWithType

func NewRelationWithType(relationship RelationshipType, fieldName string, fieldType string, relations ...Relation) *Relation

NewRelationWithType return a Relation with specified field type

func (*Relation) AppendChildRelation

func (r *Relation) AppendChildRelation(relations ...Relation)

AppendChildRelation append child relationship

func (Relation) ChildRelations

func (r Relation) ChildRelations() []Relation

ChildRelations return child relations

func (Relation) Clauses

func (r Relation) Clauses(hints ...clause.Expression) RelationField

Clauses set relation clauses

func (Relation) Field

func (r Relation) Field(fields ...string) Expr

Field build field

func (*Relation) GetClauses

func (r *Relation) GetClauses() []clause.Expression

GetClauses get clauses

func (*Relation) GetConds

func (r *Relation) GetConds() []Expr

GetConds get query conditions

func (*Relation) GetOrderCol

func (r *Relation) GetOrderCol() []Expr

GetOrderCol get order columns

func (*Relation) GetPage

func (r *Relation) GetPage() (offset, limit int)

GetPage get offset and limit

func (*Relation) GetScopes

func (r *Relation) GetScopes() []relationScope

GetScopes get scope functions

func (*Relation) GetSelects

func (r *Relation) GetSelects() []Expr

GetSelects get select columns

func (Relation) Limit

func (r Relation) Limit(limit int) RelationField

Limit set relation limit

func (Relation) Model

func (r Relation) Model() interface{}

Model relation field's model

func (Relation) Name

func (r Relation) Name() string

Name relation field' name

func (Relation) Offset

func (r Relation) Offset(offset int) RelationField

Offset set relation offset

func (Relation) On

func (r Relation) On(conds ...Expr) RelationField

On relation condition

func (Relation) Order

func (r Relation) Order(columns ...Expr) RelationField

Order relation order columns

func (Relation) Path

func (r Relation) Path() string

Path relation field's path

func (Relation) Relationship

func (r Relation) Relationship() RelationshipType

Relationship relationship between field and table struct

func (Relation) RelationshipName

func (r Relation) RelationshipName() string

RelationshipName relationship's name

func (Relation) Scopes

func (r Relation) Scopes(funcs ...relationScope) RelationField

Scopes set scopes func

func (Relation) Select

func (r Relation) Select(columns ...Expr) RelationField

Select relation select columns

func (*Relation) StructField

func (r *Relation) StructField() (fieldStr string)

StructField return struct field code

func (*Relation) StructFieldInit

func (r *Relation) StructFieldInit() string

StructFieldInit return field initialize code

func (Relation) Type

func (r Relation) Type() string

Type relation field's type

type RelationField

type RelationField interface {
	Name() string
	Path() string
	// Field return expr for Select
	// Field() return "<self>" field name in struct
	// Field("RelateField") return "<self>.RelateField" for Select
	// Field("RelateField", "RelateRelateField") return "<self>.RelateField.RelateRelateField" for Select
	// ex:
	// 	Select(u.CreditCards.Field()) equals to GORM: Select("CreditCards")
	// 	Select(u.CreditCards.Field("Bank")) equals to GORM: Select("CreditCards.Bank")
	// 	Select(u.CreditCards.Field("Bank","Owner")) equals to GORM: Select("CreditCards.Bank.Owner")
	Field(fields ...string) Expr

	On(conds ...Expr) RelationField
	Select(conds ...Expr) RelationField
	Order(columns ...Expr) RelationField
	Clauses(hints ...clause.Expression) RelationField
	Scopes(funcs ...relationScope) RelationField
	Offset(offset int) RelationField
	Limit(limit int) RelationField

	GetConds() []Expr
	GetSelects() []Expr
	GetOrderCol() []Expr
	GetClauses() []clause.Expression
	GetScopes() []relationScope
	GetPage() (offset, limit int)
}

RelationField interface for relation field

var Associations RelationField = NewRelation(clause.Associations, "")

Associations ...

type RelationshipType

type RelationshipType schema.RelationshipType

RelationshipType table relationship

const (
	// HasOne a has one association sets up a one-to-one connection with another model. Reference https://github.com/wubin1989/docs/has_one.html
	HasOne RelationshipType = RelationshipType(schema.HasOne) // HasOneRel has one relationship
	// HasMany a has many association sets up a one-to-many connection with another model. Reference https://github.com/wubin1989/docs/has_many.html
	HasMany RelationshipType = RelationshipType(schema.HasMany) // HasManyRel has many relationships
	// BelongsTo A belongs to association sets up a one-to-one connection with another model. Reference https://github.com/wubin1989/docs/belongs_to.html
	BelongsTo RelationshipType = RelationshipType(schema.BelongsTo) // BelongsToRel belongs to relationship
	// Many2Many Many to Many add a join table between two models. Reference https://github.com/wubin1989/docs/many2many.html
	Many2Many RelationshipType = RelationshipType(schema.Many2Many) // Many2ManyRel many to many relationship
)

type ScanValuer

type ScanValuer interface {
	Scan(src interface{}) error   // sql.Scanner
	Value() (driver.Value, error) // driver.Valuer
}

ScanValuer interface for Field

type Serializer

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

Field2 a standard field struct

func NewSerializer

func NewSerializer(table, column string, opts ...Option) Serializer

NewSerializer create new field2

func (Serializer) Abs

func (e Serializer) Abs() Float64

func (Serializer) AddCol

func (e Serializer) AddCol(col Expr) Expr

======================== operate columns ========================

func (Serializer) As

func (e Serializer) As(alias string) Expr

======================== keyword ========================

func (Serializer) Asc

func (e Serializer) Asc() Expr

Asc sort by asc

func (Serializer) AssignExpr

func (e Serializer) AssignExpr() expression

func (Serializer) Avg

func (e Serializer) Avg() Float64

func (Serializer) BeCond

func (e Serializer) BeCond() interface{}

func (Serializer) Build

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

func (Serializer) BuildColumn

func (e Serializer) BuildColumn(stmt *gorm.Statement, opts ...BuildOpt) sql

func (Serializer) BuildWithArgs

func (e Serializer) BuildWithArgs(stmt *gorm.Statement) (sql, []interface{})

func (Serializer) ColumnName

func (e Serializer) ColumnName() sql

func (Serializer) ConcatCol

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

func (Serializer) CondError

func (Serializer) CondError() error

func (Serializer) Count

func (e Serializer) Count() Int

func (Serializer) Desc

func (e Serializer) Desc() Expr

Desc sort by desc

func (Serializer) Distinct

func (e Serializer) Distinct() Int

func (Serializer) DivCol

func (e Serializer) DivCol(col Expr) Expr

func (Serializer) Eq

Eq judge equal

func (Serializer) EqCol

func (e Serializer) EqCol(col Expr) Expr

======================== comparison between columns ========================

func (Serializer) GroupConcat

func (e Serializer) GroupConcat() Expr

func (Serializer) Gt

Gt ...

func (Serializer) GtCol

func (e Serializer) GtCol(col Expr) Expr

func (Serializer) Gte

Gte ...

func (Serializer) GteCol

func (e Serializer) GteCol(col Expr) Expr

func (Serializer) IfNull

func (field Serializer) IfNull(value schema.SerializerValuerInterface) Expr

IfNull ...

func (Serializer) In

func (field Serializer) In(values ...schema.SerializerValuerInterface) Expr

In ...

func (Serializer) IsNotNull

func (e Serializer) IsNotNull() Expr

func (Serializer) IsNull

func (e Serializer) IsNull() Expr

func (Serializer) Length

func (e Serializer) Length() Int

func (Serializer) Like

func (field Serializer) Like(value schema.SerializerValuerInterface) Expr

Like ...

func (Serializer) Lt

Lt ...

func (Serializer) LtCol

func (e Serializer) LtCol(col Expr) Expr

func (Serializer) Lte

Lte ...

func (Serializer) LteCol

func (e Serializer) LteCol(col Expr) Expr

func (Serializer) Max

func (e Serializer) Max() Float64

func (Serializer) Min

func (e Serializer) Min() Float64

func (Serializer) MulCol

func (e Serializer) MulCol(col Expr) Expr

func (Serializer) Neq

Neq judge not equal

func (Serializer) NeqCol

func (e Serializer) NeqCol(col Expr) Expr

func (Serializer) Null

func (e Serializer) Null() AssignExpr

func (Serializer) RawExpr

func (e Serializer) RawExpr() expression

func (Serializer) SetCol

func (e Serializer) SetCol(col Expr) AssignExpr

func (Serializer) SubCol

func (e Serializer) SubCol(col Expr) Expr

func (Serializer) Sum

func (field Serializer) Sum() Field

Sum ...

func (Serializer) Value

Value ...

func (Serializer) WithTable

func (e Serializer) WithTable(table string) Expr

======================== basic function ========================

type String

type String Field

String string type field

func NewString

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

NewString ...

func (String) Between

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

Between ...

func (String) Concat

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

Concat ...

func (String) Eq

func (field String) Eq(value string) Expr

Eq equal to

func (String) Field

func (field String) Field(values ...string) String

Field ...

func (String) FindInSet

func (field String) FindInSet(targetList string) Expr

FindInSet equal to FIND_IN_SET(field_name, input_string_list)

func (String) FindInSetWith

func (field String) FindInSetWith(target string) Expr

FindInSetWith equal to FIND_IN_SET(input_string, field_name)

func (String) Gt

func (field String) Gt(value string) Expr

Gt greater than

func (String) Gte

func (field String) Gte(value string) Expr

Gte greater or equal to

func (String) IfNull

func (field String) IfNull(value string) Expr

IfNull ...

func (String) In

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

In ...

func (String) Like

func (field String) Like(value string) Expr

Like ...

func (String) Lower

func (field String) Lower() String

Lower converts a string to lower-case.

func (String) Lt

func (field String) Lt(value string) Expr

Lt less than

func (String) Lte

func (field String) Lte(value string) Expr

Lte less or equal to

func (String) Neq

func (field String) Neq(value string) Expr

Neq not equal to

func (String) NotBetween

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

NotBetween ...

func (String) NotIn

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

NotIn ...

func (String) NotLike

func (field String) NotLike(value string) Expr

NotLike ...

func (String) NotRegxp

func (field String) NotRegxp(value string) Expr

NotRegxp ...

func (String) Regexp

func (field String) Regexp(value string) Expr

Regexp ...

func (String) Replace

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

Replace ...

func (String) Substr

func (field String) Substr(params ...int) String

Substr SUBSTR is a synonym for SUBSTRING https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_substring

func (String) SubstringIndex

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

SubstringIndex SUBSTRING_INDEX https://dev.mysql.com/doc/refman/8.0/en/functions.html#function_substring-index

func (String) Upper

func (field String) Upper() String

Upper converts a string to upper-case.

func (String) Value

func (field String) Value(value string) AssignExpr

Value ...

func (String) Zero

func (field String) Zero() AssignExpr

Zero ...

type Tag

type Tag map[string]string

func (Tag) Build

func (tag Tag) Build() string

func (Tag) Remove

func (tag Tag) Remove(key string) Tag

func (Tag) Set

func (tag Tag) Set(key, value string) Tag

type TagBuilder

type TagBuilder interface {
	Build() string
}

type Time

type Time Field

Time time type field

func NewTime

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

NewTime ...

func (Time) Add

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

Add ...

func (Time) Between

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

Between ...

func (Time) CurDate

func (field Time) CurDate() Time

CurDate return result of CURDATE()

func (Time) CurTime

func (field Time) CurTime() Time

CurTime return result of CURTIME()

func (Time) Date

func (field Time) Date() Time

Date convert to data, equal to "DATE(time_expr)"

func (Time) DateDiff

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

DateDiff equal to DATADIFF(self, value)

func (Time) DateFormat

func (field Time) DateFormat(value string) String

DateFormat equal to DATE_FORMAT(self, value)

func (Time) Day

func (field Time) Day() Int

Day equal to DAY(self)

func (Time) DayName

func (field Time) DayName() String

DayName equal to DAYNAME(self)

func (Time) DayOfMonth

func (field Time) DayOfMonth() Int

DayOfMonth equal to DAYOFMONTH(self)

func (Time) DayOfWeek

func (field Time) DayOfWeek() Int

DayOfWeek equal to DAYOFWEEK(self)

func (Time) DayOfYear

func (field Time) DayOfYear() Int

DayOfYear equal to DAYOFYEAR(self)

func (Time) Eq

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

Eq equal to

func (Time) FromDays

func (field Time) FromDays(value int) Time

FromDays equal to FROM_DAYS(self)

func (Time) FromUnixtime

func (field Time) FromUnixtime(value int) Time

FromUnixtime equal to FROM_UNIXTIME(self)

func (Time) Gt

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

Gt greater than

func (Time) Gte

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

Gte greater or equal to

func (Time) Hour

func (field Time) Hour() Int

Hour equal to HOUR(self)

func (Time) IfNull

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

IfNull ...

func (Time) In

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

In ...

func (Time) Lt

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

Lt less than

func (Time) Lte

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

Lte less or equal to

func (Time) MicroSecond

func (field Time) MicroSecond() Int

MicroSecond equal to MICROSECOND(self)

func (Time) Minute

func (field Time) Minute() Int

Minute equal to MINUTE(self)

func (Time) Month

func (field Time) Month() Int

Month equal to MONTH(self)

func (Time) MonthName

func (field Time) MonthName() String

MonthName equal to MONTHNAME(self)

func (Time) Neq

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

Neq not equal to

func (Time) NotBetween

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

NotBetween ...

func (Time) NotIn

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

NotIn ...

func (Time) Now

func (field Time) Now() Time

Now return result of NOW()

func (Time) Second

func (field Time) Second() Int

Second equal to SECOND(self)

func (Time) Sub

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

Sub ...

func (Time) Sum

func (field Time) Sum() Time

Sum calc sum

func (Time) Value

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

Value set value

func (Time) Year

func (field Time) Year() Int

func (Time) Zero

func (field Time) Zero() AssignExpr

Zero set zero value

type Uint

type Uint Int

Uint uint type field

func NewUint

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

NewUint ...

func (Uint) Add

func (field Uint) Add(value uint) Uint

Add ...

func (Uint) Between

func (field Uint) Between(left uint, right uint) Expr

Between ...

func (Uint) BitAnd

func (field Uint) BitAnd(value uint) Uint

BitAnd ...

func (Uint) BitFlip

func (field Uint) BitFlip() Uint

BitFlip ...

func (Uint) BitOr

func (field Uint) BitOr(value uint) Uint

BitOr ...

func (Uint) BitXor

func (field Uint) BitXor(value uint) Uint

BitXor ...

func (Uint) Div

func (field Uint) Div(value uint) Uint

Div ...

func (Uint) Eq

func (field Uint) Eq(value uint) Expr

Eq equal to

func (Uint) Field

func (field Uint) Field(values ...uint) Uint

Field ...

func (Uint) FloorDiv

func (field Uint) FloorDiv(value uint) Uint

FloorDiv ...

func (Uint) Gt

func (field Uint) Gt(value uint) Expr

Gt greater than

func (Uint) Gte

func (field Uint) Gte(value uint) Expr

Gte greater or equal to

func (Uint) IfNull

func (field Uint) IfNull(value uint) Expr

IfNull ...

func (Uint) In

func (field Uint) In(values ...uint) Expr

In ...

func (Uint) LeftShift

func (field Uint) LeftShift(value uint) Uint

LeftShift ...

func (Uint) Like

func (field Uint) Like(value uint) Expr

Like ...

func (Uint) Lt

func (field Uint) Lt(value uint) Expr

Lt less than

func (Uint) Lte

func (field Uint) Lte(value uint) Expr

Lte less or equal to

func (Uint) Mod

func (field Uint) Mod(value uint) Uint

Mod ...

func (Uint) Mul

func (field Uint) Mul(value uint) Uint

Mul ...

func (Uint) Neq

func (field Uint) Neq(value uint) Expr

Neq not equal to

func (Uint) NotBetween

func (field Uint) NotBetween(left uint, right uint) Expr

NotBetween ...

func (Uint) NotIn

func (field Uint) NotIn(values ...uint) Expr

NotIn ...

func (Uint) NotLike

func (field Uint) NotLike(value uint) Expr

NotLike ...

func (Uint) RightShift

func (field Uint) RightShift(value uint) Uint

RightShift ...

func (Uint) Sub

func (field Uint) Sub(value uint) Uint

Sub ...

func (Uint) Sum

func (field Uint) Sum() Uint

Sum ...

func (Uint) Value

func (field Uint) Value(value uint) AssignExpr

Value set value

func (Uint) Zero

func (field Uint) Zero() AssignExpr

Zero set zero value

type Uint16

type Uint16 Int

Uint16 uint16 type field

func NewUint16

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

NewUint16 ...

func (Uint16) Add

func (field Uint16) Add(value uint16) Uint16

Add ...

func (Uint16) Between

func (field Uint16) Between(left uint16, right uint16) Expr

Between ...

func (Uint16) BitAnd

func (field Uint16) BitAnd(value uint16) Uint16

BitAnd ...

func (Uint16) BitFlip

func (field Uint16) BitFlip() Uint16

BitFlip ...

func (Uint16) BitOr

func (field Uint16) BitOr(value uint16) Uint16

BitOr ...

func (Uint16) BitXor

func (field Uint16) BitXor(value uint16) Uint16

BitXor ...

func (Uint16) Div

func (field Uint16) Div(value uint16) Uint16

Div ...

func (Uint16) Eq

func (field Uint16) Eq(value uint16) Expr

Eq equal to

func (Uint16) Field

func (field Uint16) Field(values ...uint16) Uint16

Field ...

func (Uint16) FloorDiv

func (field Uint16) FloorDiv(value uint16) Uint16

FloorDiv ...

func (Uint16) Gt

func (field Uint16) Gt(value uint16) Expr

Gt greater than

func (Uint16) Gte

func (field Uint16) Gte(value uint16) Expr

Gte greater or equal to

func (Uint16) IfNull

func (field Uint16) IfNull(value uint16) Expr

IfNull ...

func (Uint16) In

func (field Uint16) In(values ...uint16) Expr

In ...

func (Uint16) LeftShift

func (field Uint16) LeftShift(value uint16) Uint16

LeftShift ...

func (Uint16) Like

func (field Uint16) Like(value uint16) Expr

Like ...

func (Uint16) Lt

func (field Uint16) Lt(value uint16) Expr

Lt less than

func (Uint16) Lte

func (field Uint16) Lte(value uint16) Expr

Lte less or equal to

func (Uint16) Mod

func (field Uint16) Mod(value uint16) Uint16

Mod ...

func (Uint16) Mul

func (field Uint16) Mul(value uint16) Uint16

Mul ...

func (Uint16) Neq

func (field Uint16) Neq(value uint16) Expr

Neq not equal to

func (Uint16) NotBetween

func (field Uint16) NotBetween(left uint16, right uint16) Expr

NotBetween ...

func (Uint16) NotIn

func (field Uint16) NotIn(values ...uint16) Expr

NotIn ...

func (Uint16) NotLike

func (field Uint16) NotLike(value uint16) Expr

NotLike ...

func (Uint16) RightShift

func (field Uint16) RightShift(value uint16) Uint16

RightShift ...

func (Uint16) Sub

func (field Uint16) Sub(value uint16) Uint16

Sub ...

func (Uint16) Sum

func (field Uint16) Sum() Uint16

Sum ...

func (Uint16) Value

func (field Uint16) Value(value uint16) AssignExpr

Value set value

func (Uint16) Zero

func (field Uint16) Zero() AssignExpr

Zero set zero value

type Uint32

type Uint32 Int

Uint32 uint32 type field

func NewUint32

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

NewUint32 ...

func (Uint32) Add

func (field Uint32) Add(value uint32) Uint32

Add ...

func (Uint32) Between

func (field Uint32) Between(left uint32, right uint32) Expr

Between ...

func (Uint32) BitAnd

func (field Uint32) BitAnd(value uint32) Uint32

BitAnd ...

func (Uint32) BitFlip

func (field Uint32) BitFlip() Uint32

BitFlip ...

func (Uint32) BitOr

func (field Uint32) BitOr(value uint32) Uint32

BitOr ...

func (Uint32) BitXor

func (field Uint32) BitXor(value uint32) Uint32

BitXor ...

func (Uint32) Div

func (field Uint32) Div(value uint32) Uint32

Div ...

func (Uint32) Eq

func (field Uint32) Eq(value uint32) Expr

Eq equal to

func (Uint32) Field

func (field Uint32) Field(values ...uint32) Uint32

Field ...

func (Uint32) FloorDiv

func (field Uint32) FloorDiv(value uint32) Uint32

FloorDiv ...

func (Uint32) Gt

func (field Uint32) Gt(value uint32) Expr

Gt greater than

func (Uint32) Gte

func (field Uint32) Gte(value uint32) Expr

Gte greater or equal to

func (Uint32) IfNull

func (field Uint32) IfNull(value uint32) Expr

IfNull ...

func (Uint32) In

func (field Uint32) In(values ...uint32) Expr

In ...

func (Uint32) LeftShift

func (field Uint32) LeftShift(value uint32) Uint32

LeftShift ...

func (Uint32) Like

func (field Uint32) Like(value uint32) Expr

Like ...

func (Uint32) Lt

func (field Uint32) Lt(value uint32) Expr

Lt less than

func (Uint32) Lte

func (field Uint32) Lte(value uint32) Expr

Lte less or equal to

func (Uint32) Mod

func (field Uint32) Mod(value uint32) Uint32

Mod ...

func (Uint32) Mul

func (field Uint32) Mul(value uint32) Uint32

Mul ...

func (Uint32) Neq

func (field Uint32) Neq(value uint32) Expr

Neq not equal to

func (Uint32) NotBetween

func (field Uint32) NotBetween(left uint32, right uint32) Expr

NotBetween ...

func (Uint32) NotIn

func (field Uint32) NotIn(values ...uint32) Expr

NotIn ...

func (Uint32) NotLike

func (field Uint32) NotLike(value uint32) Expr

NotLike ...

func (Uint32) RightShift

func (field Uint32) RightShift(value uint32) Uint32

RightShift ...

func (Uint32) Sub

func (field Uint32) Sub(value uint32) Uint32

Sub ...

func (Uint32) Sum

func (field Uint32) Sum() Uint32

Sum ...

func (Uint32) Value

func (field Uint32) Value(value uint32) AssignExpr

Value set value

func (Uint32) Zero

func (field Uint32) Zero() AssignExpr

Zero set zero value

type Uint64

type Uint64 Int

Uint64 uint64 type field

func NewUint64

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

NewUint64 ...

func (Uint64) Add

func (field Uint64) Add(value uint64) Uint64

Add ...

func (Uint64) Between

func (field Uint64) Between(left uint64, right uint64) Expr

Between ...

func (Uint64) BitAnd

func (field Uint64) BitAnd(value uint64) Uint64

BitAnd ...

func (Uint64) BitFlip

func (field Uint64) BitFlip() Uint64

BitFlip ...

func (Uint64) BitOr

func (field Uint64) BitOr(value uint64) Uint64

BitOr ...

func (Uint64) BitXor

func (field Uint64) BitXor(value uint64) Uint64

BitXor ...

func (Uint64) Div

func (field Uint64) Div(value uint64) Uint64

Div ...

func (Uint64) Eq

func (field Uint64) Eq(value uint64) Expr

Eq equal to

func (Uint64) Field

func (field Uint64) Field(values ...uint64) Uint64

Field ...

func (Uint64) FloorDiv

func (field Uint64) FloorDiv(value uint64) Uint64

FloorDiv ...

func (Uint64) Gt

func (field Uint64) Gt(value uint64) Expr

Gt greater than

func (Uint64) Gte

func (field Uint64) Gte(value uint64) Expr

Gte greater or equal to

func (Uint64) IfNull

func (field Uint64) IfNull(value uint64) Expr

IfNull ...

func (Uint64) In

func (field Uint64) In(values ...uint64) Expr

In ...

func (Uint64) LeftShift

func (field Uint64) LeftShift(value uint64) Uint64

LeftShift ...

func (Uint64) Like

func (field Uint64) Like(value uint64) Expr

Like ...

func (Uint64) Lt

func (field Uint64) Lt(value uint64) Expr

Lt less than

func (Uint64) Lte

func (field Uint64) Lte(value uint64) Expr

Lte less or equal to

func (Uint64) Mod

func (field Uint64) Mod(value uint64) Uint64

Mod ...

func (Uint64) Mul

func (field Uint64) Mul(value uint64) Uint64

Mul ...

func (Uint64) Neq

func (field Uint64) Neq(value uint64) Expr

Neq not equal to

func (Uint64) NotBetween

func (field Uint64) NotBetween(left uint64, right uint64) Expr

NotBetween ...

func (Uint64) NotIn

func (field Uint64) NotIn(values ...uint64) Expr

NotIn ...

func (Uint64) NotLike

func (field Uint64) NotLike(value uint64) Expr

NotLike ...

func (Uint64) RightShift

func (field Uint64) RightShift(value uint64) Uint64

RightShift ...

func (Uint64) Sub

func (field Uint64) Sub(value uint64) Uint64

Sub ...

func (Uint64) Sum

func (field Uint64) Sum() Uint64

Sum ...

func (Uint64) Value

func (field Uint64) Value(value uint64) AssignExpr

Value set value

func (Uint64) Zero

func (field Uint64) Zero() AssignExpr

Zero set zero value

type Uint8

type Uint8 Int

Uint8 uint8 type field

func NewUint8

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

NewUint8 ...

func (Uint8) Add

func (field Uint8) Add(value uint8) Uint8

Add ...

func (Uint8) Between

func (field Uint8) Between(left uint8, right uint8) Expr

Between ...

func (Uint8) BitAnd

func (field Uint8) BitAnd(value uint8) Uint8

BitAnd ...

func (Uint8) BitFlip

func (field Uint8) BitFlip() Uint8

BitFlip ...

func (Uint8) BitOr

func (field Uint8) BitOr(value uint8) Uint8

BitOr ...

func (Uint8) BitXor

func (field Uint8) BitXor(value uint8) Uint8

BitXor ...

func (Uint8) Div

func (field Uint8) Div(value uint8) Uint8

Div ...

func (Uint8) Eq

func (field Uint8) Eq(value uint8) Expr

Eq equal to

func (Uint8) Field

func (field Uint8) Field(values ...uint8) Uint8

Field ...

func (Uint8) FloorDiv

func (field Uint8) FloorDiv(value uint8) Uint8

FloorDiv ...

func (Uint8) Gt

func (field Uint8) Gt(value uint8) Expr

Gt greater than

func (Uint8) Gte

func (field Uint8) Gte(value uint8) Expr

Gte greater or equal to

func (Uint8) IfNull

func (field Uint8) IfNull(value uint8) Expr

IfNull ...

func (Uint8) In

func (field Uint8) In(values ...uint8) Expr

In ...

func (Uint8) LeftShift

func (field Uint8) LeftShift(value uint8) Uint8

LeftShift ...

func (Uint8) Like

func (field Uint8) Like(value uint8) Expr

Like ...

func (Uint8) Lt

func (field Uint8) Lt(value uint8) Expr

Lt less than

func (Uint8) Lte

func (field Uint8) Lte(value uint8) Expr

Lte less or equal to

func (Uint8) Mod

func (field Uint8) Mod(value uint8) Uint8

Mod ...

func (Uint8) Mul

func (field Uint8) Mul(value uint8) Uint8

Mul ...

func (Uint8) Neq

func (field Uint8) Neq(value uint8) Expr

Neq not equal to

func (Uint8) NotBetween

func (field Uint8) NotBetween(left uint8, right uint8) Expr

NotBetween ...

func (Uint8) NotIn

func (field Uint8) NotIn(values ...uint8) Expr

NotIn ...

func (Uint8) NotLike

func (field Uint8) NotLike(value uint8) Expr

NotLike ...

func (Uint8) RightShift

func (field Uint8) RightShift(value uint8) Uint8

RightShift ...

func (Uint8) Sub

func (field Uint8) Sub(value uint8) Uint8

Sub ...

func (Uint8) Sum

func (field Uint8) Sum() Uint8

Sum ...

func (Uint8) Value

func (field Uint8) Value(value uint8) AssignExpr

Value set value

func (Uint8) Zero

func (field Uint8) Zero() AssignExpr

Zero set zero value

type Value

type Value interface {

	// implement Condition
	BeCond() interface{}
	CondError() error
	// contains filtered or unexported methods
}

Value ...

func Values

func Values(value interface{}) Value

Values convert value to expression which implement Value

type ValuerType

type ValuerType struct {
	Column  string
	Value   schema.SerializerValuerInterface
	FucName string
}

func (ValuerType) GormValue

func (v ValuerType) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr)

Jump to

Keyboard shortcuts

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