mysql

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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

func NewMysqlAPI(dbURI string, useInformationSchema bool) (api *MysqlAPI)

NewMysqlAPI create new MysqlAPI instance

func (*MysqlAPI) Connection

func (api *MysqlAPI) Connection() *sql.DB

Connection return

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

func (api *MysqlAPI) CurrentDatabaseName() string

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

func (api *MysqlAPI) GetConnectionPool(dbURI string) *sql.DB

GetConnectionPool which Pool is Singleton Connection Pool

func (*MysqlAPI) GetDatabaseMetadata

func (api *MysqlAPI) GetDatabaseMetadata() *DataBaseMetadata

GetDatabaseMetadata return database meta

func (*MysqlAPI) SQL

func (api *MysqlAPI) SQL() *SQL

SQL instance

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 (api *MysqlAPI) SelectTotalCount(option QueryOption) (totalCount int, errorMessage *ErrorMessage)

func (*MysqlAPI) Stop

func (api *MysqlAPI) Stop() *MysqlAPI

Stop MysqlAPI, clean connections

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

func (s *SQL) DeleteByTableAndId(tableName string, id interface{}) (sql string, err error)

DeleteByTableAndId

func (*SQL) GetByTable

func (s *SQL) GetByTable(opt QueryOption) (sql string, err error)

GetByTable with filter

func (*SQL) GetByTableAndID

func (s *SQL) GetByTableAndID(opt QueryOption) (sql string, err error)

GetByTableAndID for specific record in Table

func (*SQL) GetByTableTotalCount

func (s *SQL) GetByTableTotalCount(opt QueryOption) (sql string, err error)

func (*SQL) InsertByTable

func (s *SQL) InsertByTable(tableName string, record map[string]interface{}) (sql string, err error)

InsertByTable and record map

func (*SQL) UpdateByTableAndId

func (s *SQL) UpdateByTableAndId(tableName string, id interface{}, record map[string]interface{}) (sql string, err error)

UpdateByTable for update specific record by id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL