Documentation
¶
Index ¶
- Variables
- type AggExpBuilder
- type CaseBuilder
- type CaseExp
- type CaseWhenBuilder
- type CombinationBuilder
- type DeleteBuilder
- type Exp
- func And(exps ...Exp) Exp
- func Arg(argument any) Exp
- func Array(elems ...Exp) Exp
- func Bind(argName string) Exp
- func Bool(b bool) Exp
- func Default() Exp
- func Float(f float64) Exp
- func Int(s int) Exp
- func Interval(spec string) Exp
- func Not(e Exp) Exp
- func Null() Exp
- func Or(exps ...Exp) Exp
- func String(s string) Exp
- type ExpBase
- func (b ExpBase) Cast(typ string) Exp
- func (b ExpBase) Concat(rgt Exp) Exp
- func (b ExpBase) Eq(rgt Exp) Exp
- func (b ExpBase) Gt(rgt Exp) Exp
- func (b ExpBase) Gte(rgt Exp) Exp
- func (b ExpBase) ILike(rgt Exp) MatchingBuilder
- func (ExpBase) IsExp()
- func (b ExpBase) IsNotNull() Exp
- func (b ExpBase) IsNull() Exp
- func (b ExpBase) JsonContainedBy(rgt Exp) Exp
- func (b ExpBase) JsonContains(rgt Exp) Exp
- func (b ExpBase) JsonExtract(rgt Exp) Exp
- func (b ExpBase) JsonExtractPath(rgt Exp) Exp
- func (b ExpBase) JsonExtractPathText(rgt Exp) Exp
- func (b ExpBase) JsonExtractText(rgt Exp) Exp
- func (b ExpBase) Like(rgt Exp) MatchingBuilder
- func (b ExpBase) Lt(rgt Exp) Exp
- func (b ExpBase) Lte(rgt Exp) Exp
- func (b ExpBase) Neq(rgt Exp) Exp
- func (b ExpBase) NotILike(rgt Exp) MatchingBuilder
- func (b ExpBase) NotLike(rgt Exp) MatchingBuilder
- func (b ExpBase) NotSimilarTo(rgt Exp) MatchingBuilder
- func (b ExpBase) Op(op Operator, rgt Exp) Exp
- func (b ExpBase) SimilarTo(rgt Exp) MatchingBuilder
- type FromExp
- type FromLateralExp
- type FromSelectBuilder
- type FuncBuilder
- type FuncExp
- type GroupyBySelectBuilder
- func (b GroupyBySelectBuilder) Cube(sets ...[]Exp) GroupyBySelectBuilder
- func (b GroupyBySelectBuilder) Distinct() GroupyBySelectBuilder
- func (b GroupyBySelectBuilder) Empty() GroupyBySelectBuilder
- func (b GroupyBySelectBuilder) GroupingSets(sets ...[]Exp) GroupyBySelectBuilder
- func (b GroupyBySelectBuilder) Rollup(sets ...[]Exp) GroupyBySelectBuilder
- type IdentExp
- type InsertBuilder
- func (b InsertBuilder) As(alias string) InsertBuilder
- func (b InsertBuilder) ColumnNames(columnName string, rest ...string) InsertBuilder
- func (b InsertBuilder) SetMap(m map[string]any) InsertBuilder
- func (b InsertBuilder) Values(values ...Exp) InsertBuilder
- func (b InsertBuilder) WriteSQL(sb *SQLBuilder)
- type JoinSelectBuilder
- type JsonBuildObjectBuilder
- func (b JsonBuildObjectBuilder) IsExp()
- func (b JsonBuildObjectBuilder) Prop(key string, value Exp) JsonBuildObjectBuilder
- func (b JsonBuildObjectBuilder) PropIf(condition bool, key string, value Exp) JsonBuildObjectBuilder
- func (b JsonBuildObjectBuilder) Start() *JsonBuildObjectBuilderBuilder
- func (b JsonBuildObjectBuilder) Unset(key string) JsonBuildObjectBuilder
- func (b JsonBuildObjectBuilder) WriteSQL(sb *SQLBuilder)
- type JsonBuildObjectBuilderBuilder
- type MatchingBuilder
- type Operator
- type OrderByAggExpBuilder
- type OrderBySelectBuilder
- type QueryBuilder
- type RowsFromBuilder
- type SQLBuilder
- type SQLWriter
- type SelectBuilder
- func (b SelectBuilder) ApplyIf(cond bool, f func(q SelectBuilder) SelectBuilder) SelectBuilder
- func (b SelectBuilder) Except() CombinationBuilder
- func (b SelectBuilder) From(from FromExp) FromSelectBuilder
- func (b SelectBuilder) FromLateral(from FromLateralExp) FromSelectBuilder
- func (b SelectBuilder) FromOnly(from FromExp) FromSelectBuilder
- func (b SelectBuilder) FullJoin(from FromExp) JoinSelectBuilder
- func (b SelectBuilder) GroupBy(exps ...Exp) GroupyBySelectBuilder
- func (b SelectBuilder) Having(cond Exp) SelectBuilder
- func (b SelectBuilder) Intersect() CombinationBuilder
- func (b SelectBuilder) IsExp()
- func (b SelectBuilder) Join(from FromExp) JoinSelectBuilder
- func (b SelectBuilder) JoinLateral(from FromExp) JoinSelectBuilder
- func (b SelectBuilder) LeftJoin(from FromExp) JoinSelectBuilder
- func (b SelectBuilder) LeftJoinLateral(from FromExp) JoinSelectBuilder
- func (b SelectBuilder) Limit(exp Exp) SelectBuilder
- func (b SelectBuilder) Offset(exp Exp) SelectBuilder
- func (b SelectBuilder) OrderBy(exp Exp) OrderBySelectBuilder
- func (b SelectBuilder) RightJoin(from FromExp) JoinSelectBuilder
- func (b SelectBuilder) Select(exps ...Exp) SelectSelectBuilder
- func (b SelectBuilder) SelectJson(apply func(obj JsonBuildObjectBuilder) JsonBuildObjectBuilder) SelectJsonSelectBuilder
- func (b SelectBuilder) Union() CombinationBuilder
- func (b SelectBuilder) Where(cond Exp) SelectBuilder
- func (b SelectBuilder) With(queryName string) WithBuilder
- func (b SelectBuilder) WithRecursive(queryName string) WithBuilder
- func (b SelectBuilder) WriteSQL(sb *SQLBuilder)
- type SelectDistinctBuilder
- type SelectJsonSelectBuilder
- type SelectSelectBuilder
- type UpdateBuilder
- type WithBuilder
- type WithQuery
- type WithSearchBuilder
- type WithSearchByBuilder
- type WithSelectBuilder
Constants ¶
This section is empty.
Variables ¶
var ErrFromItemLateralAndOnly = errors.New("cannot specify both LATERAL and ONLY")
var ErrInvalidIdentifier = errors.New("invalid identifier")
var ErrNoConditionsGiven = errors.New("no conditions given")
Functions ¶
This section is empty.
Types ¶
type AggExpBuilder ¶
type AggExpBuilder struct {
ExpBase
// contains filtered or unexported fields
}
func Agg ¶
func Agg(name string, exps []Exp) AggExpBuilder
func (AggExpBuilder) Distinct ¶
func (b AggExpBuilder) Distinct() AggExpBuilder
func (AggExpBuilder) Filter ¶
func (b AggExpBuilder) Filter(cond Exp) AggExpBuilder
Filter adds a filter to the aggregate function. Multiple calls to Filter are joined with AND.
func (AggExpBuilder) IsExp ¶
func (b AggExpBuilder) IsExp()
func (AggExpBuilder) OrderBy ¶
func (b AggExpBuilder) OrderBy(exp Exp) OrderByAggExpBuilder
OrderBy adds an ORDER BY clause to the aggregate function. If AggExpBuilder.WithinGroup is called, the ORDER BY clause is used after the aggregate function in WITHIN GROUP.
func (AggExpBuilder) WithinGroup ¶
func (b AggExpBuilder) WithinGroup() AggExpBuilder
WithinGroup adds a WITHIN GROUP order by clause after the aggregate function. Sort arguments are added via AggExpBuilder.OrderBy.
func (AggExpBuilder) WriteSQL ¶
func (b AggExpBuilder) WriteSQL(sb *SQLBuilder)
type CaseBuilder ¶
type CaseBuilder struct {
// contains filtered or unexported fields
}
func Case ¶
func Case(exp ...Exp) CaseBuilder
func (CaseBuilder) Else ¶
func (b CaseBuilder) Else(result Exp) CaseBuilder
func (CaseBuilder) End ¶
func (b CaseBuilder) End() CaseExp
func (CaseBuilder) When ¶
func (b CaseBuilder) When(condition Exp) CaseWhenBuilder
type CaseExp ¶
type CaseExp struct {
ExpBase
// contains filtered or unexported fields
}
func (CaseExp) WriteSQL ¶
func (c CaseExp) WriteSQL(sb *SQLBuilder)
type CaseWhenBuilder ¶
type CaseWhenBuilder struct {
// contains filtered or unexported fields
}
func (CaseWhenBuilder) Then ¶
func (c CaseWhenBuilder) Then(result Exp) CaseBuilder
type CombinationBuilder ¶
type CombinationBuilder struct {
SelectBuilder
}
func (CombinationBuilder) All ¶
func (b CombinationBuilder) All() CombinationBuilder
type DeleteBuilder ¶
type DeleteBuilder struct {
// contains filtered or unexported fields
}
func DeleteFrom ¶
func DeleteFrom(tableName string) DeleteBuilder
func (DeleteBuilder) As ¶
func (b DeleteBuilder) As(alias string) DeleteBuilder
func (DeleteBuilder) Where ¶
func (b DeleteBuilder) Where(cond Exp) DeleteBuilder
Where adds a WHERE condition to the delete. Multiple calls to Where are joined with AND.
func (DeleteBuilder) WriteSQL ¶
func (b DeleteBuilder) WriteSQL(sb *SQLBuilder)
type Exp ¶
type Exp interface {
IsExp()
SQLWriter
}
func Arg ¶
Arg creates an expression that represents an argument that will be bound to a placeholder with the given value. Each call to Arg will create a new placeholder and emit the argument when writing the query.
type ExpBase ¶
type ExpBase struct {
Exp
}
ExpBase is a base type for expressions to allow embedding of various default operators.
func (ExpBase) ILike ¶
func (b ExpBase) ILike(rgt Exp) MatchingBuilder
func (ExpBase) JsonContainedBy ¶
func (ExpBase) JsonContains ¶
func (ExpBase) JsonExtract ¶
JsonExtract builds the -> operator for json / jsonb.
json -> text → json jsonb -> text → jsonb
Extracts JSON object field with the given key.
json -> integer → json jsonb -> integer → jsonb
Extracts nth element of JSON array (array elements are indexed from zero, but negative integers count from the end).
func (ExpBase) JsonExtractPath ¶
JsonExtractPath builds the #> operator for json / jsonb.
json #> text[] → json jsonb #> text[] → jsonb
Extracts JSON sub-object at the specified path, where path elements can be either field keys or array indexes.
Example:
fn.JsonExtractPath(qrb.String(`{"a": {"b": ["foo","bar"]}}`).Cast("jsonb"), qrb.Array(qrb.String("a"), qrb.String("b")))
func (ExpBase) JsonExtractPathText ¶
JsonExtractPathText builds the #>> operator for json / jsonb.
json #>> text[] → text jsonb #>> text[] → text
Extracts JSON sub-object at the specified path as text.
Example:
fn.JsonExtractPathText(qrb.String(`{"a": {"b": ["foo","bar"]}}`).Cast("jsonb"), qrb.Array(qrb.String("a"), qrb.String("b"), qrb.String("1)))
func (ExpBase) JsonExtractText ¶
JsonExtractText builds the ->> operator for json / jsonb.
json ->> text → text jsonb ->> text → text
Extracts JSON object field with the given key, as text.
json ->> integer → text jsonb ->> integer → text
Extracts nth element of JSON array, as text.
func (ExpBase) Like ¶
func (b ExpBase) Like(rgt Exp) MatchingBuilder
func (ExpBase) NotILike ¶
func (b ExpBase) NotILike(rgt Exp) MatchingBuilder
func (ExpBase) NotLike ¶
func (b ExpBase) NotLike(rgt Exp) MatchingBuilder
func (ExpBase) NotSimilarTo ¶
func (b ExpBase) NotSimilarTo(rgt Exp) MatchingBuilder
func (ExpBase) SimilarTo ¶
func (b ExpBase) SimilarTo(rgt Exp) MatchingBuilder
type FromExp ¶
type FromExp interface {
SQLWriter // We do not actually use Exp here, since this cannot appear anywhere outside the FROM clause.
// contains filtered or unexported methods
}
type FromLateralExp ¶
type FromLateralExp interface {
FromExp
// contains filtered or unexported methods
}
type FromSelectBuilder ¶
type FromSelectBuilder struct {
SelectBuilder
}
func (FromSelectBuilder) As ¶
func (b FromSelectBuilder) As(alias string) FromSelectBuilder
As sets the alias for the last added from item.
func (FromSelectBuilder) ColumnAliases ¶
func (b FromSelectBuilder) ColumnAliases(aliases ...string) FromSelectBuilder
ColumnAliases sets the column aliases for the last added from item.
type FuncBuilder ¶
type FuncBuilder struct {
ExpBase
// contains filtered or unexported fields
}
func Func ¶
func Func(name string, args ...Exp) FuncBuilder
func (FuncBuilder) As ¶
func (f FuncBuilder) As(alias string) FuncBuilder
func (FuncBuilder) ColumnDefinition ¶
func (f FuncBuilder) ColumnDefinition(name, typ string) FuncBuilder
ColumnDefinition adds a column definition to the function call. To add multiple column definitions, call this method multiple times.
func (FuncBuilder) IsExp ¶
func (f FuncBuilder) IsExp()
func (FuncBuilder) WithOrdinality ¶
func (f FuncBuilder) WithOrdinality() FuncBuilder
func (FuncBuilder) WriteSQL ¶
func (f FuncBuilder) WriteSQL(sb *SQLBuilder)
type FuncExp ¶
type FuncExp struct {
ExpBase
// contains filtered or unexported fields
}
func (FuncExp) WriteSQL ¶
func (c FuncExp) WriteSQL(sb *SQLBuilder)
type GroupyBySelectBuilder ¶
type GroupyBySelectBuilder struct {
SelectBuilder
}
func (GroupyBySelectBuilder) Cube ¶
func (b GroupyBySelectBuilder) Cube(sets ...[]Exp) GroupyBySelectBuilder
Cube adds a CUBE grouping element for the given expression sets to the GROUP BY clause.
func (GroupyBySelectBuilder) Distinct ¶
func (b GroupyBySelectBuilder) Distinct() GroupyBySelectBuilder
Distinct adds the DISTINCT keyword to the GROUP BY clause.
func (GroupyBySelectBuilder) Empty ¶
func (b GroupyBySelectBuilder) Empty() GroupyBySelectBuilder
Empty adds an empty grouping element to the GROUP BY clause.
func (GroupyBySelectBuilder) GroupingSets ¶
func (b GroupyBySelectBuilder) GroupingSets(sets ...[]Exp) GroupyBySelectBuilder
GroupingSets adds a GROUPING SETS grouping element for the given expression sets to the GROUP BY clause.
func (GroupyBySelectBuilder) Rollup ¶
func (b GroupyBySelectBuilder) Rollup(sets ...[]Exp) GroupyBySelectBuilder
Rollup adds a ROLLUP grouping element for the given expression sets to the GROUP BY clause.
type IdentExp ¶
type IdentExp struct {
ExpBase
// contains filtered or unexported fields
}
func N ¶
N writes the given name / identifier.
It will validate the identifier when writing the query, but it will not detect all invalid identifiers that are invalid in PostgreSQL (especially considering reserved keywords).
func (IdentExp) WriteSQL ¶
func (i IdentExp) WriteSQL(sb *SQLBuilder)
type InsertBuilder ¶
type InsertBuilder struct {
// contains filtered or unexported fields
}
func InsertInto ¶
func InsertInto(tableName string) InsertBuilder
func (InsertBuilder) As ¶
func (b InsertBuilder) As(alias string) InsertBuilder
func (InsertBuilder) ColumnNames ¶
func (b InsertBuilder) ColumnNames(columnName string, rest ...string) InsertBuilder
func (InsertBuilder) SetMap ¶
func (b InsertBuilder) SetMap(m map[string]any) InsertBuilder
SetMap sets the column names and values to insert from the given map. It overwrites any previous column names and values.
func (InsertBuilder) Values ¶
func (b InsertBuilder) Values(values ...Exp) InsertBuilder
Values appends the given values to insert. It can be called multiple times to insert multiple rows.
func (InsertBuilder) WriteSQL ¶
func (b InsertBuilder) WriteSQL(sb *SQLBuilder)
type JoinSelectBuilder ¶
type JoinSelectBuilder struct {
SelectBuilder
}
func (JoinSelectBuilder) As ¶
func (b JoinSelectBuilder) As(alias string) JoinSelectBuilder
func (JoinSelectBuilder) On ¶
func (b JoinSelectBuilder) On(cond Exp, rest ...Exp) SelectBuilder
func (JoinSelectBuilder) Using ¶
func (b JoinSelectBuilder) Using(columns ...string) SelectBuilder
type JsonBuildObjectBuilder ¶
type JsonBuildObjectBuilder struct {
// contains filtered or unexported fields
}
func JsonBuildObject ¶
func JsonBuildObject() JsonBuildObjectBuilder
func (JsonBuildObjectBuilder) IsExp ¶
func (b JsonBuildObjectBuilder) IsExp()
func (JsonBuildObjectBuilder) Prop ¶
func (b JsonBuildObjectBuilder) Prop(key string, value Exp) JsonBuildObjectBuilder
func (JsonBuildObjectBuilder) PropIf ¶
func (b JsonBuildObjectBuilder) PropIf(condition bool, key string, value Exp) JsonBuildObjectBuilder
func (JsonBuildObjectBuilder) Start ¶
func (b JsonBuildObjectBuilder) Start() *JsonBuildObjectBuilderBuilder
func (JsonBuildObjectBuilder) Unset ¶
func (b JsonBuildObjectBuilder) Unset(key string) JsonBuildObjectBuilder
func (JsonBuildObjectBuilder) WriteSQL ¶
func (b JsonBuildObjectBuilder) WriteSQL(sb *SQLBuilder)
type JsonBuildObjectBuilderBuilder ¶
type JsonBuildObjectBuilderBuilder struct {
// contains filtered or unexported fields
}
func (*JsonBuildObjectBuilderBuilder) End ¶
func (bb *JsonBuildObjectBuilderBuilder) End() JsonBuildObjectBuilder
func (*JsonBuildObjectBuilderBuilder) Prop ¶
func (bb *JsonBuildObjectBuilderBuilder) Prop(key string, value Exp) *JsonBuildObjectBuilderBuilder
func (*JsonBuildObjectBuilderBuilder) PropIf ¶
func (bb *JsonBuildObjectBuilderBuilder) PropIf(condition bool, key string, value Exp) *JsonBuildObjectBuilderBuilder
type MatchingBuilder ¶
type MatchingBuilder interface {
Exp
Escape(escapeCharacter rune) MatchingBuilder
}
type Operator ¶
type Operator string
const ( OpAdd Operator = "+" OpSub Operator = "-" OpMul Operator = "*" OpDiv Operator = "/" // OpRegexpMatch matches a string with a POSIX regular expression pattern, case-sensitive. OpRegexpMatch Operator = "~" // OpRegexpIMatch matches a string with a POSIX regular expression pattern, case-insensitive. OpRegexpIMatch Operator = "~*" // OpRegexpNotMatch does not match a string with a POSIX regular expression pattern, case-sensitive. OpRegexpNotMatch Operator = "!~" // OpRegexpINotMatch does not match a string with a POSIX regular expression pattern, case-insensitive. OpRegexpINotMatch Operator = "!~*" )
type OrderByAggExpBuilder ¶
type OrderByAggExpBuilder struct {
AggExpBuilder
}
func (OrderByAggExpBuilder) Asc ¶
func (b OrderByAggExpBuilder) Asc() OrderByAggExpBuilder
func (OrderByAggExpBuilder) Desc ¶
func (b OrderByAggExpBuilder) Desc() OrderByAggExpBuilder
func (OrderByAggExpBuilder) NullsFirst ¶
func (b OrderByAggExpBuilder) NullsFirst() OrderByAggExpBuilder
func (OrderByAggExpBuilder) NullsLast ¶
func (b OrderByAggExpBuilder) NullsLast() OrderByAggExpBuilder
type OrderBySelectBuilder ¶
type OrderBySelectBuilder struct {
SelectBuilder
}
func (OrderBySelectBuilder) Asc ¶
func (b OrderBySelectBuilder) Asc() OrderBySelectBuilder
func (OrderBySelectBuilder) Desc ¶
func (b OrderBySelectBuilder) Desc() OrderBySelectBuilder
func (OrderBySelectBuilder) NullsFirst ¶
func (b OrderBySelectBuilder) NullsFirst() OrderBySelectBuilder
func (OrderBySelectBuilder) NullsLast ¶
func (b OrderBySelectBuilder) NullsLast() OrderBySelectBuilder
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func Build ¶
func Build(builder SQLWriter) *QueryBuilder
Build starts a new query builder based on the given SQLWriter. For executing the query, use qrbpgx.Build or qrbsql.Build which can set an executor specific to a driver.
func (*QueryBuilder) WithNamedArgs ¶
func (b *QueryBuilder) WithNamedArgs(args map[string]any) *QueryBuilder
func (*QueryBuilder) WithoutValidation ¶
func (b *QueryBuilder) WithoutValidation() *QueryBuilder
WithoutValidation disables validation of the query while building.
Errors might still occur when building the query, but no additional validation (like validating identifiers) will be performed.
type RowsFromBuilder ¶
type RowsFromBuilder struct {
// contains filtered or unexported fields
}
func NewRowsFromBuilder ¶
func NewRowsFromBuilder(fns ...FuncBuilder) RowsFromBuilder
func (RowsFromBuilder) WithOrdinality ¶
func (r RowsFromBuilder) WithOrdinality() RowsFromBuilder
func (RowsFromBuilder) WriteSQL ¶
func (r RowsFromBuilder) WriteSQL(sb *SQLBuilder)
type SQLBuilder ¶
type SQLBuilder struct {
// contains filtered or unexported fields
}
func (*SQLBuilder) AddError ¶
func (b *SQLBuilder) AddError(err error)
func (*SQLBuilder) BindPlaceholder ¶
func (b *SQLBuilder) BindPlaceholder(name string) string
func (*SQLBuilder) CreatePlaceholder ¶
func (b *SQLBuilder) CreatePlaceholder(argument any) string
func (*SQLBuilder) Validating ¶
func (b *SQLBuilder) Validating() bool
func (*SQLBuilder) WriteRune ¶
func (b *SQLBuilder) WriteRune(r rune)
func (*SQLBuilder) WriteString ¶
func (b *SQLBuilder) WriteString(s string)
type SQLWriter ¶
type SQLWriter interface {
WriteSQL(sb *SQLBuilder)
}
type SelectBuilder ¶
type SelectBuilder struct {
// contains filtered or unexported fields
}
func (SelectBuilder) ApplyIf ¶
func (b SelectBuilder) ApplyIf(cond bool, f func(q SelectBuilder) SelectBuilder) SelectBuilder
ApplyIf applies the given function to the builder if the condition is true. It returns the builder itself if the condition is false, otherwise it returns the result of the function. It' especially helpful for building a query conditionally.
func (SelectBuilder) Except ¶
func (b SelectBuilder) Except() CombinationBuilder
func (SelectBuilder) From ¶
func (b SelectBuilder) From(from FromExp) FromSelectBuilder
func (SelectBuilder) FromLateral ¶
func (b SelectBuilder) FromLateral(from FromLateralExp) FromSelectBuilder
func (SelectBuilder) FromOnly ¶
func (b SelectBuilder) FromOnly(from FromExp) FromSelectBuilder
func (SelectBuilder) FullJoin ¶
func (b SelectBuilder) FullJoin(from FromExp) JoinSelectBuilder
func (SelectBuilder) GroupBy ¶
func (b SelectBuilder) GroupBy(exps ...Exp) GroupyBySelectBuilder
GroupBy adds a grouping element for the given expressions to the GROUP BY clause. If no expressions are given, special grouping elements can be added via GroupyBySelectBuilder. Use GroupyBySelectBuilder.Empty to add an empty grouping element.
func (SelectBuilder) Having ¶
func (b SelectBuilder) Having(cond Exp) SelectBuilder
Having adds a HAVING condition to the query. Multiple calls to Having are joined with AND.
func (SelectBuilder) Intersect ¶
func (b SelectBuilder) Intersect() CombinationBuilder
func (SelectBuilder) IsExp ¶
func (b SelectBuilder) IsExp()
func (SelectBuilder) Join ¶
func (b SelectBuilder) Join(from FromExp) JoinSelectBuilder
func (SelectBuilder) JoinLateral ¶
func (b SelectBuilder) JoinLateral(from FromExp) JoinSelectBuilder
func (SelectBuilder) LeftJoin ¶
func (b SelectBuilder) LeftJoin(from FromExp) JoinSelectBuilder
func (SelectBuilder) LeftJoinLateral ¶
func (b SelectBuilder) LeftJoinLateral(from FromExp) JoinSelectBuilder
func (SelectBuilder) Limit ¶
func (b SelectBuilder) Limit(exp Exp) SelectBuilder
func (SelectBuilder) Offset ¶
func (b SelectBuilder) Offset(exp Exp) SelectBuilder
func (SelectBuilder) OrderBy ¶
func (b SelectBuilder) OrderBy(exp Exp) OrderBySelectBuilder
func (SelectBuilder) RightJoin ¶
func (b SelectBuilder) RightJoin(from FromExp) JoinSelectBuilder
func (SelectBuilder) Select ¶
func (b SelectBuilder) Select(exps ...Exp) SelectSelectBuilder
Select adds the given expressions to the select list.
func (SelectBuilder) SelectJson ¶
func (b SelectBuilder) SelectJson(apply func(obj JsonBuildObjectBuilder) JsonBuildObjectBuilder) SelectJsonSelectBuilder
SelectJson sets the JSON selection for this builder.
Any additional selections are added after the JSON selection. The JSON selection can be modified by SelectBuilder.SelectJson.
func (SelectBuilder) Union ¶
func (b SelectBuilder) Union() CombinationBuilder
func (SelectBuilder) Where ¶
func (b SelectBuilder) Where(cond Exp) SelectBuilder
Where adds a WHERE condition to the query. Multiple calls to Where are joined with AND.
func (SelectBuilder) With ¶
func (b SelectBuilder) With(queryName string) WithBuilder
With adds a WITH query to the select builder. The actual query must be supplied via WithBuilder.As.
func (SelectBuilder) WithRecursive ¶
func (b SelectBuilder) WithRecursive(queryName string) WithBuilder
WithRecursive adds a WITH RECURSIVE query to the select builder. The actual query must be supplied via WithBuilder.As.
func (SelectBuilder) WriteSQL ¶
func (b SelectBuilder) WriteSQL(sb *SQLBuilder)
WriteSQL writes the select as an expression.
type SelectDistinctBuilder ¶
type SelectDistinctBuilder struct {
SelectBuilder
}
func (SelectDistinctBuilder) On ¶
func (b SelectDistinctBuilder) On(exp Exp, exps ...Exp) SelectBuilder
type SelectJsonSelectBuilder ¶
type SelectJsonSelectBuilder struct {
SelectBuilder
}
func (SelectJsonSelectBuilder) As ¶
func (b SelectJsonSelectBuilder) As(alias string) SelectJsonSelectBuilder
type SelectSelectBuilder ¶
type SelectSelectBuilder struct {
SelectBuilder
}
func (SelectSelectBuilder) As ¶
func (b SelectSelectBuilder) As(alias string) SelectSelectBuilder
func (SelectSelectBuilder) Distinct ¶
func (b SelectSelectBuilder) Distinct() SelectDistinctBuilder
type UpdateBuilder ¶
type UpdateBuilder struct {
// contains filtered or unexported fields
}
func Update ¶
func Update(tableName string) UpdateBuilder
func (UpdateBuilder) As ¶
func (b UpdateBuilder) As(alias string) UpdateBuilder
func (UpdateBuilder) Set ¶
func (b UpdateBuilder) Set(columnName string, value Exp) UpdateBuilder
func (UpdateBuilder) SetMap ¶
func (b UpdateBuilder) SetMap(m map[string]any) UpdateBuilder
SetMap sets the items in the set clause to the given map. It overwrites any previous set clause items.
func (UpdateBuilder) Where ¶
func (b UpdateBuilder) Where(cond Exp) UpdateBuilder
Where adds a WHERE condition to the update. Multiple calls to Where are joined with AND.
func (UpdateBuilder) WriteSQL ¶
func (b UpdateBuilder) WriteSQL(sb *SQLBuilder)
type WithBuilder ¶
type WithBuilder struct {
// contains filtered or unexported fields
}
WithBuilder starts building a WITH query.
func (WithBuilder) As ¶
func (b WithBuilder) As(builder WithQuery) WithSelectBuilder
func (WithBuilder) AsMaterialized ¶
func (b WithBuilder) AsMaterialized(builder WithQuery) WithSelectBuilder
func (WithBuilder) AsNotMaterialized ¶
func (b WithBuilder) AsNotMaterialized(builder WithQuery) WithSelectBuilder
func (WithBuilder) ColumnNames ¶
func (b WithBuilder) ColumnNames(names ...string) WithBuilder
ColumnNames sets the column names for the current WITH query.
type WithSearchBuilder ¶
type WithSearchBuilder struct {
// contains filtered or unexported fields
}
func (WithSearchBuilder) By ¶
func (b WithSearchBuilder) By(columnName Exp, columnNames ...Exp) WithSearchByBuilder
type WithSearchByBuilder ¶
type WithSearchByBuilder struct {
// contains filtered or unexported fields
}
func (WithSearchByBuilder) Set ¶
func (b WithSearchByBuilder) Set(searchColumnName string) WithSelectBuilder
type WithSelectBuilder ¶
type WithSelectBuilder struct {
SelectBuilder
}
WithSelectBuilder is a SelectBuilder and can refer to the latest WITH query.
func (WithSelectBuilder) SearchBreadthFirst ¶
func (b WithSelectBuilder) SearchBreadthFirst() WithSearchBuilder
func (WithSelectBuilder) SearchDepthFirst ¶
func (b WithSelectBuilder) SearchDepthFirst() WithSearchBuilder
Source Files
¶
- agg_exp.go
- args.go
- delete_builder.go
- exp.go
- func_builder.go
- functions.go
- functions_conditional.go
- functions_matching.go
- helper.go
- ident.go
- immutable_map.go
- immutable_slice_map.go
- insert_builder.go
- json_build_object.go
- literals.go
- op.go
- op_json.go
- order_by.go
- query_builder.go
- select_builder.go
- sql_writer.go
- update_builder.go