Documentation
¶
Index ¶
- type Hub
- func (h *Hub) BeginTx() (*Hub, error)
- func (h *Hub) Close()
- func (h *Hub) CloseConnection(idx int, conn dbflex.IConnection)
- func (h *Hub) Commit() error
- func (h *Hub) Count(data orm.DataModel, qp *dbflex.QueryParam) (int, error)
- func (h *Hub) Delete(data orm.DataModel) error
- func (h *Hub) DeleteQuery(model orm.DataModel, where *dbflex.Filter) error
- func (h *Hub) EnsureTable(name string, keys []string, object interface{}) error
- func (h *Hub) Execute(cmd dbflex.ICommand, object interface{}) (interface{}, error)
- func (h *Hub) Get(data orm.DataModel) error
- func (h *Hub) GetByID(data orm.DataModel, ids ...interface{}) error
- func (h *Hub) GetByParm(data orm.DataModel, parm *dbflex.QueryParam) error
- func (h *Hub) GetClassicConnection() (dbflex.IConnection, error)
- func (h *Hub) GetConnection() (int, dbflex.IConnection, error)
- func (h *Hub) Gets(data orm.DataModel, parm *dbflex.QueryParam, dest interface{}) error
- func (h *Hub) Insert(data orm.DataModel) error
- func (h *Hub) Log() *toolkit.LogEngine
- func (h *Hub) PoolSize() int
- func (h *Hub) Populate(cmd dbflex.ICommand, result interface{}) (int, error)
- func (h *Hub) PopulateByParm(tableName string, parm *dbflex.QueryParam, dest interface{}) error
- func (h *Hub) PopulateSQL(sql string, dest interface{}) error
- func (h *Hub) Rollback() error
- func (h *Hub) Save(data orm.DataModel) error
- func (h *Hub) SaveAny(name string, object interface{}) error
- func (h *Hub) SetAutoCloseDuration(d time.Duration) *Hub
- func (h *Hub) SetAutoReleaseDuration(d time.Duration) *Hub
- func (h *Hub) SetLog(l *toolkit.LogEngine) *Hub
- func (h *Hub) Update(data orm.DataModel) error
- func (h *Hub) UpdateAny(name string, object interface{}, fields ...string) error
- func (h *Hub) UpdateField(data orm.DataModel, where *dbflex.Filter, fields ...string) error
- func (h *Hub) UsePool() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub main datahub object. This object need to be initiated to work with datahub
func (*Hub) BeginTx ¶ added in v0.1.4
BeginTx create a hub with Transaction. Commit and/or Rollback need to call later on to close the transaction
func (*Hub) CloseConnection ¶
func (h *Hub) CloseConnection(idx int, conn dbflex.IConnection)
CloseConnection to close connection
func (*Hub) DeleteQuery ¶
DeleteQuery delete object in database based on specific model and filter
func (*Hub) EnsureTable ¶ added in v0.1.7
EnsureTable will ensure existense of table according to given object
func (*Hub) Get ¶
Get return single data based on model. It will find record based on releant ID field
func (*Hub) GetByID ¶
GetByID returns single data based on its ID. Data need to be comply with orm.DataModel
func (*Hub) GetClassicConnection ¶
func (h *Hub) GetClassicConnection() (dbflex.IConnection, error)
GetClassicConnection get connection without using pool. CleanUp operation need to be done manually
func (*Hub) GetConnection ¶
func (h *Hub) GetConnection() (int, dbflex.IConnection, error)
GetConnection to generate connection. It will return index, connection and error. Index and connection need to be retain for purpose of closing the connection. It is advised to use other DB operation related of Hub rather than build manual connection
func (*Hub) Populate ¶
Populate will return all data based on command. Normally used with no-datamodel object
func (*Hub) PopulateByParm ¶
func (h *Hub) PopulateByParm(tableName string, parm *dbflex.QueryParam, dest interface{}) error
PopulateByParm returns all data based on table name and QueryParm. Normally used with no-datamodel object
func (*Hub) PopulateSQL ¶ added in v0.1.3
PopulateSQL returns data based on SQL Query
func (*Hub) SaveAny ¶
SaveAny save any object into database table. Normally used with no-datamodel object
func (*Hub) SetAutoCloseDuration ¶
SetAutoCloseDuration set duration for a connection inside Hub Pool to be closed if it is not being used
func (*Hub) SetAutoReleaseDuration ¶
SetAutoReleaseDuration set duration for a connection in pool to be released for a process
func (*Hub) UpdateAny ¶ added in v0.1.2
UpdateAny update specific fields on database table. Normally used with no-datamodel object Will be deprecated
func (*Hub) UpdateField ¶
UpdateField update relevant fields in data based on specific filter