Documentation ¶
Index ¶
- func ConcatValues(begin string, values []string, delim string, end string) string
- func GenerateHash() uint32
- func PrepareStringValue(val interface{}) string
- type Cell
- type InsertStmt
- type MySQLAdmin
- func (dba *MySQLAdmin) CheckDatabaseExists(dbName string) (bool, error)
- func (dba *MySQLAdmin) CheckTableExists(tableName, dbName string) (bool, error)
- func (dba *MySQLAdmin) CreateDatabase(dbName, charset, collation string) error
- func (dba *MySQLAdmin) DropDatabase(dbName string) error
- func (dba *MySQLAdmin) DropTable(tableName, dbName string) error
- func (dba *MySQLAdmin) GetMySQLDBStructure(dbname string, withRoutines, withEvents bool) (*MySQLDBStructure, error)
- func (dba *MySQLAdmin) RenameDatabase(oldName, newName string) error
- func (dba *MySQLAdmin) RenameDatabaseWithDebug(oldName, newName string) error
- type MySQLConfig
- type MySQLConnection
- func CreateMySQLConnection(config *MySQLConfig) (MySQLConnection, error)
- func GetMySQLConnection(host string, port int, user string, password string, dataBase string) MySQLConnection
- func NewMySQLConnection(host string, port int, user string, password string, dataBase string) (MySQLConnection, error)
- func (db *MySQLConnection) Admin() *MySQLAdmin
- func (db *MySQLConnection) Close()
- func (db *MySQLConnection) Commit() *SQLError
- func (db *MySQLConnection) CreateMySQLHandler(table string) *MySQLHandler
- func (db *MySQLConnection) DumpByQuery(query string, tables ...string) ([]string, *SQLError)
- func (db *MySQLConnection) DumpTable(tableName, whereCond string, limit int) ([]string, *SQLError)
- func (db *MySQLConnection) ExecuteCall(procedureName string, params ...interface{}) (ResultSet, *SQLError)
- func (db *MySQLConnection) ExecuteInsert(query string, params ...interface{}) (int64, *SQLError)
- func (db *MySQLConnection) ExecuteUpdate(query string, params ...interface{}) (int64, *SQLError)
- func (db *MySQLConnection) Hash() uint32
- func (db *MySQLConnection) Insert(table string) *InsertStmt
- func (db *MySQLConnection) MasterStatus() *ReplicationInfo
- func (db *MySQLConnection) Replace(table string) *InsertStmt
- func (db *MySQLConnection) ReplicationDelete(channel string)
- func (db *MySQLConnection) ReplicationReset(channel string)
- func (db *MySQLConnection) ReplicationSetup(host, user, pass, binlog, pos, channel string)
- func (db *MySQLConnection) ReplicationSetupByConfig(config *ReplicationInfo)
- func (db *MySQLConnection) ReplicationStart(channel string)
- func (db *MySQLConnection) ReplicationStatus(channel string) *ReplicationInfo
- func (db *MySQLConnection) ReplicationStop(channel string)
- func (db *MySQLConnection) Rollback() *SQLError
- func (db *MySQLConnection) Select(query string, params ...interface{}) (ResultSet, *SQLError)
- func (db *MySQLConnection) SelectNative(query string, params ...interface{}) (*sql.Rows, *SQLError)
- func (db *MySQLConnection) ShowConfigVariablesLike(pattern string) *MySQLVariables
- func (db *MySQLConnection) String() string
- func (db *MySQLConnection) Transaction() *SQLError
- func (db *MySQLConnection) Update(table string) *UpdateStmt
- type MySQLConnectionPool
- type MySQLDBStructure
- type MySQLHandler
- type MySQLVariables
- type ReplicationInfo
- type ResultSet
- func (rs *ResultSet) GetBytes(column interface{}) []byte
- func (rs *ResultSet) GetInt(column interface{}) int
- func (rs *ResultSet) GetLong(column interface{}) int64
- func (rs *ResultSet) GetMetaData() *ResultSetMetaData
- func (rs *ResultSet) GetString(column interface{}) string
- func (rs *ResultSet) MergeWith(rs2 ResultSet)
- func (rs *ResultSet) Next() bool
- func (rs *ResultSet) Print()
- func (rs *ResultSet) Size() int
- type ResultSetMetaData
- type Row
- type SQLError
- type SQLiteConnection
- func (con *SQLiteConnection) Close()
- func (con *SQLiteConnection) ExecuteInsert(query string, params ...interface{}) (int64, error)
- func (con *SQLiteConnection) ExecuteQuery(query string, params ...interface{}) (ResultSet, error)
- func (con *SQLiteConnection) ExecuteUpdate(query string, params ...interface{}) (int64, error)
- type UpdateStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConcatValues ¶
func GenerateHash ¶
func GenerateHash() uint32
func PrepareStringValue ¶
func PrepareStringValue(val interface{}) string
Types ¶
type InsertStmt ¶
type InsertStmt struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////// /////////////////// INSERT & REPLACE /////////////////////// ////////////////////////////////////////////////////////////
func (*InsertStmt) Fields ¶
func (in *InsertStmt) Fields(fields ...string) *InsertStmt
func (*InsertStmt) ReturnGeneratedKey ¶
func (in *InsertStmt) ReturnGeneratedKey() int64
func (*InsertStmt) Run ¶
func (in *InsertStmt) Run() (int64, *SQLError)
func (*InsertStmt) String ¶
func (in *InsertStmt) String() string
func (*InsertStmt) Value ¶
func (in *InsertStmt) Value(values ...interface{}) *InsertStmt
type MySQLAdmin ¶ added in v1.0.1
type MySQLAdmin struct {
// contains filtered or unexported fields
}
func (*MySQLAdmin) CheckDatabaseExists ¶ added in v1.0.1
func (dba *MySQLAdmin) CheckDatabaseExists(dbName string) (bool, error)
func (*MySQLAdmin) CheckTableExists ¶ added in v1.0.2
func (dba *MySQLAdmin) CheckTableExists(tableName, dbName string) (bool, error)
func (*MySQLAdmin) CreateDatabase ¶ added in v1.0.1
func (dba *MySQLAdmin) CreateDatabase(dbName, charset, collation string) error
//////////////////// STRUCTURE //////////////////////////////
func (*MySQLAdmin) DropDatabase ¶ added in v1.0.1
func (dba *MySQLAdmin) DropDatabase(dbName string) error
func (*MySQLAdmin) DropTable ¶ added in v1.0.2
func (dba *MySQLAdmin) DropTable(tableName, dbName string) error
func (*MySQLAdmin) GetMySQLDBStructure ¶ added in v1.0.1
func (dba *MySQLAdmin) GetMySQLDBStructure(dbname string, withRoutines, withEvents bool) (*MySQLDBStructure, error)
func (*MySQLAdmin) RenameDatabase ¶ added in v1.0.1
func (dba *MySQLAdmin) RenameDatabase(oldName, newName string) error
func (*MySQLAdmin) RenameDatabaseWithDebug ¶ added in v1.0.1
func (dba *MySQLAdmin) RenameDatabaseWithDebug(oldName, newName string) error
type MySQLConfig ¶
////////////////// MySQLConfig ////////////////////////
func NewMySQLConfig ¶
func (*MySQLConfig) String ¶
func (conf *MySQLConfig) String() string
type MySQLConnection ¶
type MySQLConnection struct { Config *MySQLConfig // contains filtered or unexported fields }
///////////////// MySQLConnection //////////////////////
func CreateMySQLConnection ¶
func CreateMySQLConnection(config *MySQLConfig) (MySQLConnection, error)
Create connection to database. Working with Bind.close for auto closing connection
func GetMySQLConnection ¶
func GetMySQLConnection(host string, port int, user string, password string, dataBase string) MySQLConnection
Get connection without error. If can't connect - panic
func NewMySQLConnection ¶
func NewMySQLConnection(host string, port int, user string, password string, dataBase string) (MySQLConnection, error)
Get connection with error
func (*MySQLConnection) Admin ¶ added in v1.0.1
func (db *MySQLConnection) Admin() *MySQLAdmin
func (*MySQLConnection) Close ¶
func (db *MySQLConnection) Close()
func (*MySQLConnection) Commit ¶
func (db *MySQLConnection) Commit() *SQLError
func (*MySQLConnection) CreateMySQLHandler ¶
func (db *MySQLConnection) CreateMySQLHandler(table string) *MySQLHandler
func (*MySQLConnection) DumpByQuery ¶
func (db *MySQLConnection) DumpByQuery(query string, tables ...string) ([]string, *SQLError)
//////////////////////////////////////////////////////////// ///////////////////// DUMPING DATA ///////////////////////// ////////////////////////////////////////////////////////////
func (*MySQLConnection) DumpTable ¶
func (db *MySQLConnection) DumpTable(tableName, whereCond string, limit int) ([]string, *SQLError)
func (*MySQLConnection) ExecuteCall ¶
func (db *MySQLConnection) ExecuteCall(procedureName string, params ...interface{}) (ResultSet, *SQLError)
func (*MySQLConnection) ExecuteInsert ¶
func (db *MySQLConnection) ExecuteInsert(query string, params ...interface{}) (int64, *SQLError)
func (*MySQLConnection) ExecuteUpdate ¶
func (db *MySQLConnection) ExecuteUpdate(query string, params ...interface{}) (int64, *SQLError)
func (*MySQLConnection) Hash ¶
func (db *MySQLConnection) Hash() uint32
func (*MySQLConnection) Insert ¶
func (db *MySQLConnection) Insert(table string) *InsertStmt
func (*MySQLConnection) MasterStatus ¶ added in v1.0.5
func (db *MySQLConnection) MasterStatus() *ReplicationInfo
/////////////// Replication ////////////////////
func (*MySQLConnection) Replace ¶
func (db *MySQLConnection) Replace(table string) *InsertStmt
func (*MySQLConnection) ReplicationDelete ¶ added in v1.0.6
func (db *MySQLConnection) ReplicationDelete(channel string)
func (*MySQLConnection) ReplicationReset ¶
func (db *MySQLConnection) ReplicationReset(channel string)
func (*MySQLConnection) ReplicationSetup ¶
func (db *MySQLConnection) ReplicationSetup(host, user, pass, binlog, pos, channel string)
func (*MySQLConnection) ReplicationSetupByConfig ¶ added in v1.0.7
func (db *MySQLConnection) ReplicationSetupByConfig(config *ReplicationInfo)
func (*MySQLConnection) ReplicationStart ¶
func (db *MySQLConnection) ReplicationStart(channel string)
func (*MySQLConnection) ReplicationStatus ¶
func (db *MySQLConnection) ReplicationStatus(channel string) *ReplicationInfo
func (*MySQLConnection) ReplicationStop ¶
func (db *MySQLConnection) ReplicationStop(channel string)
func (*MySQLConnection) Rollback ¶
func (db *MySQLConnection) Rollback() *SQLError
func (*MySQLConnection) Select ¶
func (db *MySQLConnection) Select(query string, params ...interface{}) (ResultSet, *SQLError)
returns ResutSet struct like an java object
func (*MySQLConnection) SelectNative ¶
func (db *MySQLConnection) SelectNative(query string, params ...interface{}) (*sql.Rows, *SQLError)
returns native *sql.Rows
func (*MySQLConnection) ShowConfigVariablesLike ¶
func (db *MySQLConnection) ShowConfigVariablesLike(pattern string) *MySQLVariables
//////////////////// VARIABLES /////////////////////////////
func (*MySQLConnection) String ¶
func (db *MySQLConnection) String() string
func (*MySQLConnection) Transaction ¶
func (db *MySQLConnection) Transaction() *SQLError
func (*MySQLConnection) Update ¶
func (db *MySQLConnection) Update(table string) *UpdateStmt
type MySQLConnectionPool ¶
/////////////// MySQLConnectionPool ////////////////////
func NewMySQLConnectionPool ¶
func NewMySQLConnectionPool(size int, config *MySQLConfig) (*MySQLConnectionPool, error)
func (*MySQLConnectionPool) CloseAll ¶
func (pool *MySQLConnectionPool) CloseAll()
func (*MySQLConnectionPool) Get ¶
func (pool *MySQLConnectionPool) Get() *MySQLConnection
func (*MySQLConnectionPool) Release ¶
func (pool *MySQLConnectionPool) Release(connection *MySQLConnection)
func (*MySQLConnectionPool) Size ¶
func (pool *MySQLConnectionPool) Size() int
func (*MySQLConnectionPool) String ¶
func (pool *MySQLConnectionPool) String() string
type MySQLDBStructure ¶ added in v1.0.1
type MySQLHandler ¶
type MySQLHandler struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////// /////////////////////// HANDLER //////////////////////////// ////////////////////////////////////////////////////////////
func (*MySQLHandler) Close ¶
func (handler *MySQLHandler) Close()
func (*MySQLHandler) HasNext ¶
func (handler *MySQLHandler) HasNext() bool
type MySQLVariables ¶
type MySQLVariables struct {
// contains filtered or unexported fields
}
func (*MySQLVariables) Get ¶
func (v *MySQLVariables) Get(vrName string) string
func (*MySQLVariables) GetBool ¶
func (v *MySQLVariables) GetBool(vrName string) bool
func (*MySQLVariables) GetInt ¶
func (v *MySQLVariables) GetInt(vrName string) int
func (*MySQLVariables) String ¶
func (v *MySQLVariables) String() string
/////////////////// variables //////////////////////////////
type ReplicationInfo ¶
type ReplicationInfo struct { MasterId string Status bool SlaveLag int MasterHost string MasterUser string MasterPass string BinlogFile string BinlogPos string ChannelName string IgnoreServerIds []string }
func (*ReplicationInfo) String ¶
func (replica *ReplicationInfo) String() string
/////////////////// replication ////////////////////////////
func (*ReplicationInfo) StringFull ¶ added in v1.0.7
func (replica *ReplicationInfo) StringFull() string
type ResultSet ¶
type ResultSet struct { Rows []Row // contains filtered or unexported fields }
func (*ResultSet) GetMetaData ¶
func (rs *ResultSet) GetMetaData() *ResultSetMetaData
type ResultSetMetaData ¶
type ResultSetMetaData struct {
// contains filtered or unexported fields
}
func (*ResultSetMetaData) GetColumnCount ¶
func (rsmd *ResultSetMetaData) GetColumnCount() int
func (*ResultSetMetaData) GetColumnName ¶
func (rsmd *ResultSetMetaData) GetColumnName(i int) string
func (*ResultSetMetaData) GetColumnType ¶
func (rsmd *ResultSetMetaData) GetColumnType(i int) string
func (*ResultSetMetaData) Hash ¶
func (rsmd *ResultSetMetaData) Hash() uint32
type SQLiteConnection ¶
type SQLiteConnection struct {
// contains filtered or unexported fields
}
func NewSQLiteConnection ¶
func NewSQLiteConnection(path string) (*SQLiteConnection, error)
func (*SQLiteConnection) Close ¶
func (con *SQLiteConnection) Close()
func (*SQLiteConnection) ExecuteInsert ¶
func (con *SQLiteConnection) ExecuteInsert(query string, params ...interface{}) (int64, error)
returns last insert id or error
func (*SQLiteConnection) ExecuteQuery ¶
func (con *SQLiteConnection) ExecuteQuery(query string, params ...interface{}) (ResultSet, error)
returns ResutSet struct like an java object
func (*SQLiteConnection) ExecuteUpdate ¶
func (con *SQLiteConnection) ExecuteUpdate(query string, params ...interface{}) (int64, error)
returns affected rows count or error
type UpdateStmt ¶
type UpdateStmt struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////// //////////////////////// UPDATE //////////////////////////// ////////////////////////////////////////////////////////////
func (*UpdateStmt) Limit ¶
func (up *UpdateStmt) Limit(limit int) *UpdateStmt
func (*UpdateStmt) Run ¶
func (up *UpdateStmt) Run() (int64, *SQLError)
func (*UpdateStmt) SetField ¶
func (up *UpdateStmt) SetField(fName string, fValue interface{}) *UpdateStmt
func (*UpdateStmt) String ¶
func (up *UpdateStmt) String() string
func (*UpdateStmt) WhereField ¶
func (up *UpdateStmt) WhereField(fName string, fValue interface{}) *UpdateStmt