condition

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(sb *sqlbuilder.SelectBuilder, conditions ...Condition)

func ApplyDelete added in v0.5.0

func ApplyDelete(sb *sqlbuilder.DeleteBuilder, conditions ...Condition)

func ApplySelect added in v0.5.0

func ApplySelect(sb *sqlbuilder.SelectBuilder, conditions ...Condition)

func ApplyUpdate added in v0.5.0

func ApplyUpdate(sb *sqlbuilder.UpdateBuilder, conditions ...Condition)

Types

type Condition

type Condition struct {
	Skip     bool
	SkipFunc func() bool

	// or condition
	Or           bool
	OrOperators  []Operator
	OrFields     []string
	OrValues     []any
	OrValuesFunc func() []any

	// and condition
	Field     string
	Operator  Operator
	Value     any
	ValueFunc func() any
}

func New

func New(conditions ...Condition) []Condition

type Operator added in v0.4.0

type Operator string
const (
	Equal            Operator = "="
	NotEqual         Operator = "!="
	GreaterThan      Operator = ">"
	LessThan         Operator = "<"
	GreaterEqualThan Operator = ">="
	LessEqualThan    Operator = "<="
	In               Operator = "IN"
	NotIn            Operator = "NOT IN"
	Like             Operator = "LIKE"
	NotLike          Operator = "NOT LIKE"
	Limit            Operator = "LIMIT"
	Offset           Operator = "OFFSET"
	Between          Operator = "BETWEEN"
	OrderBy          Operator = "ORDER BY"
)

func (Operator) String added in v0.4.0

func (o Operator) String() string

Jump to

Keyboard shortcuts

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