Documentation ¶
Index ¶
- Variables
- func CreateTableQueryFor(i interface{}, dialect Dialect) string
- type ColumnMapping
- type DbDialect
- type DbInfo
- type Dialect
- type Gemini
- func (g *Gemini) AddTable(i interface{}) error
- func (g *Gemini) AddTableToDb(i interface{}, dbInfo *DbInfo) *Gemini
- func (g *Gemini) AddTableWithName(i interface{}, tableName string) error
- func (g *Gemini) AddTableWithNameToDb(i interface{}, tableName string, dbInfo *DbInfo) *Gemini
- func (g *Gemini) CreateTableFor(i interface{}, d Dialect) error
- func (g *Gemini) Delete(i interface{}) error
- func (g *Gemini) Exec(query string, args ...interface{}) (sql.Result, error)
- func (g *Gemini) ExecWithInfo(query string, info *DbInfo, args ...interface{}) (sql.Result, error)
- func (g *Gemini) Get(i interface{}, keys ...interface{}) error
- func (g *Gemini) Insert(i interface{}) error
- func (g *Gemini) Select(i interface{}, query string, args ...interface{}) error
- func (g *Gemini) Update(i interface{}) error
- type JoinInfoError
- type MongoDB
- type MySQL
- type PostgresDialect
- type SqliteDialect
- type TableInfo
- type TableMap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoPrimaryKey = errors.New("table has no primary keys") NoDbSpecified = errors.New("cannot perform action without a specified database (currently gemini knows about more/less than one") NoDbForStruct = errors.New("no database is specified for the given struct") )
View Source
var TestMode = true
Functions ¶
func CreateTableQueryFor ¶
Types ¶
type ColumnMapping ¶
type ColumnMapping struct {
// contains filtered or unexported fields
}
type Gemini ¶
type Gemini struct { Dbs []*sql.DB StructsMap map[string]*TableMap TablesToDb map[string]*sql.DB DbToDriver map[*sql.DB]Dialect // ugh adding these for the moment, table name -> db info TableToDatabaseInfo map[string]*DbInfo DatabaseInfo []*DbInfo // contains filtered or unexported fields }
func (*Gemini) AddTableToDb ¶
func (*Gemini) AddTableWithName ¶
func (*Gemini) AddTableWithNameToDb ¶
func (*Gemini) CreateTableFor ¶
func (*Gemini) ExecWithInfo ¶
type JoinInfoError ¶
type JoinInfoError struct {
// contains filtered or unexported fields
}
func (JoinInfoError) Error ¶
func (j JoinInfoError) Error() string
type PostgresDialect ¶
type PostgresDialect struct{}
func (PostgresDialect) NextPlaceholder ¶
func (p PostgresDialect) NextPlaceholder(curr int) (int, string)
type SqliteDialect ¶
type SqliteDialect struct{}
func (SqliteDialect) NextPlaceholder ¶
func (s SqliteDialect) NextPlaceholder(curr int) (int, string)
type TableInfo ¶
type TableInfo struct{}
The sole purpose of TableInfo is to tag extra information you would like. For now the main use is to specify a table name different than the struct name - this can be done by setting, `name:"tableName"`
type TableMap ¶
type TableMap struct { TableName string StructName string Fields []ColumnMapping ColumnNameToMapping map[string]ColumnMapping // contains filtered or unexported fields }
func TableMapFromStruct ¶
func (*TableMap) HasPrimaryKey ¶
func (*TableMap) PrimaryKey ¶
func (t *TableMap) PrimaryKey() []reflect.StructField
Click to show internal directories.
Click to hide internal directories.