Versions in this module Expand all Collapse all v0 v0.5.3 Oct 14, 2015 v0.5.2 Oct 11, 2015 Changes in this version type SelectStmt + func (stmt SelectStmt) All() SelectStmt + func (stmt SelectStmt) Distinct(columns ...ColumnElem) SelectStmt v0.5.1 Jun 4, 2015 v0.5.0 Jun 4, 2015 Changes in this version type ConditionalStmt + func (stmt *ConditionalStmt) AddConditional(cond Clause) v0.4.0 May 22, 2015 Changes in this version + const OmitEmpty type ColumnClause + func ColumnClauseFromColumn(c ColumnElem) ColumnClause + func ColumnOnlyClause(c ColumnElem) ColumnClause type ColumnElem + func Upper(c ColumnElem) ColumnElem + type ConditionalStmt struct + func (stmt ConditionalStmt) Conditional() Clause type Integer + Autoincrement bool + type Stmt struct + func (stmt *Stmt) SetError(msg string, args ...interface{}) + func (stmt Stmt) Error() error type TableElem + func (table *TableElem) AddCreatable(c Creatable) v0.3.0 Mar 18, 2015 Changes in this version + const OMITEMPTY v0.2.1 Mar 11, 2015 Changes in this version + const VERSION v0.2.0 Mar 3, 2015 Changes in this version + const Cascade + const NoAction + const Restrict + const SetDefault + const SetNull + var Blank = &internalBlank + var ErrNoColumns = errors.New("aspect: attempt to create a statement with zero columns") + var ErrNoResult = errors.New("aspect: no result to return") + var ErrWrongMap = errors.New("aspect: maps must have key type string and value type interface{}") + var False = &internalFalse + var True = &internalTrue + func AlignColumns(columns []string, fields []field) []field + func FakeTx(tx Transaction) *fakeTX + func NewTester(t *testing.T, d Dialect) *sqlTest + func RegisterDialect(name string, d Dialect) + func SelectFields(v interface{}) ([]field, error) + func SelectFieldsFromElem(elem reflect.Type) []field + type ArrayClause struct + Clauses []Clause + Sep string + func (c ArrayClause) Compile(d Dialect, params *Parameters) (string, error) + func (c ArrayClause) String() string + type BigInt struct + NotNull bool + PrimaryKey bool + Unique bool + func (s BigInt) Create(d Dialect) (string, error) + func (s BigInt) IsPrimaryKey() bool + func (s BigInt) IsRequired() bool + func (s BigInt) IsUnique() bool + func (s BigInt) Validate(i interface{}) (interface{}, error) + type BinaryClause struct + Post Clause + Pre Clause + Sep string + func (c BinaryClause) Compile(d Dialect, params *Parameters) (string, error) + func (c BinaryClause) String() string + type Boolean struct + Default *bool + NotNull bool + func (s Boolean) Create(d Dialect) (string, error) + func (s Boolean) IsPrimaryKey() bool + func (s Boolean) IsRequired() bool + func (s Boolean) IsUnique() bool + func (s Boolean) Validate(i interface{}) (interface{}, error) + type Clause interface + func AllOf(clauses ...Clause) Clause + func AnyOf(clauses ...Clause) Clause + type ColumnClause struct + func (c ColumnClause) Compile(d Dialect, params *Parameters) (string, error) + func (c ColumnClause) String() string + type ColumnElem struct + func Avg(c ColumnElem) ColumnElem + func Column(name string, t Type) ColumnElem + func Count(c ColumnElem) ColumnElem + func DateOf(c ColumnElem) ColumnElem + func DatePart(c ColumnElem, part string) ColumnElem + func Lower(c ColumnElem) ColumnElem + func Max(c ColumnElem) ColumnElem + func Sum(c ColumnElem) ColumnElem + func (c ColumnElem) As(alias string) ColumnElem + func (c ColumnElem) Asc() OrderedColumn + func (c ColumnElem) Between(a, b interface{}) Clause + func (c ColumnElem) Compile(d Dialect, params *Parameters) (string, error) + func (c ColumnElem) Create(d Dialect) (string, error) + func (c ColumnElem) Desc() OrderedColumn + func (c ColumnElem) DoesNotEqual(i interface{}) BinaryClause + func (c ColumnElem) Equals(i interface{}) BinaryClause + func (c ColumnElem) GTE(i interface{}) BinaryClause + func (c ColumnElem) GreaterThan(i interface{}) BinaryClause + func (c ColumnElem) ILike(i string) BinaryClause + func (c ColumnElem) In(args interface{}) BinaryClause + func (c ColumnElem) InLocation(loc *time.Location) ColumnElem + func (c ColumnElem) Inner() Clause + func (c ColumnElem) IsNotNull() UnaryClause + func (c ColumnElem) IsNull() UnaryClause + func (c ColumnElem) LTE(i interface{}) BinaryClause + func (c ColumnElem) LessThan(i interface{}) BinaryClause + func (c ColumnElem) Like(i string) BinaryClause + func (c ColumnElem) Modify(t *TableElem) error + func (c ColumnElem) Name() string + func (c ColumnElem) NotBetween(a, b interface{}) Clause + func (c ColumnElem) NotLike(i string) BinaryClause + func (c ColumnElem) NotSimilarTo(i string) BinaryClause + func (c ColumnElem) NullsFirst() OrderedColumn + func (c ColumnElem) NullsLast() OrderedColumn + func (c ColumnElem) Orderable() OrderedColumn + func (c ColumnElem) Selectable() []ColumnElem + func (c ColumnElem) SetInner(clause Clause) ColumnElem + func (c ColumnElem) SimilarTo(i string) BinaryClause + func (c ColumnElem) String() string + func (c ColumnElem) Table() *TableElem + func (c ColumnElem) Type() Type + type ColumnSet map[string]ColumnElem + func (set ColumnSet) Add(c ColumnElem) error + type Compiles interface + Compile func(Dialect, *Parameters) (string, error) + String func() string + type Connection interface + Begin func() (Transaction, error) + Execute func(stmt Executable, args ...interface{}) (sql.Result, error) + MustBegin func() Transaction + MustExecute func(stmt Executable, args ...interface{}) sql.Result + MustQuery func(stmt Executable, args ...interface{}) *Result + MustQueryAll func(stmt Executable, i interface{}) + MustQueryOne func(stmt Executable, i interface{}) bool + Query func(stmt Executable, args ...interface{}) (*Result, error) + QueryAll func(stmt Executable, i interface{}) error + QueryOne func(stmt Executable, i interface{}) error + String func(stmt Executable) string + type Creatable interface + Create func(d Dialect) (string, error) + type CreateStmt struct + func (stmt CreateStmt) Compile(d Dialect, p *Parameters) (string, error) + func (stmt CreateStmt) String() string + type DB struct + func Connect(driver, credentials string) (*DB, error) + func (db *DB) Begin() (Transaction, error) + func (db *DB) Close() error + func (db *DB) Dialect() Dialect + func (db *DB) Execute(stmt Executable, args ...interface{}) (sql.Result, error) + func (db *DB) MustBegin() Transaction + func (db *DB) MustExecute(stmt Executable, args ...interface{}) sql.Result + func (db *DB) MustQuery(stmt Executable, args ...interface{}) *Result + func (db *DB) MustQueryAll(stmt Executable, i interface{}) + func (db *DB) MustQueryOne(stmt Executable, i interface{}) bool + func (db *DB) Query(stmt Executable, args ...interface{}) (*Result, error) + func (db *DB) QueryAll(stmt Executable, i interface{}) error + func (db *DB) QueryOne(stmt Executable, i interface{}) error + func (db *DB) String(stmt Executable) string + type DatabaseConfig struct + Driver string + Host string + Name string + Password string + Port int64 + SSLMode string + User string + func ParseConfig(filename string) (DatabaseConfig, error) + func ParseTestConfig(filename string) (DatabaseConfig, error) + func (db DatabaseConfig) Credentials() string + type Date struct + NotNull bool + PrimaryKey bool + Unique bool + func (s Date) Create(d Dialect) (string, error) + func (s Date) IsPrimaryKey() bool + func (s Date) IsRequired() bool + func (s Date) IsUnique() bool + func (s Date) Validate(i interface{}) (interface{}, error) + type DeleteStmt struct + func Delete(table *TableElem) (stmt DeleteStmt) + func (stmt DeleteStmt) Compile(d Dialect, params *Parameters) (string, error) + func (stmt DeleteStmt) String() string + func (stmt DeleteStmt) Values(arg interface{}) DeleteStmt + func (stmt DeleteStmt) Where(conds ...Clause) DeleteStmt + type Dialect interface + Parameterize func(int) string + func GetDialect(name string) (Dialect, error) + func MustGetDialect(name string) Dialect + type Double struct + NotNull bool + PrimaryKey bool + Unique bool + func (s Double) Create(d Dialect) (string, error) + func (s Double) IsPrimaryKey() bool + func (s Double) IsRequired() bool + func (s Double) IsUnique() bool + func (s Double) Validate(i interface{}) (interface{}, error) + type DropStmt struct + func (stmt DropStmt) Compile(d Dialect, p *Parameters) (string, error) + func (stmt DropStmt) IfExists() DropStmt + func (stmt DropStmt) String() string + type Executable interface + type Field struct + Name string + OmitEmpty bool + type ForeignKeyElem struct + func ForeignKey(name string, fk ColumnElem, ts ...Type) ForeignKeyElem + func (fk ForeignKeyElem) Create(d Dialect) (string, error) + func (fk ForeignKeyElem) ForeignName() string + func (fk ForeignKeyElem) Modify(t *TableElem) error + func (fk ForeignKeyElem) Name() string + func (fk ForeignKeyElem) OnDelete(b fkAction) ForeignKeyElem + func (fk ForeignKeyElem) OnUpdate(b fkAction) ForeignKeyElem + func (fk ForeignKeyElem) ReferencesTable() *TableElem + func (fk ForeignKeyElem) Table() *TableElem + func (fk ForeignKeyElem) Type() Type + type FuncClause struct + F string + Inner Clause + func (c FuncClause) Compile(d Dialect, params *Parameters) (string, error) + func (c FuncClause) String() string + type InsertStmt struct + func Insert(selection Selectable, selections ...Selectable) (stmt InsertStmt) + func (s InsertStmt) Values(arg interface{}) InsertStmt + func (stmt *InsertStmt) AppendColumn(c ColumnElem) + func (stmt InsertStmt) Compile(d Dialect, params *Parameters) (string, error) + func (stmt InsertStmt) Error() error + func (stmt InsertStmt) HasColumn(name string) bool + func (stmt InsertStmt) SetError(err error) + func (stmt InsertStmt) String() string + func (stmt InsertStmt) Table() *TableElem + type IntClause struct + D int + func (c IntClause) Compile(d Dialect, params *Parameters) (string, error) + func (c IntClause) String() string + type Integer struct + NotNull bool + PrimaryKey bool + Unique bool + func (s Integer) Create(d Dialect) (string, error) + func (s Integer) IsPrimaryKey() bool + func (s Integer) IsRequired() bool + func (s Integer) IsUnique() bool + func (s Integer) Validate(i interface{}) (interface{}, error) + type JoinOnStmt struct + func (j JoinOnStmt) Compile(d Dialect, params *Parameters) (string, error) + func (j JoinOnStmt) String() string + type JoinStmt struct + func (j JoinStmt) Compile(d Dialect, params *Parameters) (string, error) + type Orderable interface + Orderable func() OrderedColumn + type OrderedColumn struct + func (o OrderedColumn) Asc() OrderedColumn + func (o OrderedColumn) Compile(d Dialect, params *Parameters) (string, error) + func (o OrderedColumn) Desc() OrderedColumn + func (o OrderedColumn) NullsFirst() OrderedColumn + func (o OrderedColumn) NullsLast() OrderedColumn + func (o OrderedColumn) Orderable() OrderedColumn + func (o OrderedColumn) String() string + type Parameter struct + Value interface{} + func (p *Parameter) Compile(d Dialect, params *Parameters) (string, error) + func (p *Parameter) String() string + type Parameters struct + func Params() *Parameters + func (p *Parameters) Add(i interface{}) int + func (p *Parameters) Args() []interface{} + func (p *Parameters) Len() int + type PrimaryKeyArray []string + func PrimaryKey(names ...string) PrimaryKeyArray + func (pk PrimaryKeyArray) Contains(key string) bool + func (pk PrimaryKeyArray) Create(d Dialect) (string, error) + func (pk PrimaryKeyArray) Modify(table *TableElem) error + type Real struct + NotNull bool + PrimaryKey bool + Unique bool + func (s Real) Create(d Dialect) (string, error) + func (s Real) IsPrimaryKey() bool + func (s Real) IsRequired() bool + func (s Real) IsUnique() bool + func (s Real) Validate(i interface{}) (interface{}, error) + type Result struct + func (r *Result) All(arg interface{}) error + func (r *Result) Close() error + func (r *Result) Next() bool + func (r *Result) One(arg interface{}) error + type Scanner interface + Close func() error + Columns func() ([]string, error) + Err func() error + Next func() bool + Scan func(...interface{}) error + type SelectStmt struct + func Select(selections ...Selectable) (stmt SelectStmt) + func SelectExcept(table *TableElem, exceptions ...ColumnElem) SelectStmt + func SelectTable(table *TableElem, selects ...Selectable) (stmt SelectStmt) + func (stmt SelectStmt) Compile(d Dialect, params *Parameters) (string, error) + func (stmt SelectStmt) CompileColumns(d Dialect, params *Parameters) []string + func (stmt SelectStmt) CompileTables(d Dialect, params *Parameters) []string + func (stmt SelectStmt) From(tables ...*TableElem) SelectStmt + func (stmt SelectStmt) GroupBy(cs ...ColumnElem) SelectStmt + func (stmt SelectStmt) Join(pre, post ColumnElem) SelectStmt + func (stmt SelectStmt) JoinOn(table *TableElem, clauses ...Clause) SelectStmt + func (stmt SelectStmt) LeftOuterJoinOn(table *TableElem, clauses ...Clause) SelectStmt + func (stmt SelectStmt) Limit(limit int) SelectStmt + func (stmt SelectStmt) Offset(offset int) SelectStmt + func (stmt SelectStmt) OrderBy(params ...Orderable) SelectStmt + func (stmt SelectStmt) String() string + func (stmt SelectStmt) TableExists(name string) bool + func (stmt SelectStmt) Where(conds ...Clause) SelectStmt + type Selectable interface + Selectable func() []ColumnElem + type SelfForeignKeyElem struct + func SelfForeignKey(name, ref string, ts ...Type) SelfForeignKeyElem + func (fk SelfForeignKeyElem) Modify(t *TableElem) error + type String struct + Default *string + Length int + NotNull bool + PrimaryKey bool + Unique bool + func (s String) Create(d Dialect) (string, error) + func (s String) IsPrimaryKey() bool + func (s String) IsRequired() bool + func (s String) IsUnique() bool + func (s String) Validate(i interface{}) (interface{}, error) + type StringClause struct + Name string + func (c StringClause) Compile(d Dialect, params *Parameters) (string, error) + func (c StringClause) String() string + type TX struct + func WrapTx(tx *sql.Tx, dialect Dialect) *TX + func (tx *TX) Begin() (Transaction, error) + func (tx *TX) Commit() error + func (tx *TX) CommitIf(commit *bool) error + func (tx *TX) Execute(stmt Executable, args ...interface{}) (sql.Result, error) + func (tx *TX) MustBegin() Transaction + func (tx *TX) MustCommitIf(commit *bool) bool + func (tx *TX) MustExecute(stmt Executable, args ...interface{}) sql.Result + func (tx *TX) MustQuery(stmt Executable, args ...interface{}) *Result + func (tx *TX) MustQueryAll(stmt Executable, i interface{}) + func (tx *TX) MustQueryOne(stmt Executable, i interface{}) bool + func (tx *TX) MustRollbackIf(rollback *bool) + func (tx *TX) Query(stmt Executable, args ...interface{}) (*Result, error) + func (tx *TX) QueryAll(stmt Executable, i interface{}) error + func (tx *TX) QueryOne(stmt Executable, i interface{}) error + func (tx *TX) Rollback() error + func (tx *TX) String(stmt Executable) string + type TableElem struct + C ColumnSet + Name string + func Table(name string, elements ...TableModifier) *TableElem + func (table *TableElem) Columns() []ColumnElem + func (table *TableElem) Compile(d Dialect, params *Parameters) string + func (table *TableElem) Create() CreateStmt + func (table *TableElem) Delete() DeleteStmt + func (table *TableElem) Drop() DropStmt + func (table *TableElem) ForeignKeys() []ForeignKeyElem + func (table *TableElem) Insert() InsertStmt + func (table *TableElem) PrimaryKey() PrimaryKeyArray + func (table *TableElem) Select(selections ...Selectable) SelectStmt + func (table *TableElem) SelectExcept(exceptions ...ColumnElem) SelectStmt + func (table *TableElem) Selectable() []ColumnElem + func (table *TableElem) String() string + func (table *TableElem) UniqueConstraints() []UniqueConstraint + func (table *TableElem) Update() UpdateStmt + type TableModifier interface + Modify func(*TableElem) error + type Text struct + NotNull bool + func (s Text) Create(d Dialect) (string, error) + func (s Text) IsPrimaryKey() bool + func (s Text) IsRequired() bool + func (s Text) IsUnique() bool + func (s Text) Validate(i interface{}) (interface{}, error) + type Timestamp struct + Default string + NotNull bool + PrimaryKey bool + WithTimezone bool + WithoutTimezone bool + func (s Timestamp) Create(d Dialect) (string, error) + func (s Timestamp) IsPrimaryKey() bool + func (s Timestamp) IsRequired() bool + func (s Timestamp) IsUnique() bool + func (s Timestamp) Validate(i interface{}) (interface{}, error) + type Transaction interface + Commit func() error + CommitIf func(*bool) error + MustCommitIf func(*bool) bool + MustRollbackIf func(*bool) + Rollback func() error + type Type interface + IsPrimaryKey func() bool + IsRequired func() bool + IsUnique func() bool + Validate func(interface{}) (interface{}, error) + type UnaryClause struct + Pre Clause + Sep string + func (c UnaryClause) Compile(d Dialect, params *Parameters) (string, error) + func (c UnaryClause) String() string + type UniqueConstraint []string + func Unique(names ...string) UniqueConstraint + func (uc UniqueConstraint) Create(d Dialect) (string, error) + func (uc UniqueConstraint) Modify(table *TableElem) error + type UpdateStmt struct + func Update(table *TableElem) (stmt UpdateStmt) + func (stmt UpdateStmt) Compile(d Dialect, params *Parameters) (string, error) + func (stmt UpdateStmt) Error() error + func (stmt UpdateStmt) String() string + func (stmt UpdateStmt) Values(values Values) UpdateStmt + func (stmt UpdateStmt) Where(conds ...Clause) UpdateStmt + type Values map[string]interface + func (v Values) Compile(d Dialect, params *Parameters) (string, error) + func (v Values) Diff(other Values) Values + func (v Values) Keys() []string + func (v Values) String() string