Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is the basic container for injecting query builder configurations.
All the Query structs can also be called directly without this builder, but we kept it here for convenience.
type Insert ¶
type Insert struct {
// Into expects a table name, e.g. "users"
Into string
// Data expected either a single record annotated with `ksql` tags
// or a list of records annotated likewise.
Data interface{}
}
Insert is the struct template for building INSERT queries
type OrderByQuery ¶
type OrderByQuery struct {
// contains filtered or unexported fields
}
OrderByQuery represents the ORDER BY part of the query
func OrderBy ¶
func OrderBy(fields string) OrderByQuery
OrderBy is a helper for building the ORDER BY part of the query.
func (OrderByQuery) Desc ¶
func (o OrderByQuery) Desc() OrderByQuery
Desc is a setter function for configuring the ORDER BY part of the query as DESC
type Query ¶
type Query struct {
// Select expects either a struct using the `ksql` tags
// or a string listing the column names using SQL syntax,
// e.g.: `id, username, address`
Select interface{}
// From expects the FROM clause from an SQL query, e.g. `users JOIN posts USING(post_id)`
From string
// Where expects a list of WhereQuery instances built
// by the public Where() function.
Where WhereQueries
Limit int
Offset int
OrderBy OrderByQuery
}
Query is is the struct template for building SELECT queries.
type WhereQueries ¶
type WhereQueries []WhereQuery
WhereQueries is the helper for creating complex WHERE queries in a dynamic way.
func Where ¶
func Where(cond string, params ...interface{}) WhereQueries
Where adds a new boolean condition to an existing WhereQueries helper.
func WhereIf ¶
func WhereIf(cond string, param interface{}) WhereQueries
WhereIf conditionally adds a new boolean expression to the WhereQueries helper
func (WhereQueries) Where ¶
func (w WhereQueries) Where(cond string, params ...interface{}) WhereQueries
Where adds a new boolean condition to an existing WhereQueries helper.
func (WhereQueries) WhereIf ¶
func (w WhereQueries) WhereIf(cond string, param interface{}) WhereQueries
WhereIf conditionally adds a new boolean expression to the WhereQueries helper.
type WhereQuery ¶
type WhereQuery struct {
// contains filtered or unexported fields
}
WhereQuery represents a single condition in a WHERE expression.