sql

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatValue

func FormatValue(field string) string

func String

func String(s SqlInterface) string

Types

type Batch

type Batch struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewBatch

func NewBatch(table string) *Batch

func NewBatchBy added in v2.2.1

func NewBatchBy(ctx object.CtxInterface, table string) *Batch

func (*Batch) Add

func (b *Batch) Add(insert *Insert) *Batch

func (*Batch) Args

func (b *Batch) Args() []any

func (*Batch) Inserts

func (b *Batch) Inserts() []*Insert

func (*Batch) Prepare

func (b *Batch) Prepare() string

func (*Batch) Reset added in v2.2.1

func (b *Batch) Reset()

func (*Batch) String

func (b *Batch) String() string

type Delete

type Delete struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewCkDelete

func NewCkDelete(table string) *Delete

func NewCkDeleteBy added in v2.2.1

func NewCkDeleteBy(ctx object.CtxInterface, table string) *Delete

func NewDelete

func NewDelete(table string) *Delete

func NewDeleteBy added in v2.2.1

func NewDeleteBy(ctx object.CtxInterface, table string) *Delete

func (*Delete) Args

func (d *Delete) Args() []any

func (*Delete) Prepare

func (d *Delete) Prepare() string

func (*Delete) Reset added in v2.2.1

func (d *Delete) Reset()

func (*Delete) String

func (d *Delete) String() string

func (*Delete) Where

func (d *Delete) Where(w WhereInterface) *Delete

func (*Delete) WhereByList

func (d *Delete) WhereByList(where meta.List) *Delete

func (*Delete) WhereByMap

func (d *Delete) WhereByMap(where meta.Where) *Delete

type Desc added in v2.0.2

type Desc struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewDesc added in v2.0.2

func NewDesc(table string) *Desc

func NewDescBy added in v2.2.1

func NewDescBy(ctx object.CtxInterface, table string) *Desc

func (*Desc) Args added in v2.0.2

func (d *Desc) Args() []any

func (*Desc) Prepare added in v2.0.2

func (d *Desc) Prepare() string

func (*Desc) Reset added in v2.2.1

func (d *Desc) Reset()

func (*Desc) String added in v2.0.2

func (d *Desc) String() string

type Having

type Having struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewHaving

func NewHaving() *Having

func NewHavingBy added in v2.2.1

func NewHavingBy(ctx object.CtxInterface) *Having

func (*Having) Args

func (w *Having) Args() []any

func (*Having) Between

func (w *Having) Between(field string, from any, to any) *Having

func (*Having) Eq

func (w *Having) Eq(field string, value any) *Having

func (*Having) Ge

func (w *Having) Ge(field string, value any) *Having

func (*Having) Gt

func (w *Having) Gt(field string, value any) *Having

func (*Having) In

func (w *Having) In(field string, value []any) *Having

func (*Having) IsNotNull

func (w *Having) IsNotNull(field string) *Having

func (*Having) IsNull

func (w *Having) IsNull(field string) *Having

func (*Having) Le

func (w *Having) Le(field string, value any) *Having

func (*Having) Like

func (w *Having) Like(field string, value any) *Having

func (*Having) Lt

func (w *Having) Lt(field string, value any) *Having

func (*Having) Neq

func (w *Having) Neq(field string, value any) *Having

func (*Having) NotIn

func (w *Having) NotIn(field string, value []any) *Having

func (*Having) OrPrepare

func (w *Having) OrPrepare() string

func (*Having) Prepare

func (w *Having) Prepare() string

func (*Having) Reset added in v2.2.1

func (h *Having) Reset()

func (*Having) Statement

func (w *Having) Statement(statement string) *Having

func (*Having) String

func (w *Having) String() string

type Insert

type Insert struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewInsert

func NewInsert(table string) *Insert

func NewInsertBy added in v2.2.1

func NewInsertBy(ctx object.CtxInterface, table string) *Insert

func (*Insert) Args

func (i *Insert) Args() []any

func (*Insert) Fields

func (i *Insert) Fields() []string

func (*Insert) ParseValue

func (i *Insert) ParseValue(fields []string)

func (*Insert) Prepare

func (i *Insert) Prepare() string

func (*Insert) Reset added in v2.2.1

func (i *Insert) Reset()

func (*Insert) Set

func (i *Insert) Set(field string, value any) *Insert

func (*Insert) String

func (i *Insert) String() string

type Join added in v2.0.3

type Join struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewJoin added in v2.0.3

func NewJoin(table, alias, on string, columns ...string) *Join

func NewJoinBy added in v2.2.1

func NewJoinBy(ctx object.CtxInterface, table, alias, on string, columns ...string) *Join

func NewJoinSub added in v2.0.5

func NewJoinSub(sub *Select, alias, on string, columns ...string) *Join

func NewJoinSubBy added in v2.2.1

func NewJoinSubBy(ctx object.CtxInterface, sub *Select, alias, on string, columns ...string) *Join

func (*Join) CaseWhen added in v2.0.3

func (j *Join) CaseWhen(caseWhens ...*meta.CaseWhen) *Join

func (*Join) ColMeta added in v2.0.5

func (j *Join) ColMeta(columns ...*meta.Column) *Join

func (*Join) Columns added in v2.0.3

func (j *Join) Columns(columns ...string) *Join

func (*Join) Reset added in v2.2.1

func (j *Join) Reset()

type Select

type Select struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewSelect

func NewSelect(table string, alias string) *Select

func NewSelectBy added in v2.2.1

func NewSelectBy(ctx object.CtxInterface, table, alias string) *Select

func NewSelectSub added in v2.0.5

func NewSelectSub(sub *Select, alias string) *Select

func NewSelectSubBy added in v2.2.1

func NewSelectSubBy(ctx object.CtxInterface, sub *Select, alias string) *Select

func (*Select) Args

func (s *Select) Args() []any

func (*Select) CaseWhen added in v2.0.3

func (s *Select) CaseWhen(caseWhens ...*meta.CaseWhen) *Select

func (*Select) ColMeta added in v2.0.5

func (s *Select) ColMeta(columns ...*meta.Column) *Select

func (*Select) Columns

func (s *Select) Columns(columns ...string) *Select

func (*Select) ForUpdate

func (s *Select) ForUpdate() *Select

func (*Select) GetLimit added in v2.0.8

func (s *Select) GetLimit() int

func (*Select) GetOffset added in v2.1.3

func (s *Select) GetOffset() int

func (*Select) Group

func (s *Select) Group(groups ...string) *Select

func (*Select) Having

func (s *Select) Having(having *Having) *Select

func (*Select) InnerJoin

func (s *Select) InnerJoin(table, alias, on string, columns ...string) *Select

func (*Select) InnerJoinSub added in v2.0.5

func (s *Select) InnerJoinSub(sub *Select, alias, on string, columns ...string) *Select

func (*Select) InnerJoinWith added in v2.0.5

func (s *Select) InnerJoinWith(join *Join) *Select

func (*Select) LeftJoin

func (s *Select) LeftJoin(table, alias, on string, columns ...string) *Select

func (*Select) LeftJoinSub added in v2.0.5

func (s *Select) LeftJoinSub(sub *Select, alias, on string, columns ...string) *Select

func (*Select) LeftJoinWith added in v2.0.5

func (s *Select) LeftJoinWith(join *Join) *Select

func (*Select) Limit

func (s *Select) Limit(size int) *Select

func (*Select) Offset

func (s *Select) Offset(offset int) *Select

func (*Select) OrWhere

func (s *Select) OrWhere(where WhereInterface) *Select

func (*Select) Order

func (s *Select) Order(orders ...string) *Select

func (*Select) Prepare

func (s *Select) Prepare() string

func (*Select) Reset added in v2.2.1

func (s *Select) Reset()

func (*Select) RightJoin

func (s *Select) RightJoin(table, alias, on string, columns ...string) *Select

func (*Select) RightJoinSub added in v2.0.5

func (s *Select) RightJoinSub(sub *Select, alias, on string, columns ...string) *Select

func (*Select) RightJoinWith added in v2.0.5

func (s *Select) RightJoinWith(join *Join) *Select

func (*Select) SetColMeta added in v2.0.5

func (s *Select) SetColMeta(columns []*meta.Column) *Select

func (*Select) SetColumns added in v2.0.5

func (s *Select) SetColumns(columns []string) *Select

func (*Select) String

func (s *Select) String() string

func (*Select) Where

func (s *Select) Where(where WhereInterface) *Select

func (*Select) WhereByList

func (s *Select) WhereByList(where meta.List) *Select

func (*Select) WhereByMap

func (s *Select) WhereByMap(where meta.Where) *Select

type ShowTables added in v2.0.2

type ShowTables struct {
	*object.ObjNoCtx
}

func NewShowTables added in v2.0.2

func NewShowTables() *ShowTables

func NewShowTablesBy added in v2.2.1

func NewShowTablesBy(ctx object.CtxInterface) *ShowTables

func (*ShowTables) Args added in v2.0.2

func (d *ShowTables) Args() []any

func (*ShowTables) Prepare added in v2.0.2

func (d *ShowTables) Prepare() string

func (*ShowTables) String added in v2.0.2

func (d *ShowTables) String() string

type SqlInterface

type SqlInterface interface {
	StrInterface
	Args() []any
	Prepare() string
}

type StrInterface added in v2.1.9

type StrInterface interface {
	String() string
}

type Update

type Update struct {
	*object.ObjNoCtx
	// contains filtered or unexported fields
}

func NewCkUpdate

func NewCkUpdate(table string) *Update

func NewCkUpdateBy added in v2.2.1

func NewCkUpdateBy(ctx object.CtxInterface, table string) *Update

func NewUpdate

func NewUpdate(table string) *Update

func NewUpdateBy added in v2.2.1

func NewUpdateBy(ctx object.CtxInterface, table string) *Update

func (*Update) Args

func (u *Update) Args() []any

func (*Update) Prepare

func (u *Update) Prepare() string

func (*Update) Reset added in v2.2.1

func (u *Update) Reset()

func (*Update) Set

func (u *Update) Set(field string, value any) *Update

func (*Update) String

func (u *Update) String() string

func (*Update) Where

func (u *Update) Where(w WhereInterface) *Update

func (*Update) WhereByList

func (u *Update) WhereByList(where meta.List) *Update

func (*Update) WhereByMap

func (u *Update) WhereByMap(where meta.Where) *Update

type Where

type Where struct {
	*object.ObjNoCtx
	Fields []string `json:"fields"`
	Binds  []any    `json:"binds"`
}

func NewWhere

func NewWhere() *Where

func NewWhereBy added in v2.2.1

func NewWhereBy(ctx object.CtxInterface) *Where

func (*Where) Args

func (w *Where) Args() []any

func (*Where) Between

func (w *Where) Between(field string, from any, to any)

func (*Where) Eq

func (w *Where) Eq(field string, value any)

func (*Where) Ge

func (w *Where) Ge(field string, value any)

func (*Where) Gt

func (w *Where) Gt(field string, value any)

func (*Where) In

func (w *Where) In(field string, value []any)

func (*Where) IsNotNull

func (w *Where) IsNotNull(field string)

func (*Where) IsNull

func (w *Where) IsNull(field string)

func (*Where) Le

func (w *Where) Le(field string, value any)

func (*Where) Like

func (w *Where) Like(field string, value any)

func (*Where) Lt

func (w *Where) Lt(field string, value any)

func (*Where) Neq

func (w *Where) Neq(field string, value any)

func (*Where) NotIn

func (w *Where) NotIn(field string, value []any)

func (*Where) OrPrepare

func (w *Where) OrPrepare() string

func (*Where) Prepare

func (w *Where) Prepare() string

func (*Where) Reset added in v2.2.1

func (w *Where) Reset()

func (*Where) Statement

func (w *Where) Statement(statement string)

func (*Where) String

func (w *Where) String() string

type WhereInterface

type WhereInterface interface {
	SqlInterface
	Eq(field string, value any)
	Neq(field string, value any)
	Like(field string, value any)
	Between(field string, from, to any)
	Gt(field string, value any)
	Ge(field string, value any)
	Lt(field string, value any)
	Le(field string, value any)
	In(field string, value []any)
	NotIn(field string, value []any)
	IsNull(field string)
	IsNotNull(field string)
	Statement(statement string)
	OrPrepare() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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