Documentation
¶
Index ¶
- Constants
- type And
- type BaseDomainObject
- type Between
- type CloseParenthesis
- type CountQuery
- type DeleteQuery
- func (s *DeleteQuery) And(queryParts ...IQueryPart) *DeleteQuery
- func (s *DeleteQuery) Limit(count int) *DeleteQuery
- func (s *DeleteQuery) Or(queryParts ...IQueryPart) *DeleteQuery
- func (s *DeleteQuery) ToSQL() (sql string, args []interface{})
- func (s *DeleteQuery) Where(queryParts ...IQueryPart) *DeleteQuery
- type Distinct
- type DomainObject
- type DomainObjectField
- type Equals
- type FieldList
- type GreaterThan
- type GreaterThanOrEqual
- type IQueryPart
- type In
- type InsertQuery
- type LessThan
- type LessThanOrEqual
- type Limit
- type LimitSimple
- type NotBetween
- type NotEquals
- type NotIn
- type OpenParenthesis
- type Or
- type OrderBy
- type OrderByDir
- type SelectQuery
- func (s *SelectQuery) And(queryParts ...IQueryPart) *SelectQuery
- func (s *SelectQuery) Distinct() *SelectQuery
- func (s *SelectQuery) Limit(offset int, count int) *SelectQuery
- func (s *SelectQuery) Or(queryParts ...IQueryPart) *SelectQuery
- func (s *SelectQuery) OrderBy(fieldName string, orderByDir OrderByDir) *SelectQuery
- func (s *SelectQuery) ToSQL() (sql string, args []interface{})
- func (s *SelectQuery) Where(queryParts ...IQueryPart) *SelectQuery
- type Set
- type UpdateQuery
- func (s *UpdateQuery) And(queryParts ...IQueryPart) *UpdateQuery
- func (s *UpdateQuery) Or(queryParts ...IQueryPart) *UpdateQuery
- func (s *UpdateQuery) Set(fieldName string, value interface{}) *UpdateQuery
- func (s *UpdateQuery) ToSQL() (sql string, args []interface{})
- func (s *UpdateQuery) Where(queryParts ...IQueryPart) *UpdateQuery
- type Values
Constants ¶
const Placeholder string = "?"
Placeholder used for sql arguments
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseDomainObject ¶
type BaseDomainObject struct { FieldList map[string]*DomainObjectField `json:"-"` TableName string `json:"-"` }
BaseDomainObject is the base object inherited by all domain objects Note: These fields include json tags for omission when the inheriting object attempts to marshal (e.g. for a JSON response from an API)
func (*BaseDomainObject) GetFields ¶
func (b *BaseDomainObject) GetFields() map[string]*DomainObjectField
GetFields returns a map of the fields in the domain object
func (*BaseDomainObject) GetFieldsOrdered ¶
func (b *BaseDomainObject) GetFieldsOrdered() []*DomainObjectField
GetFieldsOrdered returns a slice of fields in the domain object, ordered by their ordinal
func (*BaseDomainObject) GetName ¶
func (b *BaseDomainObject) GetName() string
GetName returns the name of the domain object
type CloseParenthesis ¶
type CloseParenthesis struct{}
CloseParenthesis represents a close parenthesis (group end) query part
func (CloseParenthesis) ToSQL ¶
func (closeParenthesis CloseParenthesis) ToSQL() (sql string, args []interface{})
ToSQL returns the sql representation of an Close Parenthesis (group end) query part
type CountQuery ¶
type CountQuery struct { Object DomainObject // contains filtered or unexported fields }
CountQuery is the containing struct for functionality to build count statements on domain objects
func (*CountQuery) And ¶
func (s *CountQuery) And(queryParts ...IQueryPart) *CountQuery
And adds an "and group" to the query
func (*CountQuery) Or ¶
func (s *CountQuery) Or(queryParts ...IQueryPart) *CountQuery
Or adds an "or group" to the select query
func (*CountQuery) ToSQL ¶
func (s *CountQuery) ToSQL() (sql string, args []interface{})
ToSQL builds a sql select statement
func (*CountQuery) Where ¶
func (s *CountQuery) Where(queryParts ...IQueryPart) *CountQuery
Where is sugar for the And(queryParts...) method
type DeleteQuery ¶
type DeleteQuery struct { Object DomainObject // contains filtered or unexported fields }
DeleteQuery is the containing struct for functionality to build select statements on domain objects
func (*DeleteQuery) And ¶
func (s *DeleteQuery) And(queryParts ...IQueryPart) *DeleteQuery
And adds an "and group" to the query
func (*DeleteQuery) Limit ¶
func (s *DeleteQuery) Limit(count int) *DeleteQuery
Limit adds a limit clause to the sql statement
func (*DeleteQuery) Or ¶
func (s *DeleteQuery) Or(queryParts ...IQueryPart) *DeleteQuery
Or adds an "or group" to the select query
func (*DeleteQuery) ToSQL ¶
func (s *DeleteQuery) ToSQL() (sql string, args []interface{})
ToSQL builds a sql select statement
func (*DeleteQuery) Where ¶
func (s *DeleteQuery) Where(queryParts ...IQueryPart) *DeleteQuery
Where is sugar for the And(queryParts...) method
type DomainObject ¶
type DomainObject interface { GetFields() map[string]*DomainObjectField GetFieldsOrdered() []*DomainObjectField GetName() string Build() }
DomainObject is an interface that outlines functionality for every domain object
type DomainObjectField ¶
DomainObjectField is meta data about a field in a domain object
type FieldList ¶
type FieldList []*DomainObjectField
FieldList is a slice of fields in a domain object
type GreaterThan ¶
type GreaterThan map[string]interface{}
GreaterThan represents a greater than comparison query part
func (GreaterThan) ToSQL ¶
func (greaterThan GreaterThan) ToSQL() (sql string, args []interface{})
ToSQL returns the sql representation of a greater than query part along with its arguments (if any)
type GreaterThanOrEqual ¶
type GreaterThanOrEqual map[string]interface{}
GreaterThanOrEqual represents a greater than or equal comparison query part
func (GreaterThanOrEqual) ToSQL ¶
func (greaterThanOrEqual GreaterThanOrEqual) ToSQL() (sql string, args []interface{})
ToSQL returns the sql representation of a greater than or equal query part along with its arguments (if any)
type IQueryPart ¶
type IQueryPart interface {
ToSQL() (sql string, args []interface{})
}
IQueryPart describes the functionality for a query part
type InsertQuery ¶
type InsertQuery struct { Object DomainObject // contains filtered or unexported fields }
InsertQuery is the containing struct for functionality to build select statements on domain objects
func (*InsertQuery) ToSQL ¶
func (s *InsertQuery) ToSQL() (sql string, args []interface{})
ToSQL builds a sql select statement
func (*InsertQuery) Value ¶
func (s *InsertQuery) Value(fieldName string, value interface{}) *InsertQuery
Value adds a value part for the fields to be inserted
type LessThan ¶
type LessThan map[string]interface{}
LessThan represents a less than comparison query part
type LessThanOrEqual ¶
type LessThanOrEqual map[string]interface{}
LessThanOrEqual represents a less than or equal comparison query part
func (LessThanOrEqual) ToSQL ¶
func (lessThanOrEqual LessThanOrEqual) ToSQL() (sql string, args []interface{})
ToSQL returns the sql representation of a less than or equal query part along with its arguments (if any)
type LimitSimple ¶
type LimitSimple int
LimitSimple is a single integer limit
func (LimitSimple) ToSQL ¶
func (dl LimitSimple) ToSQL() (sql string, args []interface{})
ToSQL returns the SQL representation of a LIMIT clause, along with its arguments
type NotBetween ¶
type NotBetween map[string][]interface{}
NotBetween represents a NOT BETWEEN query part
func (NotBetween) ToSQL ¶
func (notBetween NotBetween) ToSQL() (sql string, args []interface{})
ToSQL returns the sql representation of a NOT BETWEEN query part along with its arguments (if any)
type NotEquals ¶
type NotEquals map[string]interface{}
NotEquals represents a not equals comparison query part
type OpenParenthesis ¶
type OpenParenthesis struct{}
OpenParenthesis represents an open parenthesis (group start) query part
func (OpenParenthesis) ToSQL ¶
func (openParenthesis OpenParenthesis) ToSQL() (sql string, args []interface{})
ToSQL returns the sql representation of an Open Parenthesis (group start) query part
type OrderBy ¶
type OrderBy struct { Field string Dir OrderByDir }
OrderBy represents an ORDER BY sql clause
type OrderByDir ¶
type OrderByDir string
OrderByDir is a type containing the order by string for ORDER BY sql clauses
const ( ASC OrderByDir = "ASC" DESC OrderByDir = "DESC" )
Directional constants
type SelectQuery ¶
type SelectQuery struct { Object DomainObject // contains filtered or unexported fields }
SelectQuery is the containing struct for functionality to build select statements on domain objects
func (*SelectQuery) And ¶
func (s *SelectQuery) And(queryParts ...IQueryPart) *SelectQuery
And adds an "and group" to the query
func (*SelectQuery) Distinct ¶
func (s *SelectQuery) Distinct() *SelectQuery
Distinct sets a flag indicating that the SELECT statement will start with a DISTINCT clause
func (*SelectQuery) Limit ¶
func (s *SelectQuery) Limit(offset int, count int) *SelectQuery
Limit adds a limit clause to the sql statement
func (*SelectQuery) Or ¶
func (s *SelectQuery) Or(queryParts ...IQueryPart) *SelectQuery
Or adds an "or group" to the select query
func (*SelectQuery) OrderBy ¶
func (s *SelectQuery) OrderBy(fieldName string, orderByDir OrderByDir) *SelectQuery
OrderBy adds an ORDER BY clause to the sql statement
func (*SelectQuery) ToSQL ¶
func (s *SelectQuery) ToSQL() (sql string, args []interface{})
ToSQL builds a sql select statement
func (*SelectQuery) Where ¶
func (s *SelectQuery) Where(queryParts ...IQueryPart) *SelectQuery
Where is sugar for the And(queryParts...) method
type UpdateQuery ¶
type UpdateQuery struct { Object DomainObject // contains filtered or unexported fields }
UpdateQuery is the containing struct for functionality to build select statements on domain objects
func (*UpdateQuery) And ¶
func (s *UpdateQuery) And(queryParts ...IQueryPart) *UpdateQuery
And adds an "and group" to the query
func (*UpdateQuery) Or ¶
func (s *UpdateQuery) Or(queryParts ...IQueryPart) *UpdateQuery
Or adds an "or group" to the select query
func (*UpdateQuery) Set ¶
func (s *UpdateQuery) Set(fieldName string, value interface{}) *UpdateQuery
Set adds a set part to the fields to be updated
func (*UpdateQuery) ToSQL ¶
func (s *UpdateQuery) ToSQL() (sql string, args []interface{})
ToSQL builds a sql select statement
func (*UpdateQuery) Where ¶
func (s *UpdateQuery) Where(queryParts ...IQueryPart) *UpdateQuery
Where is sugar for the And(queryParts...) method