Documentation
¶
Index ¶
- type ConnectionInfo
- type ISQLConnector
- type MySQLConnectorImpl
- func (conn *MySQLConnectorImpl) CheckAndReopen() error
- func (conn *MySQLConnectorImpl) Close() error
- func (conn *MySQLConnectorImpl) Create(table string, params map[string]interface{}) error
- func (conn *MySQLConnectorImpl) Delete(table string, constraint string) error
- func (conn *MySQLConnectorImpl) Open() error
- func (conn *MySQLConnectorImpl) Read(table string, constraint string) ([]map[string]interface{}, error)
- func (conn *MySQLConnectorImpl) SetInfo(info *ConnectionInfo)
- func (conn *MySQLConnectorImpl) Update(table string, params map[string]interface{}, constraint string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionInfo ¶
type ConnectionInfo struct {
Domain string
Port string
Username string
Password string
TargetName string // Database name
}
ConnectionInfo is detail info of remote database
func NewConnectionInfo ¶
func NewConnectionInfo(domain string, port string, username string, password string, dbName string) *ConnectionInfo
NewConnectionInfo is factor pattern of ConnectionInfo
type ISQLConnector ¶
type ISQLConnector interface {
Open() error
Close() error
// Create(table string, params map[string]interface{})
Create(string, map[string]interface{}) error
// Read(table string, constraint string)
Read(string, string) ([]map[string]interface{}, error)
// Update function will send select command for find target data out from particular {table}
Update(string, map[string]interface{}, string) error
// Delete function will send delete command for remove some target matches {constraint}
Delete(string, string) error
}
ISQLConnector is interface of database connector which handles all manipulation from user
func NewMySQLLConnector ¶
func NewMySQLLConnector(info *ConnectionInfo) ISQLConnector
NewMySQLLConnector is factor pattern of Connector
type MySQLConnectorImpl ¶
type MySQLConnectorImpl struct {
// contains filtered or unexported fields
}
MySQLConnectorImpl is implmentation of IConnector
func (*MySQLConnectorImpl) CheckAndReopen ¶
func (conn *MySQLConnectorImpl) CheckAndReopen() error
CheckAndReopen function will check connection status with DB and reopen when connection is offline
func (*MySQLConnectorImpl) Close ¶
func (conn *MySQLConnectorImpl) Close() error
Close connection with remote database
func (*MySQLConnectorImpl) Create ¶
func (conn *MySQLConnectorImpl) Create(table string, params map[string]interface{}) error
Create will insert data into particular table()
func (*MySQLConnectorImpl) Delete ¶
func (conn *MySQLConnectorImpl) Delete(table string, constraint string) error
Delete function will send delete command for remove some target matches {constraint}
func (*MySQLConnectorImpl) Open ¶
func (conn *MySQLConnectorImpl) Open() error
Open connection with remote database
func (*MySQLConnectorImpl) Read ¶
func (conn *MySQLConnectorImpl) Read(table string, constraint string) ([]map[string]interface{}, error)
Read function will send select command to find target data matches {constraint} from particular {table}
func (*MySQLConnectorImpl) SetInfo ¶
func (conn *MySQLConnectorImpl) SetInfo(info *ConnectionInfo)
SetInfo as connection info