clause

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalQueryOperand

type AdditionalQueryOperand[C types.ColumnAlias] interface {
	Of(query types.Query) Clause[C]
	NotOf(query types.Query) Clause[C]
	Raw(string, string, ...any) Clause[C]
	NotRaw(string, string, ...any) Clause[C]
	ExistsOf(query types.Query) Clause[C]
	ExistsRaw(string, ...any) Clause[C]
}

type AndClause

type AndClause[C types.ColumnAlias] struct {
	Clauses []Clause[C]
}

func (*AndClause[C]) AddToBuilder

func (c *AndClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type AnyOperand

type AnyOperand[V any, C types.ColumnAlias] interface {
	Any(...V) Clause[C]
	NotAny(...V) Clause[C]
	AnyOf(query types.Query) Clause[C]
	AnyRaw(string, ...any) Clause[C]
}

type ArrayOperand

type ArrayOperand[V any, C types.ColumnAlias] interface {
	ARRAYContains(...V) Clause[C]
	ARRAYContainedBy(...V) Clause[C]
	ARRAYOverlap(...V) Clause[C]
	ARRAYContainsRaw(string, ...any) Clause[C]
	ARRAYContainedByRaw(string, ...any) Clause[C]
	ARRAYOverlapRaw(string, ...any) Clause[C]
	ARRAYLengthEq(int) Clause[C]
	ARRAYLengthGt(int) Clause[C]
	ARRAYLengthLt(int) Clause[C]
}

ArrayOperand defines operations specific to PostgreSQL array types

type BetweenOperand

type BetweenOperand[V any, C types.ColumnAlias] interface {
	Between(V, V) Clause[C]
	NotBetween(V, V) Clause[C]
}

type BinaryOperand

type BinaryOperand[V any, C types.ColumnAlias] interface {
	Gt(V) Clause[C]
	Gte(V) Clause[C]
	Lt(V) Clause[C]
	Lte(V) Clause[C]
}

type Clause

type Clause[C types.ColumnAlias] interface {
	AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)
}

type ColumnDML

type ColumnDML[V any, C types.ColumnAlias] struct {
	// contains filtered or unexported fields
}

func NewColumnDML

func NewColumnDML[V any, C types.ColumnAlias](fa C) *ColumnDML[V, C]

func (*ColumnDML[V, C]) ARRAYContainedBy

func (f *ColumnDML[V, C]) ARRAYContainedBy(vals ...V) Clause[C]

func (*ColumnDML[V, C]) ARRAYContainedByRaw

func (f *ColumnDML[V, C]) ARRAYContainedByRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) ARRAYContains

func (f *ColumnDML[V, C]) ARRAYContains(vals ...V) Clause[C]

func (*ColumnDML[V, C]) ARRAYContainsRaw

func (f *ColumnDML[V, C]) ARRAYContainsRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) ARRAYLengthEq

func (f *ColumnDML[V, C]) ARRAYLengthEq(length int) Clause[C]

func (*ColumnDML[V, C]) ARRAYLengthGt

func (f *ColumnDML[V, C]) ARRAYLengthGt(length int) Clause[C]

func (*ColumnDML[V, C]) ARRAYLengthLt

func (f *ColumnDML[V, C]) ARRAYLengthLt(length int) Clause[C]

func (*ColumnDML[V, C]) ARRAYOverlap

func (f *ColumnDML[V, C]) ARRAYOverlap(vals ...V) Clause[C]

func (*ColumnDML[V, C]) ARRAYOverlapRaw

func (f *ColumnDML[V, C]) ARRAYOverlapRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) And

func (f *ColumnDML[V, C]) And(clauses ...Clause[C]) Clause[C]

func (*ColumnDML[V, C]) Any

func (f *ColumnDML[V, C]) Any(vals ...V) Clause[C]

func (*ColumnDML[V, C]) AnyOf

func (f *ColumnDML[V, C]) AnyOf(query types.Query) Clause[C]

func (*ColumnDML[V, C]) AnyRaw

func (f *ColumnDML[V, C]) AnyRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) Between

func (f *ColumnDML[V, C]) Between(lower, upper V) Clause[C]

func (*ColumnDML[V, C]) Eq

func (f *ColumnDML[V, C]) Eq(val V) Clause[C]

func (*ColumnDML[V, C]) EqOf

func (f *ColumnDML[V, C]) EqOf(query types.Query) Clause[C]

func (*ColumnDML[V, C]) EqRaw

func (f *ColumnDML[V, C]) EqRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) ExistsOf

func (f *ColumnDML[V, C]) ExistsOf(query types.Query) Clause[C]

func (*ColumnDML[V, C]) ExistsRaw

func (f *ColumnDML[V, C]) ExistsRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) Gt

func (f *ColumnDML[V, C]) Gt(val V) Clause[C]

func (*ColumnDML[V, C]) Gte

func (f *ColumnDML[V, C]) Gte(val V) Clause[C]

func (*ColumnDML[V, C]) ILike

func (f *ColumnDML[V, C]) ILike(pattern string) Clause[C]

func (*ColumnDML[V, C]) In

func (f *ColumnDML[V, C]) In(vals ...V) Clause[C]

func (*ColumnDML[V, C]) InOf

func (f *ColumnDML[V, C]) InOf(query types.Query) Clause[C]

func (*ColumnDML[V, C]) InRaw

func (f *ColumnDML[V, C]) InRaw(sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) IsNotNull

func (f *ColumnDML[V, C]) IsNotNull() Clause[C]

func (*ColumnDML[V, C]) IsNull

func (f *ColumnDML[V, C]) IsNull() Clause[C]

func (*ColumnDML[V, C]) JSONContainedBy

func (f *ColumnDML[V, C]) JSONContainedBy(jsonValue string) Clause[C]

func (*ColumnDML[V, C]) JSONContains

func (f *ColumnDML[V, C]) JSONContains(jsonValue string) Clause[C]

func (*ColumnDML[V, C]) JSONGetField

func (f *ColumnDML[V, C]) JSONGetField(key string) *JsonFieldAccess[C]

func (*ColumnDML[V, C]) JSONGetFieldText

func (f *ColumnDML[V, C]) JSONGetFieldText(key string) *JsonFieldAccess[C]

func (*ColumnDML[V, C]) JSONGetPath

func (f *ColumnDML[V, C]) JSONGetPath(path ...string) *JsonFieldAccess[C]

func (*ColumnDML[V, C]) JSONGetPathText

func (f *ColumnDML[V, C]) JSONGetPathText(path ...string) *JsonFieldAccess[C]

func (*ColumnDML[V, C]) JSONHasAllKeys

func (f *ColumnDML[V, C]) JSONHasAllKeys(keys ...string) Clause[C]

func (*ColumnDML[V, C]) JSONHasAnyKey

func (f *ColumnDML[V, C]) JSONHasAnyKey(keys ...string) Clause[C]

func (*ColumnDML[V, C]) JSONHasKey

func (f *ColumnDML[V, C]) JSONHasKey(key string) Clause[C]

func (*ColumnDML[V, C]) JSONIsNotNull

func (f *ColumnDML[V, C]) JSONIsNotNull() Clause[C]

func (*ColumnDML[V, C]) JSONIsNull

func (f *ColumnDML[V, C]) JSONIsNull() Clause[C]

func (*ColumnDML[V, C]) JSONJsonPathPredicate

func (f *ColumnDML[V, C]) JSONJsonPathPredicate(path string) Clause[C]

func (*ColumnDML[V, C]) JSONJsonPathQuery

func (f *ColumnDML[V, C]) JSONJsonPathQuery(path string) Clause[C]

func (*ColumnDML[V, C]) JSONRaw

func (f *ColumnDML[V, C]) JSONRaw(operator string, sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) Like

func (f *ColumnDML[V, C]) Like(pattern string) Clause[C]

func (*ColumnDML[V, C]) Lt

func (f *ColumnDML[V, C]) Lt(val V) Clause[C]

func (*ColumnDML[V, C]) Lte

func (f *ColumnDML[V, C]) Lte(val V) Clause[C]

func (*ColumnDML[V, C]) Neq

func (f *ColumnDML[V, C]) Neq(val V) Clause[C]

func (*ColumnDML[V, C]) Not

func (f *ColumnDML[V, C]) Not(notThisclause Clause[C]) Clause[C]

func (*ColumnDML[V, C]) NotAny

func (f *ColumnDML[V, C]) NotAny(vals ...V) Clause[C]

func (*ColumnDML[V, C]) NotBetween

func (f *ColumnDML[V, C]) NotBetween(lower, upper V) Clause[C]

func (*ColumnDML[V, C]) NotILike

func (f *ColumnDML[V, C]) NotILike(pattern string) Clause[C]

func (*ColumnDML[V, C]) NotIn

func (f *ColumnDML[V, C]) NotIn(vals ...V) Clause[C]

func (*ColumnDML[V, C]) NotLike

func (f *ColumnDML[V, C]) NotLike(pattern string) Clause[C]

func (*ColumnDML[V, C]) NotOf

func (f *ColumnDML[V, C]) NotOf(query types.Query) Clause[C]

func (*ColumnDML[V, C]) NotRaw

func (f *ColumnDML[V, C]) NotRaw(operator string, sql string, args ...any) Clause[C]

func (*ColumnDML[V, C]) Of

func (f *ColumnDML[V, C]) Of(query types.Query) Clause[C]

func (*ColumnDML[V, C]) Or

func (f *ColumnDML[V, C]) Or(clauses ...Clause[C]) Clause[C]

func (*ColumnDML[V, C]) Raw

func (f *ColumnDML[V, C]) Raw(operator string, sql string, args ...any) Clause[C]

type CommonOperand

type CommonOperand[V any, C types.ColumnAlias] interface {
	EqOperand[V, C]
	LogicalOperand[C]
	AdditionalQueryOperand[C]
}

type CommonScalarOperand

type CommonScalarOperand[V any, C types.ColumnAlias] interface {
	CommonOperand[V, C]
	ScalarOperand[V, C]
}

type EqOperand

type EqOperand[V any, C types.ColumnAlias] interface {
	Eq(V) Clause[C]
	Neq(V) Clause[C]
	EqOf(query types.Query) Clause[C]
	EqRaw(string, ...any) Clause[C]
}

type ExistsClause

type ExistsClause[C types.ColumnAlias] struct {
	SubQuery Clause[C]
	Negate   bool
}

func (*ExistsClause[C]) AddToBuilder

func (c *ExistsClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type FieldClause

type FieldClause[C types.ColumnAlias] struct {
	Field    C
	Operator string
	Right    types.Builder
	Negate   bool
}

func (*FieldClause[C]) AddToBuilder

func (c *FieldClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type InOperand

type InOperand[V any, C types.ColumnAlias] interface {
	In(...V) Clause[C]
	NotIn(...V) Clause[C]
	InOf(query types.Query) Clause[C]
	InRaw(string, ...any) Clause[C]
}

type IsNullOperand

type IsNullOperand[C types.ColumnAlias] interface {
	IsNull() Clause[C]
	IsNotNull() Clause[C]
}

type JsonFieldAccess

type JsonFieldAccess[C types.ColumnAlias] struct {
	// contains filtered or unexported fields
}

func (*JsonFieldAccess[C]) Eq

func (j *JsonFieldAccess[C]) Eq(val any) Clause[C]

func (*JsonFieldAccess[C]) Gt

func (j *JsonFieldAccess[C]) Gt(val any) Clause[C]

func (*JsonFieldAccess[C]) In

func (j *JsonFieldAccess[C]) In(vals ...any) Clause[C]

func (*JsonFieldAccess[C]) Like

func (j *JsonFieldAccess[C]) Like(pattern string) Clause[C]

func (*JsonFieldAccess[C]) Lt

func (j *JsonFieldAccess[C]) Lt(val any) Clause[C]

func (*JsonFieldAccess[C]) Neq

func (j *JsonFieldAccess[C]) Neq(val any) Clause[C]

type JsonFieldClause

type JsonFieldClause[C types.ColumnAlias] struct {
	// contains filtered or unexported fields
}

func (*JsonFieldClause[C]) AddToBuilder

func (c *JsonFieldClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type JsonOperand

type JsonOperand[C types.ColumnAlias] interface {
	JSONGetField(key string) *JsonFieldAccess[C]
	JSONGetFieldText(key string) *JsonFieldAccess[C]
	JSONGetPath(path ...string) *JsonFieldAccess[C]
	JSONGetPathText(path ...string) *JsonFieldAccess[C]
	JSONContains(jsonValue string) Clause[C]
	JSONContainedBy(jsonValue string) Clause[C]
	JSONHasKey(key string) Clause[C]
	JSONHasAnyKey(keys ...string) Clause[C]
	JSONHasAllKeys(keys ...string) Clause[C]
	JSONJsonPathQuery(path string) Clause[C]
	JSONJsonPathPredicate(path string) Clause[C]
	JSONIsNull() Clause[C]
	JSONIsNotNull() Clause[C]
	JSONRaw(operator string, sql string, args ...any) Clause[C]
}

JsonOperand defines operations specific to PostgreSQL JSON/JSONB types

type JsonOperandColumn

type JsonOperandColumn[C types.ColumnAlias] struct {
	// contains filtered or unexported fields
}

JsonOperandColumn provides PostgreSQL JSON/JSONB operations

func NewJsonColumn

func NewJsonColumn[C types.ColumnAlias](fa C) *JsonOperandColumn[C]

func (*JsonOperandColumn[C]) ContainedBy

func (f *JsonOperandColumn[C]) ContainedBy(jsonValue string) Clause[C]

ContainedBy (<@) - JSON is contained by another JSON

func (*JsonOperandColumn[C]) Contains

func (f *JsonOperandColumn[C]) Contains(jsonValue string) Clause[C]

Contains (@>) - JSON contains another JSON

func (*JsonOperandColumn[C]) GetField

func (f *JsonOperandColumn[C]) GetField(key string) *JsonFieldAccess[C]

GetField (->) - get JSON object field

func (*JsonOperandColumn[C]) GetFieldText

func (f *JsonOperandColumn[C]) GetFieldText(key string) *JsonFieldAccess[C]

GetFieldText (->>) - get JSON field as text

func (*JsonOperandColumn[C]) GetPath

func (f *JsonOperandColumn[C]) GetPath(path ...string) *JsonFieldAccess[C]

GetPath (#>) - get nested JSON object

func (*JsonOperandColumn[C]) GetPathText

func (f *JsonOperandColumn[C]) GetPathText(path ...string) *JsonFieldAccess[C]

GetPathText (#>>) - get nested JSON object as text

func (*JsonOperandColumn[C]) HasAllKeys

func (f *JsonOperandColumn[C]) HasAllKeys(keys ...string) Clause[C]

HasAllKeys (?&) - JSON has all of the keys

func (*JsonOperandColumn[C]) HasAnyKey

func (f *JsonOperandColumn[C]) HasAnyKey(keys ...string) Clause[C]

HasAnyKey (?|) - JSON has any of the keys

func (*JsonOperandColumn[C]) HasKey

func (f *JsonOperandColumn[C]) HasKey(key string) Clause[C]

HasKey (?) - JSON has key

func (*JsonOperandColumn[C]) IsNotNull

func (f *JsonOperandColumn[C]) IsNotNull() Clause[C]

IsNotNull checks if JSON is not null

func (*JsonOperandColumn[C]) IsNull

func (f *JsonOperandColumn[C]) IsNull() Clause[C]

IsNull checks if JSON is null

func (*JsonOperandColumn[C]) JsonPathPredicate

func (f *JsonOperandColumn[C]) JsonPathPredicate(path string) Clause[C]

JsonPathPredicate (@@) - JSONPath predicate

func (*JsonOperandColumn[C]) JsonPathQuery

func (f *JsonOperandColumn[C]) JsonPathQuery(path string) Clause[C]

JsonPathQuery (@?) - JSONPath query

func (*JsonOperandColumn[C]) Raw

func (f *JsonOperandColumn[C]) Raw(operator string, sql string, args ...any) Clause[C]

Raw allows custom JSON operations

type LikeOperand

type LikeOperand[C types.ColumnAlias] interface {
	Like(s string) Clause[C]
	NotLike(s string) Clause[C]
	ILike(s string) Clause[C]
	NotILike(s string) Clause[C]
}

type LogicalOperand

type LogicalOperand[C types.ColumnAlias] interface {
	Or(clause ...Clause[C]) Clause[C]
	And(clause ...Clause[C]) Clause[C]
	Not(clause Clause[C]) Clause[C]
}

type NotClause

type NotClause[C types.ColumnAlias] struct {
	Inner Clause[C]
}

func (*NotClause[C]) AddToBuilder

func (c *NotClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type OrClause

type OrClause[C types.ColumnAlias] struct {
	Clauses []Clause[C]
}

func (*OrClause[C]) AddToBuilder

func (c *OrClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type ParamExprClause

type ParamExprClause[C types.ColumnAlias] struct {
	Value     any
	LikeWrapp bool
}

func (*ParamExprClause[C]) AddToBuilder

func (e *ParamExprClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type RawExprClause

type RawExprClause[C types.ColumnAlias] struct {
	SQL  string
	Args []any
}

func (*RawExprClause[C]) AddToBuilder

func (e *RawExprClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type ScalarOperand

type ScalarOperand[V any, C types.ColumnAlias] interface {
	BinaryOperand[V, C]
	AnyOperand[V, C]
	InOperand[V, C]
	BetweenOperand[V, C]
}

type SliceExprClause

type SliceExprClause[C types.ColumnAlias] struct {
	Values any // slice
}

func (*SliceExprClause[C]) AddToBuilder

func (e *SliceExprClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

type SubQueryExprClause

type SubQueryExprClause[C types.ColumnAlias] struct {
	Query types.Query
}

func (*SubQueryExprClause[C]) AddToBuilder

func (e *SubQueryExprClause[C]) AddToBuilder(buf *strings.Builder, ta string, paramIndex *int, args *[]any)

Jump to

Keyboard shortcuts

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