Documentation
¶
Index ¶
- type Dal
- type Field
- type IQuery
- type ISchema
- type Join
- type JoinField
- type Query
- func (q *Query) And() IQuery
- func (q *Query) Exec() (result sql.Result, e error)
- func (q *Query) GetValues() []interface{}
- func (q *Query) Join(tableName string) IQuery
- func (q *Query) Limit(limit int) IQuery
- func (q *Query) Offset(offset int) IQuery
- func (q *Query) OnField(fieldName string, joinTable string, joinField string) IQuery
- func (q *Query) OnValue(fieldName string, value interface{}) IQuery
- func (q *Query) Or() IQuery
- func (q *Query) Order(field string, direction string) IQuery
- func (q *Query) Query() (*sql.Rows, error)
- func (q *Query) SelectJoinField(joinTable string, joinField string, as string) IQuery
- func (q *Query) Set(fieldName string, value interface{}) IQuery
- func (q *Query) ToSQL() string
- func (q *Query) Where(name string, value interface{}) IQuery
- type Schema
- func (s *Schema) AddTable(name string, fields []string) error
- func (s *Schema) Count(tableName string) IQuery
- func (s *Schema) Delete(tableName string) IQuery
- func (s *Schema) Exec(query string, args ...interface{}) (sql.Result, error)
- func (s *Schema) GetTables() map[string]*Table
- func (s *Schema) Insert(tableName string) IQuery
- func (s *Schema) Query(query string, args ...interface{}) (result *sql.Rows, e error)
- func (s *Schema) Select(tableName string) IQuery
- func (s *Schema) Table(name string) (t *Table)
- func (s *Schema) Update(tableName string) IQuery
- type Table
- type ValueField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dal ¶
Dal manages the connection to and the querying of the database
type IQuery ¶
type IQuery interface { Query() (*sql.Rows, error) Exec() (result sql.Result, e error) And() IQuery Or() IQuery Where(name string, value interface{}) IQuery Set(fieldName string, value interface{}) IQuery Join(tableName string) IQuery OnValue(tableName string, value interface{}) IQuery OnField(fieldName string, joinTable string, joinField string) IQuery Limit(limit int) IQuery Offset(offset int) IQuery Order(field string, direction string) IQuery ToSQL() string GetValues() []interface{} SelectJoinField(tableName string, fieldName string, as string) IQuery }
IQuery outlines the methods on build a sql query and interacting with the database
type ISchema ¶
type ISchema interface { Select(tableName string) IQuery Update(tableName string) IQuery Delete(tableName string) IQuery Insert(tableName string) IQuery AddTable(name string, fields []string) error Table(name string) (t *Table) Exec(query string, args ...interface{}) (sql.Result, error) Query(query string, args ...interface{}) (result *sql.Rows, e error) GetTables() map[string]*Table }
ISchema represents DAL schema methods
type Query ¶
type Query struct { Table *Table // Filters are the phrases used in the where clause Filters []ValueField Params []string Joins []Join GroupBy string SetFields []string QueryType string ValueFields []ValueField Dal *Dal Values []interface{} OrderBy string OrderDir string // SelectJoinFields is a collection of fields included in the list of fields selected // Format: `joinedTablePrefix`.`fieldName` SelectJoinFields []string // contains filtered or unexported fields }
Query defines a query to be made against the database
func (*Query) GetValues ¶
func (q *Query) GetValues() []interface{}
GetValues returns the values used for the current query
func (*Query) OnField ¶
OnField adds an on clause to the most recent join that joins with the field of another table
func (*Query) SelectJoinField ¶
SelectJoinField uses a field from a joined table in the select list
type Schema ¶
Schema is a collection of tables
type Table ¶
Table represents a database table
type ValueField ¶
type ValueField struct { Name string Value interface{} }
ValueField is a name/value pair used to setting data on insert or update queries
Click to show internal directories.
Click to hide internal directories.