Documentation ¶
Index ¶
- type MysqlAPI
- func (api *MysqlAPI) Connection() *sql.DB
- func (api *MysqlAPI) Create(table string, obj map[string]interface{}) (rs sql.Result, errorMessage *ErrorMessage)
- func (api *MysqlAPI) CurrentDatabaseName() string
- func (api *MysqlAPI) Delete(table string, id interface{}, obj map[string]interface{}) (rs sql.Result, errorMessage *ErrorMessage)
- func (api *MysqlAPI) GetConnectionPool(dbURI string) *sql.DB
- func (api *MysqlAPI) GetDatabaseMetadata() *DataBaseMetadata
- func (api *MysqlAPI) SQL() *SQL
- func (api *MysqlAPI) Select(option QueryOption) (rs []map[string]interface{}, errorMessage *ErrorMessage)
- func (api *MysqlAPI) SelectTotalCount(option QueryOption) (totalCount int, errorMessage *ErrorMessage)
- func (api *MysqlAPI) Stop() *MysqlAPI
- func (api *MysqlAPI) Update(table string, id interface{}, obj map[string]interface{}) (rs sql.Result, errorMessage *ErrorMessage)
- func (api *MysqlAPI) UpdateAPIMetadata() adapter.IDatabaseAPI
- type SQL
- func (s *SQL) DeleteByTable(tableName string, mWhere map[string]interface{}) (sql string, err error)
- func (s *SQL) DeleteByTableAndId(tableName string, id interface{}) (sql string, err error)
- func (s *SQL) GetByTable(opt QueryOption) (sql string, err error)
- func (s *SQL) GetByTableAndID(opt QueryOption) (sql string, err error)
- func (s *SQL) GetByTableTotalCount(opt QueryOption) (sql string, err error)
- func (s *SQL) InsertByTable(tableName string, record map[string]interface{}) (sql string, err error)
- func (s *SQL) UpdateByTableAndId(tableName string, id interface{}, record map[string]interface{}) (sql string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MysqlAPI ¶
type MysqlAPI struct {
// contains filtered or unexported fields
}
MysqlAPI
func NewMysqlAPI ¶
NewMysqlAPI create new MysqlAPI instance
func (*MysqlAPI) Create ¶
func (api *MysqlAPI) Create(table string, obj map[string]interface{}) (rs sql.Result, errorMessage *ErrorMessage)
Create by Table name and obj map
func (*MysqlAPI) CurrentDatabaseName ¶
CurrentDatabaseName return current database
func (*MysqlAPI) Delete ¶
func (api *MysqlAPI) Delete(table string, id interface{}, obj map[string]interface{}) (rs sql.Result, errorMessage *ErrorMessage)
Delete by Table name and where obj
func (*MysqlAPI) GetConnectionPool ¶
GetConnectionPool which Pool is Singleton Connection Pool
func (*MysqlAPI) GetDatabaseMetadata ¶
func (api *MysqlAPI) GetDatabaseMetadata() *DataBaseMetadata
GetDatabaseMetadata return database meta
func (*MysqlAPI) Select ¶
func (api *MysqlAPI) Select(option QueryOption) (rs []map[string]interface{}, errorMessage *ErrorMessage)
Select by Table name , where or id
func (*MysqlAPI) SelectTotalCount ¶
func (*MysqlAPI) Update ¶
func (api *MysqlAPI) Update(table string, id interface{}, obj map[string]interface{}) (rs sql.Result, errorMessage *ErrorMessage)
Update by Table name and obj map
func (*MysqlAPI) UpdateAPIMetadata ¶
func (api *MysqlAPI) UpdateAPIMetadata() adapter.IDatabaseAPI
UpdateAPIMetadata use to update the metadata of the MySQLAPI instance
If database tables structure changed, it will be useful
type SQL ¶
type SQL struct {
// contains filtered or unexported fields
}
SQL return sqls by sql builder
func (*SQL) DeleteByTable ¶
func (s *SQL) DeleteByTable(tableName string, mWhere map[string]interface{}) (sql string, err error)
DeleteByTable by where
func (*SQL) DeleteByTableAndId ¶
DeleteByTableAndId
func (*SQL) GetByTable ¶
GetByTable with filter
func (*SQL) GetByTableAndID ¶
GetByTableAndID for specific record in Table
func (*SQL) GetByTableTotalCount ¶
Click to show internal directories.
Click to hide internal directories.