Versions in this module Expand all Collapse all v0 v0.2.0 Feb 25, 2016 Changes in this version + var CantStartTransaction = errors.New("can't start transaction") + var DefaultCallback = &callback + var DefaultTableNameHandler = func(db *DB, defaultTableName string) string + var InvalidSql = errors.New("invalid sql") + var NoNewAttrs = errors.New("no new attributes") + var NoValidTransaction = errors.New("no valid transaction") + var NowFunc = func() time.Time + var RecordNotFound = errors.New("record not found") + func AfterCreate(scope *Scope) + func AfterDelete(scope *Scope) + func AfterQuery(scope *Scope) + func AfterUpdate(scope *Scope) + func AssignUpdateAttributes(scope *Scope) + func BeforeCreate(scope *Scope) + func BeforeDelete(scope *Scope) + func BeforeUpdate(scope *Scope) + func BeginTransaction(scope *Scope) + func CommitOrRollbackTransaction(scope *Scope) + func Create(scope *Scope) + func Delete(scope *Scope) + func Expr(expression string, args ...interface{}) *expr + func Preload(scope *Scope) + func Query(scope *Scope) + func SaveAfterAssociations(scope *Scope) + func SaveBeforeAssociations(scope *Scope) + func ToDBName(name string) string + func Update(scope *Scope) + func UpdateTimeStampWhenCreate(scope *Scope) + func UpdateTimeStampWhenUpdate(scope *Scope) + type Association struct + Column string + Error error + Field *Field + PrimaryKey interface{} + Scope *Scope + func (association *Association) Append(values ...interface{}) *Association + func (association *Association) Clear() *Association + func (association *Association) Count() int + func (association *Association) Delete(values ...interface{}) *Association + func (association *Association) Find(value interface{}) *Association + func (association *Association) Replace(values ...interface{}) *Association + type DB struct + Error error + RowsAffected int64 + Value interface{} + func Open(dialect string, args ...interface{}) (DB, error) + func (db *DB) NewScope(value interface{}) *Scope + func (s *DB) AddForeignKey(field string, dest string, onDelete string, onUpdate string) *DB + func (s *DB) AddIndex(indexName string, column ...string) *DB + func (s *DB) AddUniqueIndex(indexName string, column ...string) *DB + func (s *DB) Assign(attrs ...interface{}) *DB + func (s *DB) Association(column string) *Association + func (s *DB) Attrs(attrs ...interface{}) *DB + func (s *DB) AutoMigrate(values ...interface{}) *DB + func (s *DB) Begin() *DB + func (s *DB) Callback() *callback + func (s *DB) Close() error + func (s *DB) Commit() *DB + func (s *DB) CommonDB() sqlCommon + func (s *DB) Count(value interface{}) *DB + func (s *DB) Create(value interface{}) *DB + func (s *DB) CreateTable(value interface{}) *DB + func (s *DB) DB() *sql.DB + func (s *DB) Debug() *DB + func (s *DB) Delete(value interface{}, where ...interface{}) *DB + func (s *DB) DropColumn(column string) *DB + func (s *DB) DropTable(value interface{}) *DB + func (s *DB) DropTableIfExists(value interface{}) *DB + func (s *DB) Exec(sql string, values ...interface{}) *DB + func (s *DB) Find(out interface{}, where ...interface{}) *DB + func (s *DB) First(out interface{}, where ...interface{}) *DB + func (s *DB) FirstOrCreate(out interface{}, where ...interface{}) *DB + func (s *DB) FirstOrInit(out interface{}, where ...interface{}) *DB + func (s *DB) Get(name string) (value interface{}, ok bool) + func (s *DB) Group(query string) *DB + func (s *DB) HasTable(value interface{}) bool + func (s *DB) Having(query string, values ...interface{}) *DB + func (s *DB) InstantSet(name string, value interface{}) *DB + func (s *DB) Joins(query string) *DB + func (s *DB) Last(out interface{}, where ...interface{}) *DB + func (s *DB) Limit(value interface{}) *DB + func (s *DB) LogMode(enable bool) *DB + func (s *DB) Model(value interface{}) *DB + func (s *DB) ModifyColumn(column string, typ string) *DB + func (s *DB) New() *DB + func (s *DB) NewRecord(value interface{}) bool + func (s *DB) Not(query interface{}, args ...interface{}) *DB + func (s *DB) Offset(value interface{}) *DB + func (s *DB) Omit(columns ...string) *DB + func (s *DB) Or(query interface{}, args ...interface{}) *DB + func (s *DB) Order(value string, reorder ...bool) *DB + func (s *DB) Pluck(column string, value interface{}) *DB + func (s *DB) Preload(column string, conditions ...interface{}) *DB + func (s *DB) Raw(sql string, values ...interface{}) *DB + func (s *DB) RecordNotFound() bool + func (s *DB) Related(value interface{}, foreignKeys ...string) *DB + func (s *DB) RemoveIndex(indexName string) *DB + func (s *DB) Rollback() *DB + func (s *DB) Row() *sql.Row + func (s *DB) Rows() (*sql.Rows, error) + func (s *DB) Save(value interface{}) *DB + func (s *DB) Scan(dest interface{}) *DB + func (s *DB) Scopes(funcs ...func(*DB) *DB) *DB + func (s *DB) Select(query interface{}, args ...interface{}) *DB + func (s *DB) Set(name string, value interface{}) *DB + func (s *DB) SetJoinTableHandler(source interface{}, column string, handler JoinTableHandlerInterface) + func (s *DB) SetLogger(l logger) + func (s *DB) SingularTable(enable bool) + func (s *DB) Table(name string) *DB + func (s *DB) Unscoped() *DB + func (s *DB) Update(attrs ...interface{}) *DB + func (s *DB) UpdateColumn(attrs ...interface{}) *DB + func (s *DB) UpdateColumns(values interface{}) *DB + func (s *DB) Updates(values interface{}, ignoreProtectedAttrs ...bool) *DB + func (s *DB) Where(query interface{}, args ...interface{}) *DB + type Dialect interface + BinVar func(i int) string + HasColumn func(scope *Scope, tableName string, columnName string) bool + HasIndex func(scope *Scope, tableName string, indexName string) bool + HasTable func(scope *Scope, tableName string) bool + HasTop func() bool + Quote func(key string) string + RemoveIndex func(scope *Scope, indexName string) + ReturningStr func(tableName, key string) string + SelectFromDummyTable func() string + SqlTag func(value reflect.Value, size int, autoIncrease bool) string + SupportLastInsertId func() bool + func NewDialect(driver string) Dialect + type Field struct + Field reflect.Value + IsBlank bool + func (field *Field) Set(value interface{}) error + type Hstore map[string]*string + func (h *Hstore) Scan(value interface{}) error + func (h Hstore) Value() (driver.Value, error) + type JoinTableForeignKey struct + AssociationDBName string + DBName string + type JoinTableHandler struct + Destination JoinTableSource + Source JoinTableSource + TableName string + func (s *JoinTableHandler) DestinationForeignKeys() []JoinTableForeignKey + func (s *JoinTableHandler) Setup(relationship *Relationship, tableName string, source reflect.Type, ...) + func (s *JoinTableHandler) SourceForeignKeys() []JoinTableForeignKey + func (s JoinTableHandler) Add(handler JoinTableHandlerInterface, db *DB, source1 interface{}, ...) error + func (s JoinTableHandler) Delete(handler JoinTableHandlerInterface, db *DB, sources ...interface{}) error + func (s JoinTableHandler) GetSearchMap(db *DB, sources ...interface{}) map[string]interface{} + func (s JoinTableHandler) JoinWith(handler JoinTableHandlerInterface, db *DB, source interface{}) *DB + func (s JoinTableHandler) Table(db *DB) string + type JoinTableHandlerInterface interface + Add func(handler JoinTableHandlerInterface, db *DB, source interface{}, ...) error + Delete func(handler JoinTableHandlerInterface, db *DB, sources ...interface{}) error + DestinationForeignKeys func() []JoinTableForeignKey + JoinWith func(handler JoinTableHandlerInterface, db *DB, source interface{}) *DB + Setup func(relationship *Relationship, tableName string, source reflect.Type, ...) + SourceForeignKeys func() []JoinTableForeignKey + Table func(db *DB) string + type JoinTableSource struct + ForeignKeys []JoinTableForeignKey + ModelType reflect.Type + type Logger struct + func (logger Logger) Print(values ...interface{}) + type Model struct + CreatedAt time.Time + DeletedAt *time.Time + ID uint + UpdatedAt time.Time + type ModelStruct struct + ModelType reflect.Type + PrimaryFields []*StructField + StructFields []*StructField + func (s ModelStruct) TableName(db *DB) string + type Relationship struct + AssociationForeignDBName string + AssociationForeignFieldName string + ForeignDBName string + ForeignFieldName string + JoinTableHandler JoinTableHandlerInterface + Kind string + PolymorphicDBName string + PolymorphicType string + type Scope struct + Search *search + Sql string + SqlVars []interface{} + Value interface{} + func (scope *Scope) AddToVars(value interface{}) string + func (scope *Scope) Begin() *Scope + func (scope *Scope) CallMethod(name string, checkError bool) + func (scope *Scope) CallMethodWithErrorCheck(name string) + func (scope *Scope) CombinedConditionSql() string + func (scope *Scope) CommitOrRollback() *Scope + func (scope *Scope) DB() *DB + func (scope *Scope) Dialect() Dialect + func (scope *Scope) Err(err error) error + func (scope *Scope) Exec() *Scope + func (scope *Scope) FieldByName(name string) (field *Field, ok bool) + func (scope *Scope) Fields() map[string]*Field + func (scope *Scope) Get(name string) (interface{}, bool) + func (scope *Scope) GetModelStruct() *ModelStruct + func (scope *Scope) GetStructFields() (fields []*StructField) + func (scope *Scope) HasColumn(column string) bool + func (scope *Scope) HasError() bool + func (scope *Scope) IndirectValue() reflect.Value + func (scope *Scope) InstanceGet(name string) (interface{}, bool) + func (scope *Scope) InstanceId() string + func (scope *Scope) InstanceSet(name string, value interface{}) *Scope + func (scope *Scope) Log(v ...interface{}) + func (scope *Scope) NeedPtr() *Scope + func (scope *Scope) New(value interface{}) *Scope + func (scope *Scope) NewDB() *DB + func (scope *Scope) OmitAttrs() []string + func (scope *Scope) PrimaryField() *Field + func (scope *Scope) PrimaryFields() []*Field + func (scope *Scope) PrimaryKey() string + func (scope *Scope) PrimaryKeyValue() interface{} + func (scope *Scope) PrimaryKeyZero() bool + func (scope *Scope) Quote(str string) string + func (scope *Scope) QuotedTableName() (name string) + func (scope *Scope) Raw(sql string) *Scope + func (scope *Scope) SelectAttrs() []string + func (scope *Scope) Set(name string, value interface{}) *Scope + func (scope *Scope) SetColumn(column interface{}, value interface{}) error + func (scope *Scope) SkipLeft() + func (scope *Scope) SqlDB() sqlCommon + func (scope *Scope) TableName() string + func (scope *Scope) Trace(t time.Time) + type StructField struct + DBName string + HasDefaultValue bool + IsForeignKey bool + IsIgnored bool + IsNormal bool + IsPrimaryKey bool + IsScanner bool + Name string + Names []string + Relationship *Relationship + Struct reflect.StructField + Tag reflect.StructTag