Documentation ¶
Index ¶
- Constants
- func NewJoinCache() *joinCache
- type DBOptions
- type Dialect
- type DialectMysql
- type DialectOracle
- type DialectPostgresql
- func (d *DialectPostgresql) Constraints(fm FieldDef, primaryKey bool) (string, error)
- func (d *DialectPostgresql) CreateIndexString(name string, tableName string, fieldNames []string) (string, error)
- func (d *DialectPostgresql) CreateTableString(t *TableDef) (string, error)
- func (d *DialectPostgresql) DropTableIfExistsString(tableName string) (string, error)
- func (d *DialectPostgresql) ExistsDeepString(*Record) (string, error)
- func (d *DialectPostgresql) ExistsString(table, field string, id int64) (string, error)
- func (d *DialectPostgresql) FieldType(fm FieldDef) (string, error)
- func (d *DialectPostgresql) ForeignKeys(t *TableDef) (string, error)
- func (d *DialectPostgresql) IsUniqueContraintFailedError(err error) bool
- func (d *DialectPostgresql) NumAllowedActiveTransactions() int
- func (d *DialectPostgresql) OneTransactionPerConnection() bool
- func (d *DialectPostgresql) Pragmas() []string
- func (d *DialectPostgresql) PreparedValueFormat(counter int) (string, error)
- func (d *DialectPostgresql) UpdateString(rec *Record) (string, error)
- type DialectSqlite3
- func (d *DialectSqlite3) Constraints(fm FieldDef, primaryKey bool) (string, error)
- func (d *DialectSqlite3) CreateIndexString(name string, tableName string, fieldNames []string) (string, error)
- func (d *DialectSqlite3) CreateTableString(t *TableDef) (string, error)
- func (d *DialectSqlite3) DropTableIfExistsString(tableName string) (string, error)
- func (d *DialectSqlite3) ExistsDeepString(r *Record) (string, error)
- func (d *DialectSqlite3) ExistsString(table, field string, id int64) (string, error)
- func (d *DialectSqlite3) FieldType(fm FieldDef) (string, error)
- func (d *DialectSqlite3) ForeignKeys(t *TableDef) (string, error)
- func (d *DialectSqlite3) IsUniqueContraintFailedError(err error) bool
- func (d *DialectSqlite3) NumAllowedActiveTransactions() int
- func (d *DialectSqlite3) OneTransactionPerConnection() bool
- func (d *DialectSqlite3) Pragmas() []string
- func (d *DialectSqlite3) PreparedValueFormat(counter int) (string, error)
- func (d *DialectSqlite3) UpdateString(rec *Record) (string, error)
- type Director
- type Field
- type FieldDef
- type FieldDefBool
- type FieldDefByte
- type FieldDefFloat
- type FieldDefImpl
- func (b *FieldDefImpl) Fixed() bool
- func (b *FieldDefImpl) Indexed() bool
- func (b *FieldDefImpl) Length() int
- func (b *FieldDefImpl) Name() string
- func (b *FieldDefImpl) Nullable() bool
- func (b *FieldDefImpl) SetFixed(v bool)
- func (b *FieldDefImpl) SetIndexed(v bool)
- func (b *FieldDefImpl) SetLength(n int)
- func (b *FieldDefImpl) SetName(n string)
- func (b *FieldDefImpl) SetNullable(v bool)
- func (b *FieldDefImpl) SetTable(table *TableDef)
- func (b *FieldDefImpl) SetUnique(v bool)
- func (b *FieldDefImpl) String() string
- func (b *FieldDefImpl) Table() *TableDef
- func (b *FieldDefImpl) Unique() bool
- type FieldDefInt
- type FieldDefInt64
- type FieldDefString
- type FieldDefTime
- type FieldMeta
- type FieldMetaBool
- type FieldMetaByte
- type FieldMetaFloat
- type FieldMetaImpl
- func (b *FieldMetaImpl) Fixed() bool
- func (b *FieldMetaImpl) Indexed() bool
- func (b *FieldMetaImpl) Length() int
- func (b *FieldMetaImpl) Name() string
- func (b *FieldMetaImpl) Nullable() bool
- func (b *FieldMetaImpl) SetFixed(v bool)
- func (b *FieldMetaImpl) SetIndexed(v bool)
- func (b *FieldMetaImpl) SetLength(n int)
- func (b *FieldMetaImpl) SetName(n string)
- func (b *FieldMetaImpl) SetNullable(v bool)
- func (b *FieldMetaImpl) SetTable(table *TableDef)
- func (b *FieldMetaImpl) SetUnique(v bool)
- func (b *FieldMetaImpl) String() string
- func (b *FieldMetaImpl) Table() *TableDef
- func (b *FieldMetaImpl) Unique() bool
- type FieldMetaInt
- type FieldMetaString
- type FieldMetaTime
- type FieldMetaUint64
- type ICounter
- type Index
- type ManyToMany
- type OneToMany
- type Persister
- func (pers *Persister) BeginTx() error
- func (pers *Persister) CreatePreparedStatementInsertAllFields(record *Record) (string, error)
- func (pers *Persister) CreatePreparedStatementInsertFromRecord(record *Record) (string, error)
- func (pers *Persister) CreatePreparedStatementInsertSomeFields(tablename string, fields ...FieldDef) (string, error)
- func (pers *Persister) CreateTables(tms ...*TableDef) error
- func (pers *Persister) DeleteTables(tms ...*TableDef) error
- func (pers *Persister) Done() error
- func (pers *Persister) Exists(r *Record) (bool, error)
- func (pers *Persister) Save(rec *Record) error
- func (pers *Persister) Update(rec *Record) error
- type Record
- func (r *Record) AddRelationRecord(rel Relation, record *Record) error
- func (r *Record) Clone() (*Record, error)
- func (r *Record) PrimaryKeyValue() (int64, error)
- func (r *Record) Reset() error
- func (r *Record) Set(i int, v interface{}) error
- func (r *Record) SetByName(f string, v interface{}) error
- func (r *Record) String() string
- func (r *Record) Values() []interface{}
- type Relation
- type RelationRecord
- type Set
- type SimpleStorer
- type Storer
- type TableDef
- func (t *TableDef) Add(f FieldDef) error
- func (t *TableDef) AddIndex(name string, fields ...*FieldDef) error
- func (t *TableDef) AddManyToMany(m2m *ManyToMany)
- func (t *TableDef) AddOneToMany(one2m *OneToMany)
- func (t *TableDef) AddOneToMany_OLD(rel *OneToMany) error
- func (t *TableDef) CreatePreparedStatementInsertAllFields(dialect Dialect) (string, error)
- func (t *TableDef) CreatePreparedStatementInsertFromRecord(dialect Dialect, record *Record) (string, error)
- func (t *TableDef) CreatePreparedStatementInsertSomeFields(dialect Dialect, fields ...FieldDef) (string, error)
- func (t *TableDef) Done() bool
- func (t *TableDef) Fields() []FieldDef
- func (t *TableDef) GetField(s string) FieldDef
- func (t *TableDef) GetOneToMany(k string) *OneToMany
- func (t *TableDef) Name() string
- func (t *TableDef) NewRecord() (*Record, error)
- func (t *TableDef) NewRecordSomeFields(fields ...FieldDef) (*Record, error)
- func (t *TableDef) PrimaryKey() FieldDef
- func (t *TableDef) SetDone() error
- func (t *TableDef) SetJoinDiscrimFields(fields ...FieldDef)
- type TransactionHandler
Constants ¶
View Source
const AND = "AND"
View Source
const COMMA = ","
View Source
const COUNT = "COUNT"
View Source
const CREATE_TABLE = "CREATE TABLE"
View Source
const EQUALS = "="
View Source
const FROM = "FROM"
View Source
const INSERT = "INSERT INTO "
View Source
const PRIMARY_KEY = "PRIMARY KEY"
View Source
const SELECT = "SELECT"
View Source
const SET = "SET"
View Source
const SPC = " "
View Source
const STRING_ERROR = " -ERROR- "
View Source
const UPDATE = "UPDATE"
View Source
const UnassignedPK = -99
View Source
const VALUES = "VALUES"
View Source
const WHERE = "WHERE"
Variables ¶
This section is empty.
Functions ¶
func NewJoinCache ¶
func NewJoinCache() *joinCache
Types ¶
type Dialect ¶
type Dialect interface { Constraints(FieldDef, bool) (string, error) CreateIndexString(string, string, []string) (string, error) CreateTableString(t *TableDef) (string, error) DropTableIfExistsString(tableName string) (string, error) ExistsDeepString(*Record) (string, error) ExistsString(table, field string, id int64) (string, error) FieldType(FieldDef) (string, error) ForeignKeys(t *TableDef) (string, error) IsUniqueContraintFailedError(error) bool Pragmas() []string PreparedValueFormat(counter int) (string, error) UpdateString(*Record) (string, error) NumAllowedActiveTransactions() int OneTransactionPerConnection() bool }
func NewDialectSqlite3 ¶
type DialectMysql ¶
type DialectMysql struct { }
func (*DialectMysql) CreateTableString ¶
func (d *DialectMysql) CreateTableString(t *TableDef) string
func (*DialectMysql) NumAllowedActiveTransactions ¶
func (d *DialectMysql) NumAllowedActiveTransactions() int
func (*DialectMysql) OneTransactionPerConnection ¶
func (d *DialectMysql) OneTransactionPerConnection() bool
func (*DialectMysql) PreparedValueFormat ¶
func (d *DialectMysql) PreparedValueFormat(counter int) string
type DialectOracle ¶
type DialectOracle struct { }
func (*DialectOracle) CreateTableString ¶
func (d *DialectOracle) CreateTableString(t *TableDef) string
func (*DialectOracle) PreparedValueFormat ¶
func (d *DialectOracle) PreparedValueFormat(counter int) string
type DialectPostgresql ¶
type DialectPostgresql struct { }
func (*DialectPostgresql) Constraints ¶
func (d *DialectPostgresql) Constraints(fm FieldDef, primaryKey bool) (string, error)
func (*DialectPostgresql) CreateIndexString ¶
func (*DialectPostgresql) CreateTableString ¶
func (d *DialectPostgresql) CreateTableString(t *TableDef) (string, error)
func (*DialectPostgresql) DropTableIfExistsString ¶
func (d *DialectPostgresql) DropTableIfExistsString(tableName string) (string, error)
TODO
func (*DialectPostgresql) ExistsDeepString ¶
func (d *DialectPostgresql) ExistsDeepString(*Record) (string, error)
func (*DialectPostgresql) ExistsString ¶
func (d *DialectPostgresql) ExistsString(table, field string, id int64) (string, error)
func (*DialectPostgresql) FieldType ¶
func (d *DialectPostgresql) FieldType(fm FieldDef) (string, error)
func (*DialectPostgresql) ForeignKeys ¶
func (d *DialectPostgresql) ForeignKeys(t *TableDef) (string, error)
func (*DialectPostgresql) IsUniqueContraintFailedError ¶
func (d *DialectPostgresql) IsUniqueContraintFailedError(err error) bool
func (*DialectPostgresql) NumAllowedActiveTransactions ¶
func (d *DialectPostgresql) NumAllowedActiveTransactions() int
func (*DialectPostgresql) OneTransactionPerConnection ¶
func (d *DialectPostgresql) OneTransactionPerConnection() bool
func (*DialectPostgresql) PreparedValueFormat ¶
func (d *DialectPostgresql) PreparedValueFormat(counter int) (string, error)
func (*DialectPostgresql) UpdateString ¶
func (d *DialectPostgresql) UpdateString(rec *Record) (string, error)
type DialectSqlite3 ¶
type DialectSqlite3 struct {
// contains filtered or unexported fields
}
func (*DialectSqlite3) Constraints ¶
func (d *DialectSqlite3) Constraints(fm FieldDef, primaryKey bool) (string, error)
func (*DialectSqlite3) CreateIndexString ¶
func (*DialectSqlite3) CreateTableString ¶
func (d *DialectSqlite3) CreateTableString(t *TableDef) (string, error)
func (*DialectSqlite3) DropTableIfExistsString ¶
func (d *DialectSqlite3) DropTableIfExistsString(tableName string) (string, error)
func (*DialectSqlite3) ExistsDeepString ¶
func (d *DialectSqlite3) ExistsDeepString(r *Record) (string, error)
func (*DialectSqlite3) ExistsString ¶
func (d *DialectSqlite3) ExistsString(table, field string, id int64) (string, error)
func (*DialectSqlite3) ForeignKeys ¶
func (d *DialectSqlite3) ForeignKeys(t *TableDef) (string, error)
func (*DialectSqlite3) IsUniqueContraintFailedError ¶
func (d *DialectSqlite3) IsUniqueContraintFailedError(err error) bool
func (*DialectSqlite3) NumAllowedActiveTransactions ¶
func (d *DialectSqlite3) NumAllowedActiveTransactions() int
func (*DialectSqlite3) OneTransactionPerConnection ¶
func (d *DialectSqlite3) OneTransactionPerConnection() bool
func (*DialectSqlite3) Pragmas ¶
func (d *DialectSqlite3) Pragmas() []string
func (*DialectSqlite3) PreparedValueFormat ¶
func (d *DialectSqlite3) PreparedValueFormat(counter int) (string, error)
func (*DialectSqlite3) UpdateString ¶
func (d *DialectSqlite3) UpdateString(rec *Record) (string, error)
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
func (*Field) SetValueFast ¶
func (f *Field) SetValueFast(v interface{})
type FieldDef ¶
type FieldDef interface { Name() string SetName(string) Table() *TableDef SetTable(*TableDef) SetLength(int) Length() int Unique() bool SetUnique(bool) Indexed() bool SetIndexed(bool) Nullable() bool SetNullable(bool) //PrimaryKey() bool //SetPrimaryKey(bool) String() string SetFixed(bool) Fixed() bool //Table(*Table) IsSameType(interface{}) bool }
type FieldDefBool ¶
type FieldDefBool struct {
FieldDefImpl
}
func (*FieldDefBool) IsSameType ¶
func (fm *FieldDefBool) IsSameType(v interface{}) bool
type FieldDefByte ¶
type FieldDefByte struct {
FieldDefImpl
}
func (*FieldDefByte) IsSameType ¶
func (fm *FieldDefByte) IsSameType(v interface{}) bool
type FieldDefFloat ¶
type FieldDefFloat struct {
FieldDefImpl
}
func (*FieldDefFloat) IsSameType ¶
func (fm *FieldDefFloat) IsSameType(v interface{}) bool
type FieldDefImpl ¶
type FieldDefImpl struct {
// contains filtered or unexported fields
}
func (*FieldDefImpl) Fixed ¶
func (b *FieldDefImpl) Fixed() bool
func (*FieldDefImpl) Indexed ¶
func (b *FieldDefImpl) Indexed() bool
func (*FieldDefImpl) Length ¶
func (b *FieldDefImpl) Length() int
func (*FieldDefImpl) Name ¶
func (b *FieldDefImpl) Name() string
func (*FieldDefImpl) Nullable ¶
func (b *FieldDefImpl) Nullable() bool
func (*FieldDefImpl) SetFixed ¶
func (b *FieldDefImpl) SetFixed(v bool)
func (*FieldDefImpl) SetIndexed ¶
func (b *FieldDefImpl) SetIndexed(v bool)
func (*FieldDefImpl) SetLength ¶
func (b *FieldDefImpl) SetLength(n int)
func (*FieldDefImpl) SetName ¶
func (b *FieldDefImpl) SetName(n string)
func (*FieldDefImpl) SetNullable ¶
func (b *FieldDefImpl) SetNullable(v bool)
func (*FieldDefImpl) SetTable ¶
func (b *FieldDefImpl) SetTable(table *TableDef)
func (*FieldDefImpl) SetUnique ¶
func (b *FieldDefImpl) SetUnique(v bool)
func (*FieldDefImpl) String ¶
func (b *FieldDefImpl) String() string
func (*FieldDefImpl) Table ¶
func (b *FieldDefImpl) Table() *TableDef
func (*FieldDefImpl) Unique ¶
func (b *FieldDefImpl) Unique() bool
type FieldDefInt ¶
type FieldDefInt struct {
FieldDefImpl
}
func (*FieldDefInt) IsSameType ¶
func (fm *FieldDefInt) IsSameType(v interface{}) bool
type FieldDefInt64 ¶
type FieldDefInt64 struct {
FieldDefImpl
}
func (*FieldDefInt64) IsSameType ¶
func (fm *FieldDefInt64) IsSameType(v interface{}) bool
type FieldDefString ¶
type FieldDefString struct {
FieldDefImpl
}
////////////////////////////////////////////////////
func (*FieldDefString) IsSameType ¶
func (fm *FieldDefString) IsSameType(v interface{}) bool
type FieldDefTime ¶
type FieldDefTime struct {
FieldDefImpl
}
func (*FieldDefTime) IsSameType ¶
func (fm *FieldDefTime) IsSameType(v interface{}) bool
type FieldMeta ¶
type FieldMeta interface { Name() string SetName(string) Table() *TableDef SetTable(*TableDef) SetLength(int) Length() int Unique() bool SetUnique(bool) Indexed() bool SetIndexed(bool) Nullable() bool SetNullable(bool) //PrimaryKey() bool //SetPrimaryKey(bool) String() string SetFixed(bool) Fixed() bool //Table(*Table) IsSameType(interface{}) bool }
type FieldMetaBool ¶
type FieldMetaBool struct {
FieldMetaImpl
}
func (*FieldMetaBool) IsSameType ¶
func (fm *FieldMetaBool) IsSameType(v interface{}) bool
type FieldMetaByte ¶
type FieldMetaByte struct {
FieldMetaImpl
}
func (*FieldMetaByte) IsSameType ¶
func (fm *FieldMetaByte) IsSameType(v interface{}) bool
type FieldMetaFloat ¶
type FieldMetaFloat struct {
FieldMetaImpl
}
func (*FieldMetaFloat) IsSameType ¶
func (fm *FieldMetaFloat) IsSameType(v interface{}) bool
type FieldMetaImpl ¶
type FieldMetaImpl struct {
// contains filtered or unexported fields
}
func (*FieldMetaImpl) Fixed ¶
func (b *FieldMetaImpl) Fixed() bool
func (*FieldMetaImpl) Indexed ¶
func (b *FieldMetaImpl) Indexed() bool
func (*FieldMetaImpl) Length ¶
func (b *FieldMetaImpl) Length() int
func (*FieldMetaImpl) Name ¶
func (b *FieldMetaImpl) Name() string
func (*FieldMetaImpl) Nullable ¶
func (b *FieldMetaImpl) Nullable() bool
func (*FieldMetaImpl) SetFixed ¶
func (b *FieldMetaImpl) SetFixed(v bool)
func (*FieldMetaImpl) SetIndexed ¶
func (b *FieldMetaImpl) SetIndexed(v bool)
func (*FieldMetaImpl) SetLength ¶
func (b *FieldMetaImpl) SetLength(n int)
func (*FieldMetaImpl) SetName ¶
func (b *FieldMetaImpl) SetName(n string)
func (*FieldMetaImpl) SetNullable ¶
func (b *FieldMetaImpl) SetNullable(v bool)
func (*FieldMetaImpl) SetTable ¶
func (b *FieldMetaImpl) SetTable(table *TableDef)
func (*FieldMetaImpl) SetUnique ¶
func (b *FieldMetaImpl) SetUnique(v bool)
func (*FieldMetaImpl) String ¶
func (b *FieldMetaImpl) String() string
func (*FieldMetaImpl) Table ¶
func (b *FieldMetaImpl) Table() *TableDef
func (*FieldMetaImpl) Unique ¶
func (b *FieldMetaImpl) Unique() bool
type FieldMetaInt ¶
type FieldMetaInt struct {
FieldMetaImpl
}
func (*FieldMetaInt) IsSameType ¶
func (fm *FieldMetaInt) IsSameType(v interface{}) bool
type FieldMetaString ¶
type FieldMetaString struct {
FieldMetaImpl
}
////////////////////////////////////////////////////
func (*FieldMetaString) IsSameType ¶
func (fm *FieldMetaString) IsSameType(v interface{}) bool
type FieldMetaTime ¶
type FieldMetaTime struct {
FieldMetaImpl
}
func (*FieldMetaTime) IsSameType ¶
func (fm *FieldMetaTime) IsSameType(v interface{}) bool
type FieldMetaUint64 ¶
type FieldMetaUint64 struct {
FieldMetaImpl
}
func (*FieldMetaUint64) IsSameType ¶
func (fm *FieldMetaUint64) IsSameType(v interface{}) bool
type ManyToMany ¶
type ManyToMany struct { JoinTable *TableDef // contains filtered or unexported fields }
func NewManyToMany ¶
func NewManyToMany() *ManyToMany
func (*ManyToMany) String ¶
func (mtm *ManyToMany) String() string
type OneToMany ¶
type OneToMany struct {
// contains filtered or unexported fields
}
func NewOneToMany ¶
func NewOneToMany() *OneToMany
type Persister ¶
type Persister struct { TransactionSize int SupportUpdates bool // contains filtered or unexported fields }
func NewPersister ¶
needs to also have func NewPersister(ctx context.Context, db *sql.DB, dialect Dialect, size int) (*Persister, error) {
func (*Persister) CreatePreparedStatementInsertAllFields ¶
func (*Persister) CreatePreparedStatementInsertFromRecord ¶
func (*Persister) CreatePreparedStatementInsertSomeFields ¶
func (*Persister) CreateTables ¶
func (*Persister) DeleteTables ¶
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
func (*Record) AddRelationRecord ¶
func (*Record) PrimaryKeyValue ¶
type RelationRecord ¶
type RelationRecord struct {
// contains filtered or unexported fields
}
type SimpleStorer ¶
type SimpleStorer struct {
// contains filtered or unexported fields
}
func (*SimpleStorer) Close ¶
func (st *SimpleStorer) Close() error
func (*SimpleStorer) Initialize ¶
func (*SimpleStorer) Save ¶
func (st *SimpleStorer) Save(rec *Record) error
type TableDef ¶
type TableDef struct { ICounter UseRecordPrimaryKeys bool // contains filtered or unexported fields }
Assumes 0th field is primary key, type FieldDefInt64
func NewTableDef ¶
func (*TableDef) AddManyToMany ¶
func (t *TableDef) AddManyToMany(m2m *ManyToMany)
func (*TableDef) AddOneToMany ¶
func (*TableDef) AddOneToMany_OLD ¶
func (*TableDef) CreatePreparedStatementInsertAllFields ¶
func (*TableDef) CreatePreparedStatementInsertFromRecord ¶
func (*TableDef) CreatePreparedStatementInsertSomeFields ¶
func (*TableDef) GetOneToMany ¶
func (*TableDef) NewRecordSomeFields ¶
func (*TableDef) PrimaryKey ¶
func (*TableDef) SetJoinDiscrimFields ¶
type TransactionHandler ¶
type TransactionHandler struct {
// contains filtered or unexported fields
}
Source Files ¶
- badgerSet.go
- counter.go
- dialect.go
- dialectMysql.go
- dialectOracle.go
- dialectPostgresql.go
- dialectSqlite3.go
- director.go
- field.go
- fieldDef.go
- fieldDefImpl.go
- fieldmeta.go
- fieldmetaImpl.go
- index.go
- join_cache.go
- manytomany.go
- onetomany.go
- pers_utils.go
- persister.go
- record.go
- relations.go
- set.go
- simple_storer.go
- sqlite3Set.go
- storer.go
- tabledef.go
- transaction_handler.go
- util.go
Click to show internal directories.
Click to hide internal directories.