Documentation
¶
Index ¶
- Constants
- func NosqlRegister(name string, nosqlDatabaseHandler nosqlDatabaseHandler) error
- func NosqlUse(name string) (nosqlDatabaseHandler, error)
- func Register(name string, databaseHandler databaseHandler) error
- func Use(name string) (databaseHandler, error)
- type DatabaseCallback
- type DatabaseHandler
- type Handler
- type HbaseDatabaseCallback
- type HbaseDatabaseHandler
- func (this *HbaseDatabaseHandler) Append(ctx context.Context, table string, key string, ...) error
- func (this *HbaseDatabaseHandler) CheckAndPut(ctx context.Context, table string, key string, ...) (bool, error)
- func (this *HbaseDatabaseHandler) Close()
- func (this *HbaseDatabaseHandler) Delete(ctx context.Context, table string, key string, ...) (err error)
- func (this *HbaseDatabaseHandler) Get(ctx context.Context, table string, key string) ([]map[string]string, error)
- func (this *HbaseDatabaseHandler) GetConnection() (client interface{}, err error)
- func (this *HbaseDatabaseHandler) GetConnectionPoolSize() int
- func (this *HbaseDatabaseHandler) Increment(ctx context.Context, table string, key string, ...) (int64, error)
- func (this *HbaseDatabaseHandler) Put(ctx context.Context, table string, key string, ...) (err error)
- func (this *HbaseDatabaseHandler) ReleaseConnection(client interface{})
- func (this *HbaseDatabaseHandler) Scan(ctx context.Context, table string) (NosqlDatabaseScanner, error)
- type HbaseDatabaseScanner
- type HbaseHandler
- type Instance
- func (this *Instance) GetDatabase(name string) (DatabaseHandler, error)
- func (this *Instance) GetNosqlDatabase(name string) (NosqlDatabaseHandler, error)
- func (this *Instance) HandlerName() string
- func (this *Instance) Initiate(ctx context.Context) (newCtx context.Context, err error)
- func (this *Instance) NewDatabase(ctx context.Context, name string) (DatabaseHandler, error)
- func (this *Instance) NewNosqlDatabase(ctx context.Context, name string) (NosqlDatabaseHandler, error)
- func (this *Instance) NosqlUse(ctx context.Context, handlerName string) error
- func (this *Instance) OnRequestShutdown(c *routing.Context) error
- func (this *Instance) OnRequestStartup(c *routing.Context) error
- func (this *Instance) OnShutdown(ctx context.Context) (context.Context, error)
- func (this *Instance) OnStartup(ctx context.Context) (context.Context, error)
- func (this *Instance) Use(ctx context.Context, handlerName string) error
- type MysqlDatabaseHandler
- func (this *MysqlDatabaseHandler) AddForeignKey(field string, dest string, onDelete string, onUpdate string) DatabaseHandler
- func (this *MysqlDatabaseHandler) AddIndex(indexName string, columns ...string) DatabaseHandler
- func (this *MysqlDatabaseHandler) AddUniqueIndex(indexName string, columns ...string) DatabaseHandler
- func (this *MysqlDatabaseHandler) AutoMigrate(values ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Begin() DatabaseHandler
- func (this *MysqlDatabaseHandler) Callback() DatabaseCallback
- func (this *MysqlDatabaseHandler) Close() error
- func (this *MysqlDatabaseHandler) Commit() DatabaseHandler
- func (this *MysqlDatabaseHandler) Count(value interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Create(value interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) CreateTable(models ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Debug() DatabaseHandler
- func (this *MysqlDatabaseHandler) Delete(value interface{}, where ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) DropColumn(column string) DatabaseHandler
- func (this *MysqlDatabaseHandler) DropTable(values ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) DropTableIfExists(values ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Error() error
- func (this *MysqlDatabaseHandler) Exec(sql string, values ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Find(out interface{}, where ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) First(out interface{}, where ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) GetConfig() map[string]interface{}
- func (this *MysqlDatabaseHandler) HasTable(value interface{}) bool
- func (this *MysqlDatabaseHandler) Having(query string, values ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Joins(query string, args ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Last(out interface{}, where ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Limit(limit interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Model(value interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) ModifyColumn(column string, typ string) DatabaseHandler
- func (this *MysqlDatabaseHandler) New() DatabaseHandler
- func (this *MysqlDatabaseHandler) NewRecord(value interface{}) bool
- func (this *MysqlDatabaseHandler) Not(query interface{}, args ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Offset(offset interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Omit(columns ...string) DatabaseHandler
- func (this *MysqlDatabaseHandler) Or(query interface{}, args ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Order(value interface{}, reorder ...bool) DatabaseHandler
- func (this *MysqlDatabaseHandler) Pluck(column string, value interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Raw(sql string, values ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) RecordNotFound() bool
- func (this *MysqlDatabaseHandler) Related(value interface{}, foreignKeys ...string) DatabaseHandler
- func (this *MysqlDatabaseHandler) RemoveIndex(indexName string) DatabaseHandler
- func (this *MysqlDatabaseHandler) Rollback() DatabaseHandler
- func (this *MysqlDatabaseHandler) Row() *sql.Row
- func (this *MysqlDatabaseHandler) Rows() (*sql.Rows, error)
- func (this *MysqlDatabaseHandler) Save(value interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Scan(dest interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Scopes(funcs ...func(*gorm.DB) *gorm.DB) DatabaseHandler
- func (this *MysqlDatabaseHandler) Select(query interface{}, args ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Set(name string, value interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Table(name string) DatabaseHandler
- func (this *MysqlDatabaseHandler) Unscoped() DatabaseHandler
- func (this *MysqlDatabaseHandler) Update(attrs ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) UpdateColumn(attrs ...interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) UpdateColumns(values interface{}) DatabaseHandler
- func (this *MysqlDatabaseHandler) Updates(values interface{}, ignoreProtectedAttrs ...bool) DatabaseHandler
- func (this *MysqlDatabaseHandler) Where(query interface{}, args ...interface{}) DatabaseHandler
- type MysqlHandler
- type NosqlDatabaseCallback
- type NosqlDatabaseHandler
- type NosqlDatabaseScanner
- type NosqlHandler
Constants ¶
View Source
const ( DEFAULT_MAX_ACTIVE = 30 DEFAULT_TIMEOUT = 120 )
Variables ¶
This section is empty.
Functions ¶
func NosqlRegister ¶
Types ¶
type DatabaseCallback ¶
type DatabaseCallback interface { Create() *gorm.CallbackProcessor Update() *gorm.CallbackProcessor Delete() *gorm.CallbackProcessor Query() *gorm.CallbackProcessor RowQuery() *gorm.CallbackProcessor }
type DatabaseHandler ¶
type DatabaseHandler interface { GetConfig() map[string]interface{} New() DatabaseHandler Close() error Model(value interface{}) DatabaseHandler Table(name string) DatabaseHandler Debug() DatabaseHandler Error() error Callback() DatabaseCallback // NewRecord check if value's primary key is blank NewRecord(value interface{}) bool // RecordNotFound check if returning error RecordNotFound() bool //Table CreateTable(models ...interface{}) DatabaseHandler Set(name string, value interface{}) DatabaseHandler AutoMigrate(values ...interface{}) DatabaseHandler DropTable(values ...interface{}) DatabaseHandler DropTableIfExists(values ...interface{}) DatabaseHandler HasTable(value interface{}) bool ModifyColumn(column string, typ string) DatabaseHandler DropColumn(column string) DatabaseHandler AddIndex(indexName string, columns ...string) DatabaseHandler AddUniqueIndex(indexName string, columns ...string) DatabaseHandler RemoveIndex(indexName string) DatabaseHandler AddForeignKey(field string, dest string, onDelete string, onUpdate string) DatabaseHandler // Query Where(query interface{}, args ...interface{}) DatabaseHandler Or(query interface{}, args ...interface{}) DatabaseHandler Not(query interface{}, args ...interface{}) DatabaseHandler Limit(limit interface{}) DatabaseHandler Offset(offset interface{}) DatabaseHandler Order(value interface{}, reorder ...bool) DatabaseHandler Select(query interface{}, args ...interface{}) DatabaseHandler Omit(columns ...string) DatabaseHandler Having(query string, values ...interface{}) DatabaseHandler Joins(query string, args ...interface{}) DatabaseHandler Find(out interface{}, where ...interface{}) DatabaseHandler First(out interface{}, where ...interface{}) DatabaseHandler Last(out interface{}, where ...interface{}) DatabaseHandler Row() *sql.Row Rows() (*sql.Rows, error) Pluck(column string, value interface{}) DatabaseHandler Count(value interface{}) DatabaseHandler Related(value interface{}, foreignKeys ...string) DatabaseHandler Scan(dest interface{}) DatabaseHandler // Update Update(attrs ...interface{}) DatabaseHandler Updates(values interface{}, ignoreProtectedAttrs ...bool) DatabaseHandler UpdateColumn(attrs ...interface{}) DatabaseHandler UpdateColumns(values interface{}) DatabaseHandler Save(value interface{}) DatabaseHandler // Insert Create(value interface{}) DatabaseHandler // Delete Delete(value interface{}, where ...interface{}) DatabaseHandler Unscoped() DatabaseHandler Scopes(funcs ...func(*gorm.DB) *gorm.DB) DatabaseHandler // Raw Sql Raw(sql string, values ...interface{}) DatabaseHandler Exec(sql string, values ...interface{}) DatabaseHandler // Transaction Begin() DatabaseHandler Commit() DatabaseHandler Rollback() DatabaseHandler }
type Handler ¶
type Handler interface { Initiate(ctx context.Context) error NewDatabase(ctx context.Context, name string, config map[string]interface{}) (DatabaseHandler, error) GetDatabase(name string) (DatabaseHandler, error) }
func NewMysqlHandler ¶
func NewMysqlHandler() Handler
type HbaseDatabaseCallback ¶
type HbaseDatabaseHandler ¶
type HbaseDatabaseHandler struct { Client chan gohbase.Client MaxIdle int MaxActive int Timeout time.Duration Host string User string Password string // contains filtered or unexported fields }
func (*HbaseDatabaseHandler) CheckAndPut ¶
func (*HbaseDatabaseHandler) Close ¶
func (this *HbaseDatabaseHandler) Close()
func (*HbaseDatabaseHandler) GetConnection ¶
func (this *HbaseDatabaseHandler) GetConnection() (client interface{}, err error)
func (*HbaseDatabaseHandler) GetConnectionPoolSize ¶
func (this *HbaseDatabaseHandler) GetConnectionPoolSize() int
func (*HbaseDatabaseHandler) ReleaseConnection ¶
func (this *HbaseDatabaseHandler) ReleaseConnection(client interface{})
回收连接到连接池
func (*HbaseDatabaseHandler) Scan ¶
func (this *HbaseDatabaseHandler) Scan(ctx context.Context, table string) (NosqlDatabaseScanner, error)
type HbaseDatabaseScanner ¶
func (*HbaseDatabaseScanner) Close ¶
func (this *HbaseDatabaseScanner) Close() error
type HbaseHandler ¶
type HbaseHandler struct {
// contains filtered or unexported fields
}
func (*HbaseHandler) GetDatabase ¶
func (this *HbaseHandler) GetDatabase(name string) (NosqlDatabaseHandler, error)
从连接池里取出连接
func (*HbaseHandler) Initiate ¶
func (this *HbaseHandler) Initiate(ctx context.Context) error
批量生成连接,并把连接放到连接池channel里面
func (*HbaseHandler) NewDatabase ¶
func (this *HbaseHandler) NewDatabase(ctx context.Context, name string, config map[string]interface{}) (NosqlDatabaseHandler, error)
type Instance ¶
type Instance struct { Config *config.Instance Utility *utility.Instance // contains filtered or unexported fields }
func NewInstance ¶
func NewInstance() *Instance
func (*Instance) GetDatabase ¶
func (this *Instance) GetDatabase(name string) (DatabaseHandler, error)
func (*Instance) GetNosqlDatabase ¶
func (this *Instance) GetNosqlDatabase(name string) (NosqlDatabaseHandler, error)
func (*Instance) HandlerName ¶
func (*Instance) NewDatabase ¶
func (*Instance) NewNosqlDatabase ¶
func (*Instance) OnRequestShutdown ¶
func (*Instance) OnRequestStartup ¶
func (*Instance) OnShutdown ¶
type MysqlDatabaseHandler ¶
type MysqlDatabaseHandler struct { Db *gorm.DB User string Password string Host string Port string Database string Timezone string Timeout string WriteTimeout string ReadTimeout string MaxOpenConns int MaxIdleConns int }
func (*MysqlDatabaseHandler) AddForeignKey ¶
func (this *MysqlDatabaseHandler) AddForeignKey(field string, dest string, onDelete string, onUpdate string) DatabaseHandler
func (*MysqlDatabaseHandler) AddIndex ¶
func (this *MysqlDatabaseHandler) AddIndex(indexName string, columns ...string) DatabaseHandler
func (*MysqlDatabaseHandler) AddUniqueIndex ¶
func (this *MysqlDatabaseHandler) AddUniqueIndex(indexName string, columns ...string) DatabaseHandler
func (*MysqlDatabaseHandler) AutoMigrate ¶
func (this *MysqlDatabaseHandler) AutoMigrate(values ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Begin ¶
func (this *MysqlDatabaseHandler) Begin() DatabaseHandler
Transaction
func (*MysqlDatabaseHandler) Callback ¶
func (this *MysqlDatabaseHandler) Callback() DatabaseCallback
func (*MysqlDatabaseHandler) Close ¶
func (this *MysqlDatabaseHandler) Close() error
func (*MysqlDatabaseHandler) Commit ¶
func (this *MysqlDatabaseHandler) Commit() DatabaseHandler
func (*MysqlDatabaseHandler) Count ¶
func (this *MysqlDatabaseHandler) Count(value interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Create ¶
func (this *MysqlDatabaseHandler) Create(value interface{}) DatabaseHandler
Insert
func (*MysqlDatabaseHandler) CreateTable ¶
func (this *MysqlDatabaseHandler) CreateTable(models ...interface{}) DatabaseHandler
Table
func (*MysqlDatabaseHandler) Debug ¶
func (this *MysqlDatabaseHandler) Debug() DatabaseHandler
func (*MysqlDatabaseHandler) Delete ¶
func (this *MysqlDatabaseHandler) Delete(value interface{}, where ...interface{}) DatabaseHandler
Delete
func (*MysqlDatabaseHandler) DropColumn ¶
func (this *MysqlDatabaseHandler) DropColumn(column string) DatabaseHandler
func (*MysqlDatabaseHandler) DropTable ¶
func (this *MysqlDatabaseHandler) DropTable(values ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) DropTableIfExists ¶
func (this *MysqlDatabaseHandler) DropTableIfExists(values ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Error ¶
func (this *MysqlDatabaseHandler) Error() error
func (*MysqlDatabaseHandler) Exec ¶
func (this *MysqlDatabaseHandler) Exec(sql string, values ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Find ¶
func (this *MysqlDatabaseHandler) Find(out interface{}, where ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) First ¶
func (this *MysqlDatabaseHandler) First(out interface{}, where ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) GetConfig ¶
func (this *MysqlDatabaseHandler) GetConfig() map[string]interface{}
func (*MysqlDatabaseHandler) HasTable ¶
func (this *MysqlDatabaseHandler) HasTable(value interface{}) bool
func (*MysqlDatabaseHandler) Having ¶
func (this *MysqlDatabaseHandler) Having(query string, values ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Joins ¶
func (this *MysqlDatabaseHandler) Joins(query string, args ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Last ¶
func (this *MysqlDatabaseHandler) Last(out interface{}, where ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Limit ¶
func (this *MysqlDatabaseHandler) Limit(limit interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Model ¶
func (this *MysqlDatabaseHandler) Model(value interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) ModifyColumn ¶
func (this *MysqlDatabaseHandler) ModifyColumn(column string, typ string) DatabaseHandler
func (*MysqlDatabaseHandler) New ¶
func (this *MysqlDatabaseHandler) New() DatabaseHandler
func (*MysqlDatabaseHandler) NewRecord ¶
func (this *MysqlDatabaseHandler) NewRecord(value interface{}) bool
func (*MysqlDatabaseHandler) Not ¶
func (this *MysqlDatabaseHandler) Not(query interface{}, args ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Offset ¶
func (this *MysqlDatabaseHandler) Offset(offset interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Omit ¶
func (this *MysqlDatabaseHandler) Omit(columns ...string) DatabaseHandler
func (*MysqlDatabaseHandler) Or ¶
func (this *MysqlDatabaseHandler) Or(query interface{}, args ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Order ¶
func (this *MysqlDatabaseHandler) Order(value interface{}, reorder ...bool) DatabaseHandler
func (*MysqlDatabaseHandler) Pluck ¶
func (this *MysqlDatabaseHandler) Pluck(column string, value interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Raw ¶
func (this *MysqlDatabaseHandler) Raw(sql string, values ...interface{}) DatabaseHandler
Raw Sql
func (*MysqlDatabaseHandler) RecordNotFound ¶
func (this *MysqlDatabaseHandler) RecordNotFound() bool
func (*MysqlDatabaseHandler) Related ¶
func (this *MysqlDatabaseHandler) Related(value interface{}, foreignKeys ...string) DatabaseHandler
func (*MysqlDatabaseHandler) RemoveIndex ¶
func (this *MysqlDatabaseHandler) RemoveIndex(indexName string) DatabaseHandler
func (*MysqlDatabaseHandler) Rollback ¶
func (this *MysqlDatabaseHandler) Rollback() DatabaseHandler
func (*MysqlDatabaseHandler) Row ¶
func (this *MysqlDatabaseHandler) Row() *sql.Row
func (*MysqlDatabaseHandler) Save ¶
func (this *MysqlDatabaseHandler) Save(value interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Scan ¶
func (this *MysqlDatabaseHandler) Scan(dest interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Scopes ¶
func (this *MysqlDatabaseHandler) Scopes(funcs ...func(*gorm.DB) *gorm.DB) DatabaseHandler
Scoped
func (*MysqlDatabaseHandler) Select ¶
func (this *MysqlDatabaseHandler) Select(query interface{}, args ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Set ¶
func (this *MysqlDatabaseHandler) Set(name string, value interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Table ¶
func (this *MysqlDatabaseHandler) Table(name string) DatabaseHandler
func (*MysqlDatabaseHandler) Unscoped ¶
func (this *MysqlDatabaseHandler) Unscoped() DatabaseHandler
Unscoped
func (*MysqlDatabaseHandler) Update ¶
func (this *MysqlDatabaseHandler) Update(attrs ...interface{}) DatabaseHandler
Update
func (*MysqlDatabaseHandler) UpdateColumn ¶
func (this *MysqlDatabaseHandler) UpdateColumn(attrs ...interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) UpdateColumns ¶
func (this *MysqlDatabaseHandler) UpdateColumns(values interface{}) DatabaseHandler
func (*MysqlDatabaseHandler) Updates ¶
func (this *MysqlDatabaseHandler) Updates(values interface{}, ignoreProtectedAttrs ...bool) DatabaseHandler
func (*MysqlDatabaseHandler) Where ¶
func (this *MysqlDatabaseHandler) Where(query interface{}, args ...interface{}) DatabaseHandler
Query
type MysqlHandler ¶
type MysqlHandler struct {
// contains filtered or unexported fields
}
func (*MysqlHandler) GetDatabase ¶
func (this *MysqlHandler) GetDatabase(name string) (DatabaseHandler, error)
func (*MysqlHandler) NewDatabase ¶
func (this *MysqlHandler) NewDatabase(ctx context.Context, name string, config map[string]interface{}) (DatabaseHandler, error)
type NosqlDatabaseCallback ¶
type NosqlDatabaseCallback interface { }
type NosqlDatabaseHandler ¶
type NosqlDatabaseHandler interface { GetConnection() (client interface{}, err error) ReleaseConnection(client interface{}) GetConnectionPoolSize() int Scan(ctx context.Context, table string) (NosqlDatabaseScanner, error) Get(ctx context.Context, table string, key string) ([]map[string]string, error) Put(ctx context.Context, table string, key string, values map[string]map[string][]byte) (err error) Delete(ctx context.Context, table string, key string, values map[string]map[string][]byte) (err error) Append(ctx context.Context, table string, key string, values map[string]map[string][]byte) error Increment(ctx context.Context, table string, key string, values map[string]map[string][]byte) (int64, error) CheckAndPut(ctx context.Context, table string, key string, values map[string]map[string][]byte, family string, qualifier string, expectedValue []byte) (bool, error) Close() }
type NosqlDatabaseScanner ¶
type NosqlHandler ¶
type NosqlHandler interface { Initiate(ctx context.Context) error NewDatabase(ctx context.Context, name string, config map[string]interface{}) (NosqlDatabaseHandler, error) GetDatabase(name string) (NosqlDatabaseHandler, error) }
func NewHbaseHandler ¶
func NewHbaseHandler() NosqlHandler
Click to show internal directories.
Click to hide internal directories.