Documentation
¶
Index ¶
- func AdaptField(field string) string
- func AdaptTable(table string) string
- func Delete(builder sqlbuilder.DeleteBuilder, conditions ...Condition) sqlbuilder.DeleteBuilder
- func DeleteWithFlavor(flavor sqlbuilder.Flavor, builder sqlbuilder.DeleteBuilder, ...) sqlbuilder.DeleteBuilder
- func QuoteWithFlavor(flavor sqlbuilder.Flavor, str string) string
- func RawFieldNames(in any) []string
- func RawFieldNamesWithFlavor(flavor sqlbuilder.Flavor, in any) []string
- func RemoveIgnoreColumns(columns []string, ignoreColumns ...string) []string
- func RemoveIgnoreColumnsWithFlavor(flavor sqlbuilder.Flavor, columns []string, ignoreColumns ...string) []string
- func Select(builder sqlbuilder.SelectBuilder, conditions ...Condition) sqlbuilder.SelectBuilder
- func SelectByWhereRawSql(sb *sqlbuilder.SelectBuilder, originalField string, args ...any)
- func SelectByWhereRawSqlWithFlavor(flavor sqlbuilder.Flavor, sb *sqlbuilder.SelectBuilder, originalField string, ...)
- func SelectWithFlavor(flavor sqlbuilder.Flavor, builder sqlbuilder.SelectBuilder, ...) sqlbuilder.SelectBuilder
- func ToSlice(i any) []any
- func Unquote(s string) string
- func Update(builder sqlbuilder.UpdateBuilder, conditions ...Condition) sqlbuilder.UpdateBuilder
- func UpdateWithFlavor(flavor sqlbuilder.Flavor, builder sqlbuilder.UpdateBuilder, ...) sqlbuilder.UpdateBuilder
- func WithOrValuesFunc(valueFunc func() []any) opts.Opt[ChainOperatorOpts]
- func WithSkip(skip bool) opts.Opt[ChainOperatorOpts]
- func WithSkipFunc(skipFunc func() bool) opts.Opt[ChainOperatorOpts]
- func WithValueFunc(valueFunc func() any) opts.Opt[ChainOperatorOpts]
- type Chain
- func (c Chain) AddCondition(condition Condition) Chain
- func (c Chain) Between(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Build() []Condition
- func (c Chain) Equal(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) GreaterEqualThan(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) GreaterThan(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) GroupBy(field Field, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) In(field Field, values any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Join(option sqlbuilder.JoinOption, table string, onExpr ...string) Chain
- func (c Chain) LessEqualThan(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) LessThan(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Like(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Limit(value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) NotEqual(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) NotIn(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) NotLike(field Field, value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Offset(value any, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Or(fields []Field, operators []Operator, values []any, ...) Chain
- func (c Chain) OrderBy(value any, op ...opts.Opt[ChainOperatorOpts]) Chaindeprecated
- func (c Chain) OrderByAsc(field Field, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) OrderByDesc(field Field, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) Page(page, pageSize int, op ...opts.Opt[ChainOperatorOpts]) Chain
- func (c Chain) WhereClause(whereClause *sqlbuilder.WhereClause) Chain
- type ChainOperatorOpts
- type Condition
- type Field
- type JoinCondition
- type Operator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdaptField ¶ added in v0.40.0
AdaptField Deprecated use Quote instead
func AdaptTable ¶ added in v0.40.0
AdaptTable Deprecated use Quote instead
func Delete ¶
func Delete(builder sqlbuilder.DeleteBuilder, conditions ...Condition) sqlbuilder.DeleteBuilder
func DeleteWithFlavor ¶ added in v0.64.0
func DeleteWithFlavor(flavor sqlbuilder.Flavor, builder sqlbuilder.DeleteBuilder, conditions ...Condition) sqlbuilder.DeleteBuilder
func QuoteWithFlavor ¶ added in v0.64.0
func QuoteWithFlavor(flavor sqlbuilder.Flavor, str string) string
func RawFieldNames ¶
RawFieldNames converts golang struct field into slice string.
func RawFieldNamesWithFlavor ¶ added in v0.64.0
func RawFieldNamesWithFlavor(flavor sqlbuilder.Flavor, in any) []string
RawFieldNamesWithFlavor converts golang struct field into slice string.
func RemoveIgnoreColumns ¶
func RemoveIgnoreColumnsWithFlavor ¶ added in v0.64.0
func RemoveIgnoreColumnsWithFlavor(flavor sqlbuilder.Flavor, columns []string, ignoreColumns ...string) []string
func Select ¶
func Select(builder sqlbuilder.SelectBuilder, conditions ...Condition) sqlbuilder.SelectBuilder
func SelectByWhereRawSql ¶
func SelectByWhereRawSql(sb *sqlbuilder.SelectBuilder, originalField string, args ...any)
func SelectByWhereRawSqlWithFlavor ¶ added in v0.64.0
func SelectByWhereRawSqlWithFlavor(flavor sqlbuilder.Flavor, sb *sqlbuilder.SelectBuilder, originalField string, args ...any)
func SelectWithFlavor ¶ added in v0.64.0
func SelectWithFlavor(flavor sqlbuilder.Flavor, builder sqlbuilder.SelectBuilder, conditions ...Condition) sqlbuilder.SelectBuilder
func Update ¶
func Update(builder sqlbuilder.UpdateBuilder, conditions ...Condition) sqlbuilder.UpdateBuilder
func UpdateWithFlavor ¶ added in v0.64.0
func UpdateWithFlavor(flavor sqlbuilder.Flavor, builder sqlbuilder.UpdateBuilder, conditions ...Condition) sqlbuilder.UpdateBuilder
func WithOrValuesFunc ¶
func WithOrValuesFunc(valueFunc func() []any) opts.Opt[ChainOperatorOpts]
func WithSkipFunc ¶
func WithSkipFunc(skipFunc func() bool) opts.Opt[ChainOperatorOpts]
func WithValueFunc ¶
func WithValueFunc(valueFunc func() any) opts.Opt[ChainOperatorOpts]
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func NewChainWithConditions
deprecated
func (Chain) AddCondition ¶
func (Chain) GreaterEqualThan ¶
func (Chain) GreaterThan ¶
func (Chain) Join ¶
func (c Chain) Join(option sqlbuilder.JoinOption, table string, onExpr ...string) Chain
func (Chain) LessEqualThan ¶
func (Chain) OrderByAsc ¶ added in v0.63.0
func (Chain) OrderByDesc ¶ added in v0.63.0
func (Chain) WhereClause ¶
func (c Chain) WhereClause(whereClause *sqlbuilder.WhereClause) Chain
type ChainOperatorOpts ¶
type ChainOperatorOpts struct {
Skip bool
SkipFunc func() bool
ValueFunc func() any
OrValuesFunc func() []any
}
func (ChainOperatorOpts) DefaultOptions ¶
func (opts ChainOperatorOpts) DefaultOptions() ChainOperatorOpts
type Condition ¶
type Condition struct {
// Skip indicates whether the condition is effective.
Skip bool
// SkipFunc The priority is higher than Skip.
SkipFunc func() bool
// Or indicates an or condition
Or bool
OrOperators []Operator
OrFields []Field
OrValues []any
OrValuesFunc func() []any
// Field for default and condition
Field Field
Operator Operator
Value any
// ValueFunc The priority is higher than Value.
ValueFunc func() any
// JoinCondition
JoinCondition
WhereClause *sqlbuilder.WhereClause
}
type JoinCondition ¶
type JoinCondition struct {
Option sqlbuilder.JoinOption
Table string
OnExpr []string
}
type Operator ¶
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" NotBetween Operator = "NOT BETWEEN" // Deprecated Use OrderByDesc or OrderByAsc instead. OrderBy Operator = "ORDER BY" OrderByDesc Operator = "ORDER BY DESC" OrderByAsc Operator = "ORDER BY ASC" GroupBy Operator = "GROUP BY" Join Operator = "JOIN" )
Click to show internal directories.
Click to hide internal directories.