chain

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NullValue represents the NULL value in SQL
	NullValue = "NULL"
	// CurrentTimestampPGFn is the name of the function of postgres that returns current
	// timestamp with tz.
	CurrentTimestampPGFn = "CURRENT_TIMESTAMP"
)
View Source
const (
	// SQLNothing is the default value for an SQLBool
	SQLNothing sqlBool = ""
	// SQLAnd represents AND in SQL
	SQLAnd sqlBool = "AND"
	// SQLOr represents OR in SQL
	SQLOr sqlBool = "OR"
	// SQLNot represents NOT in SQL
	SQLNot sqlBool = "NOT"
	// SQLAndNot Negates the expression after AND
	SQLAndNot sqlBool = "AND NOT"
	// SQLOrNot Neates the expression after OR
	SQLOrNot sqlBool = "OR NOT"
)
View Source
const (
	// SQLAll is a modifier that can be append to UNION, INTERSECT and EXCEPT
	SQLAll sqlModifier = "ALL"
	// SQLForUpdate is a modifier that can be append to select to lock a row to a given transaction.
	SQLForUpdate sqlModifier = "FOR UPDATE"
)

Variables

This section is empty.

Functions

func AVG

func AVG(column string) string

AVG Renders SQL AVG of the expression in column

func AndConditions

func AndConditions(conditions ...string) string

AndConditions returns a list of conditions separated by AND

func As

func As(field, alias string) string

As is a convenience function to define column alias in go in order to be a bit less error prone and more go semantic.

func COUNT

func COUNT(column string) string

COUNT Renders SQL COUNT of the expression in column

func ColumnGroup

func ColumnGroup(columns ...string) string

ColumnGroup returns a list of columns, comma separated and between parenthesis.

func CompareExpressions

func CompareExpressions(operator CompOperator, columnLeft, columnRight string) string

CompareExpressions returns a comparison between two SQL expressions using operator

func Constraint

func Constraint(constraint string) string

Constraint wraps the passed constraint name with the required SQL to use it.

func Distinct

func Distinct(field string) string

Distinct allows selection of distinct results only.

func Equals

func Equals(field string) string

Equals is a convenience function to enable use of go for where definitions

func ExpandArgs

func ExpandArgs(args []interface{}, querySegment string) (string, []interface{})

ExpandArgs will unravel a slice of arguments, converting slices into individual items to determine if an item needs unraveling it uses the placeholders (? marks) for the future positional arguments in a query segment.

func GreaterOrEqualThan

func GreaterOrEqualThan(field string) string

GreaterOrEqualThan is a convenience function to enable use of go for where definitions

func GreaterThan

func GreaterThan(field string) string

GreaterThan is a convenience function to enable use of go for where definitions

func In

func In(field string, value ...interface{}) (string, []interface{})

In is a convenience function to enable use of go for where definitions

func InSlice

func InSlice(field string, value interface{}) (string, interface{})

InSlice is a convenience function to enable use of go for where definitions and assumes the passed value is already a slice.

func IsNoRows

func IsNoRows(err error) bool

IsNoRows returns true if the passed error is one of the many possibilities of no rows returned by the different libraries.

func LesserOrEqualThan

func LesserOrEqualThan(field string) string

LesserOrEqualThan is a convenience function to enable use of go for where definitions

func LesserThan

func LesserThan(field string) string

LesserThan is a convenience function to enable use of go for where definitions

func Like

func Like(field string) string

Like is a convenience function to enable use of go for where definitions

func MAX

func MAX(column string) string

MAX Renders SQL MAX of the expression in column

func MIN

func MIN(column string) string

MIN Renders SQL MIN of the expression in column

func MarksToPlaceholders

func MarksToPlaceholders(q string, args []interface{}) (string, []interface{}, error)

MarksToPlaceholders replaces `?` in the query with `$1` style placeholders, this must be done with a finished query and requires the args as they depend on the position of the already rendered query, it does some consistency control and finally expands `(?)`.

func NillableInt64

func NillableInt64(i *int64) int64

NillableInt64 returns a safely dereferenced int64 from it's pointer.

func NillableString

func NillableString(s *string) string

NillableString returns a safely dereferenced string from it's pointer.

func NotEquals

func NotEquals(field string) string

NotEquals is a convenience function to enable use of go for where definitions

func NotLike

func NotLike(field string) string

NotLike is a convenience function to enable use of go for where definitions

func NotNull

func NotNull(field string) string

NotNull is a convenience function to enable use of go for where definitions

func Null

func Null(field string) string

Null is a convenience function to enable use of go for where definitions

func OrConditions

func OrConditions(conditions ...string) string

OrConditions returns a list of conditions separated by OR

func PlaceholdersToPositional

func PlaceholdersToPositional(q *strings.Builder, argCount int) (*strings.Builder, int, error)

PlaceholdersToPositional converts ? in a query into $<argument number> which postgres expects

func SUM

func SUM(column string) string

SUM Renders SQL SUM of the expression in column

func SetToCurrentTimestamp

func SetToCurrentTimestamp(field string) string

SetToCurrentTimestamp crafts a postgres SQL assignment of the field to the current timestamp with timezone.

func SimpleFunction

func SimpleFunction(fName, params string) string

SimpleFunction returns the rendered fName invocation passing params as argument

func TablePrefix

func TablePrefix(n string) func(string) string

TablePrefix returns a function that prefixes column names with the passed table name.

Types

type CompOperator

type CompOperator string

CompOperator represents a possible operator to compare two SQL expressions

var (
	// Eq is the = operand
	Eq CompOperator = "="
	// Neq is the != operand
	Neq CompOperator = "!="
	// Gt is the > operand
	Gt CompOperator = ">"
	// GtE is the >= operand
	GtE CompOperator = ">="
	// Lt is the < operand
	Lt CompOperator = "<"
	// LtE is the <= operand
	LtE CompOperator = "<="
	// Lk is the LIKE operand
	Lk CompOperator = "LIKE"
	// NLk is the NOT LIKE operand
	NLk CompOperator = "NOT LIKE"
)

type ExpressionChain

type ExpressionChain struct {
	// contains filtered or unexported fields
}

ExpressionChain holds all the atoms for the SQL expressions that make a query and allows to chain more assuming the chaining is valid.

func New

func New(db connection.DB) *ExpressionChain

New returns a new instance of ExpressionChain hooked to the passed DB

func NewExpressionChain

func NewExpressionChain(db connection.DB) *ExpressionChain

NewExpressionChain returns a new instance of ExpressionChain hooked to the passed DB Deprecated: please use New instead

func NewNoDB

func NewNoDB() *ExpressionChain

NewNoDB creates an expression chain without the db, mostly with the purpose of making a more abbreviated syntax for transient ExpressionChains such as CTE or sub-query ones.

func (*ExpressionChain) AddUnionFromChain

func (ec *ExpressionChain) AddUnionFromChain(union *ExpressionChain, all bool) (*ExpressionChain, error)

AddUnionFromChain renders the passed chain and adds it to the current one as a Union returned ExpressionChain pointer is of current chain modified.

func (*ExpressionChain) AndHaving

func (ec *ExpressionChain) AndHaving(expr string, args ...interface{}) *ExpressionChain

AndHaving adds a 'HAVING' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) AndWhere

func (ec *ExpressionChain) AndWhere(expr string, args ...interface{}) *ExpressionChain

AndWhere adds a 'AND WHERE' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) AndWhereGroup

func (ec *ExpressionChain) AndWhereGroup(c *ExpressionChain) *ExpressionChain

AndWhereGroup adds an AND ( a = b AND/OR c = d...) basically a group of conditions preceded by AND unless it's the first condition then just the group. It takes an expression chain as a parameter which does not need an DB or any other expression other than WHEREs `NewNoDB().AndWhere(...).OrWhere(...)` THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) Clone

func (ec *ExpressionChain) Clone() *ExpressionChain

Clone returns a copy of the ExpressionChain

func (*ExpressionChain) DB

func (ec *ExpressionChain) DB() connection.DB

DB returns the chain DB

func (*ExpressionChain) Delete

func (ec *ExpressionChain) Delete() *ExpressionChain

Delete determines a deletion will be made with the results of the query.

func (*ExpressionChain) Exec

func (ec *ExpressionChain) Exec(ctx context.Context) (execError error)

Exec executes the chain, works for Insert and Update

func (*ExpressionChain) ExecResult

func (ec *ExpressionChain) ExecResult(ctx context.Context) (rowsAffected int64, execError error)

ExecResult executes the chain and returns rows affected info, works for Insert and Update

func (*ExpressionChain) Fetch

func (ec *ExpressionChain) Fetch(ctx context.Context, receiver interface{}) error

Fetch is a one step version of the Query->fetch typical workflow.

func (*ExpressionChain) FetchIntoPrimitive

func (ec *ExpressionChain) FetchIntoPrimitive(ctx context.Context, receiver interface{}) error

FetchIntoPrimitive is a one step version of the QueryPrimitive->fetch typical workflow.

func (*ExpressionChain) ForUpdate

func (ec *ExpressionChain) ForUpdate() *ExpressionChain

ForUpdate appends `FOR UPDATE` to a SQL SELECT

func (*ExpressionChain) From

func (ec *ExpressionChain) From(table string) *ExpressionChain

From sets the table to be used in the `FROM` expression. Functionally this is identical to `Table()`, but it makes code more readable in some circumstances. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) FromUpdate

func (ec *ExpressionChain) FromUpdate(expr string, args ...interface{}) *ExpressionChain

FromUpdate adds a special case of from, for UPDATE where FROM is used as JOIN

func (*ExpressionChain) FullJoin

func (ec *ExpressionChain) FullJoin(expr, on string, args ...interface{}) *ExpressionChain

FullJoin adds a 'FULL JOIN' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) GroupBy

func (ec *ExpressionChain) GroupBy(expr string, args ...interface{}) *ExpressionChain

GroupBy adds a 'GROUP BY' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) GroupByReplace

func (ec *ExpressionChain) GroupByReplace(expr string, args ...interface{}) *ExpressionChain

GroupByReplace adds a 'GROUP BY' to the 'ExpressionChain' and returns the same chain to facilitate further chaining, this version of group by removes all other group by entries. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) InnerJoin

func (ec *ExpressionChain) InnerJoin(expr, on string, args ...interface{}) *ExpressionChain

InnerJoin adds a 'INNER JOIN' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) Insert

func (ec *ExpressionChain) Insert(insertPairs map[string]interface{}) *ExpressionChain

Insert set fields/values for insertion.

func (*ExpressionChain) InsertMulti

func (ec *ExpressionChain) InsertMulti(insertPairs map[string][]interface{}) (*ExpressionChain, error)

InsertMulti set fields/values for insertion.

func (*ExpressionChain) Join

func (ec *ExpressionChain) Join(expr, on string, args ...interface{}) *ExpressionChain

Join adds a 'JOIN' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) LeftJoin

func (ec *ExpressionChain) LeftJoin(expr, on string, args ...interface{}) *ExpressionChain

LeftJoin adds a 'LEFT JOIN' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) Limit

func (ec *ExpressionChain) Limit(limit int64) *ExpressionChain

Limit adds a 'LIMIT' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) NewDB

NewDB sets the passed db as this chain's db.

func (*ExpressionChain) Offset

func (ec *ExpressionChain) Offset(offset int64) *ExpressionChain

Offset adds a 'OFFSET' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) OnConflict

func (ec *ExpressionChain) OnConflict(clause func(*OnConflict)) *ExpressionChain

OnConflict will add a "ON CONFLICT" clause at the end of the query if the main operation is an INSERT.

func (*ExpressionChain) OrHaving

func (ec *ExpressionChain) OrHaving(expr string, args ...interface{}) *ExpressionChain

OrHaving adds a 'HAVING' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) OrWhere

func (ec *ExpressionChain) OrWhere(expr string, args ...interface{}) *ExpressionChain

OrWhere adds a 'OR WHERE' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) OrWhereGroup

func (ec *ExpressionChain) OrWhereGroup(c *ExpressionChain) *ExpressionChain

OrWhereGroup adds an OR ( a = b AND/OR c = d...) basically a group of conditions preceded by OR unless it's the first condition and there are no ANDs present. It takes an expression chain as a parameter which does not need an DB or any other expression other than WHEREs `NewNoDB().AndWhere(...).OrWhere(...)` THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) OrderBy

func (ec *ExpressionChain) OrderBy(order *OrderByOperator) *ExpressionChain

OrderBy adds a 'ORDER BY' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) Query

Query is a convenience function to run the current chain through the db query with iterator.

func (*ExpressionChain) QueryIter

QueryIter is a convenience function to run the current chain through the db query with iterator.

func (*ExpressionChain) QueryPrimitive

func (ec *ExpressionChain) QueryPrimitive(ctx context.Context) (connection.ResultFetch, error)

QueryPrimitive is a convenience function to run the current chain through the db query.

func (*ExpressionChain) Raw

func (ec *ExpressionChain) Raw(ctx context.Context, fields ...interface{}) error

Raw executes the query and tries to scan the result into fields without much safeguard nor intelligence so you will have to put some of your own

func (*ExpressionChain) Render

func (ec *ExpressionChain) Render() (string, []interface{}, error)

Render returns the SQL expression string and the arguments of said expression, there is no checkig of validity or consistency for the time being.

func (*ExpressionChain) RenderRaw

func (ec *ExpressionChain) RenderRaw() (string, []interface{}, error)

RenderRaw returns the SQL expression string and the arguments of said expression, No positional argument replacement is done.

func (*ExpressionChain) Returning

func (ec *ExpressionChain) Returning(args ...string) *ExpressionChain

Returning will add an "RETURNING" clause at the end of the query if the main operation is an INSERT.

Please note that `Returning` likely doesn't do what you expect. There are systemic issues with dependencies and `go-lang` standard library that prevent it from operating correctly in many scenarios.

func (*ExpressionChain) RightJoin

func (ec *ExpressionChain) RightJoin(expr, on string, args ...interface{}) *ExpressionChain

RightJoin adds a 'RIGHT JOIN' to the 'ExpressionChain' and returns the same chan to facilitate further chaining. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) Select

func (ec *ExpressionChain) Select(fields ...string) *ExpressionChain

Select set fields to be returned by the final query.

func (*ExpressionChain) SelectWithArgs

func (ec *ExpressionChain) SelectWithArgs(fields ...SelectArgument) *ExpressionChain

SelectWithArgs set fields to be returned by the final query.

func (*ExpressionChain) Set

func (ec *ExpressionChain) Set(set string) *ExpressionChain

Set will produce your chain to be run inside a Transaction and used for `SET LOCAL` For the moment this is only used with Exec.

func (*ExpressionChain) SetMinQuerySize

func (ec *ExpressionChain) SetMinQuerySize(size uint64)

SetMinQuerySize will make sure that at least <size> bytes (runes actually) are allocated before rendering to avoid costly resize and copy operations while rendering, use only if you know what you are doing, 0 uses go allocator.

func (*ExpressionChain) String

func (ec *ExpressionChain) String() string

String implements the stringer interface. It is intended to be used for logging/debugging purposes only.

func (*ExpressionChain) Table

func (ec *ExpressionChain) Table(table string) *ExpressionChain

Table sets the table to be used in the 'FROM' expression. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

func (*ExpressionChain) TablePrefixes

func (ec *ExpressionChain) TablePrefixes() *Formatter

TablePrefixes returns the formatter for this expression, if none exists one will be created

func (*ExpressionChain) Union

func (ec *ExpressionChain) Union(unionExpr string, all bool, args ...interface{}) *ExpressionChain

Union adds the passed SQL expression and args as a union to be made on this expression, the change is in place, there are no checks about correctness of the query.

func (*ExpressionChain) Update

func (ec *ExpressionChain) Update(expr string, args ...interface{}) *ExpressionChain

Update set fields/values for updates. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

NOTE: values of `nil` will be treated as `NULL`

func (*ExpressionChain) UpdateMap

func (ec *ExpressionChain) UpdateMap(exprMap map[string]interface{}) *ExpressionChain

UpdateMap set fields/values for updates but does so from a map of key/value. THIS DOES NOT CREATE A COPY OF THE CHAIN, IT MUTATES IN PLACE.

NOTE: values of `nil` will be treated as `NULL`

func (*ExpressionChain) With

func (ec *ExpressionChain) With(name string, cte *ExpressionChain) *ExpressionChain

With adds a CTE to your query (https://www.postgresql.org/docs/11/queries-with.html)

type Formatter

type Formatter struct {
	FormatTable map[string]string
}

Formatter holds a set of key/values for replacements in queries generated by gaum, this is designed around tablename aliases.

func (*Formatter) Add

func (f *Formatter) Add(key, prefix string) bool

Add adds the passed in prefix to the the Formatting table, returns "replaced"

func (*Formatter) Del

func (f *Formatter) Del(key string)

Del removes the passed key, if exists, from the formatting table.

func (*Formatter) List

func (f *Formatter) List() []string

List returns a list of the keys for table prefixes.

type Function

type Function interface {
	// Static adds an argument to the function
	Static(string) Function
	// Parametric adds a placeholder and an argument to the function
	Parametric(interface{}) Function
	// Fn returns the rendered statement and list of arguments.
	Fn() (string, []interface{})
	// FnSelect returns a SelectArgument from this function
	FnSelect() SelectArgument
}

Function represents a SQL function.

func ComplexFunction

func ComplexFunction(name string) Function

ComplexFunction constructs a complexFunction

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group allows to group a set of expressions and run them together in a transaction.

func (*Group) Add

func (cg *Group) Add(ec *ExpressionChain)

Add appends a chain to the group.

func (*Group) Run

func (cg *Group) Run(ctx context.Context) (execError error)

Run runs all the chains in a group in a transaction, for this the db of the first query will be used.

func (*Group) Set

func (cg *Group) Set(set string)

Set will cause `SET LOCAL` to be run with this value before executing items of the group in Run.

type OnConflict

type OnConflict struct {
	// contains filtered or unexported fields
}

OnConflict is chained to build `OnConflict` statements

func (*OnConflict) DoNothing

func (o *OnConflict) DoNothing()

DoNothing terminates the `ON CONFLICT` chain the conflict target is optional for this action.

func (*OnConflict) OnColumn

func (o *OnConflict) OnColumn(args ...string) *OnConflictAction

OnColumn is used to construct `ON CONFLICT ( arg0, arg1, arg2 )`. This allows for build things like `ON COLUMN ( myindex, COLLATE my_other_index )`

func (*OnConflict) OnConstraint

func (o *OnConflict) OnConstraint(arg string) *OnConflictAction

OnConstraint is used to create an `On CONFLICT ON CONSTRAINT $arg` statement

type OnConflictAction

type OnConflictAction struct {
	// contains filtered or unexported fields
}

OnConflictAction is used to limit developer actions

func (*OnConflictAction) DoNothing

func (o *OnConflictAction) DoNothing()

DoNothing terminates the `ON CONFLICT` chain

func (*OnConflictAction) DoUpdate

func (o *OnConflictAction) DoUpdate() *OnUpdate

DoUpdate continues the `ON CONFLICT` chain

type OnUpdate

type OnUpdate struct {
	// contains filtered or unexported fields
}

OnUpdate is used to limit developer actions

func (*OnUpdate) Set

func (o *OnUpdate) Set(args ...interface{}) *OnUpdate

Set Sets a field to a value

func (*OnUpdate) SetDefault

func (o *OnUpdate) SetDefault(column string) *OnUpdate

SetDefault sets a field to a default value. This is useful to build `ON CONFLICT ON CONSTRAINT my_constraint DO UPDATE SET field = DEFAULT`.

func (*OnUpdate) SetNow

func (o *OnUpdate) SetNow(column string) *OnUpdate

SetNow is incrediably useful to set `now()` values. For example: `ON CONFLICT ON CONSTRAINT my_constraint DO UPDATE SET time_value = now()`.

func (*OnUpdate) SetSQL

func (o *OnUpdate) SetSQL(args ...string) *OnUpdate

SetSQL Sets a field to a value that needs no escaping, it is assumed to be SQL valid (an expression or column) and inserts parentheses around both keys and values

func (*OnUpdate) SetSQLNoParens

func (o *OnUpdate) SetSQLNoParens(args ...string) *OnUpdate

SetSQLNoParens Sets a field to a value that needs no escaping, it is assumed to be SQL valid (an expression or column) and doesn't insert any parentheses around either keys or values

func (*OnUpdate) SetSQLRow

func (o *OnUpdate) SetSQLRow(args ...string) *OnUpdate

SetSQLRow Sets a field to a value that needs no escaping, it is assumed to be SQL valid (an expression or column) it will append ROW to the values part because pg 12 updates

func (*OnUpdate) SetSQLWithArgs

func (o *OnUpdate) SetSQLWithArgs(column, sql string, args ...interface{}) *OnUpdate

SetSQLWithArgs sets a field to a value that itself needs no escaping but may contain placeholders, to be filled with the optional args.

This is useful to build tings like `SET foo = foo || 'bar'` with the appropriate escaping.

func (*OnUpdate) Where

func (o *OnUpdate) Where(ec *ExpressionChain)

Where Adds Where condition to an update on conflict, does not return the OnUpdate because it is intended to be the last part of the expression.

type OrderByOperator

type OrderByOperator struct {
	// contains filtered or unexported fields
}

OrderByOperator unifies the `Asc` and `Desc` functions

func Asc

func Asc(columns ...string) *OrderByOperator

Asc declares OrderBy ascending, so least to greatest

func Desc

func Desc(columns ...string) *OrderByOperator

Desc declares OrderBy descending, or greatest to least

func (*OrderByOperator) Asc

func (o *OrderByOperator) Asc(columns ...string) *OrderByOperator

Asc allows for complex chained OrderBy clauses

func (*OrderByOperator) Desc

func (o *OrderByOperator) Desc(columns ...string) *OrderByOperator

Desc allows for complex chained OrderBy clauses

func (*OrderByOperator) String

func (o *OrderByOperator) String() string

String converts the operator to a string

type SelectArgument

type SelectArgument struct {
	Field string

	Args []interface{}
	// contains filtered or unexported fields
}

SelectArgument contains the components of a select column

func (SelectArgument) As

func (s SelectArgument) As(alias string) SelectArgument

As aliases the argument

Jump to

Keyboard shortcuts

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