Documentation
¶
Index ¶
- func Connect(dbType, host string, port int, user, password, dbName string) error
- func Disconnect() error
- type Connection
- type DamengConnection
- func (d *DamengConnection) Connect() error
- func (d *DamengConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
- func (d *DamengConnection) Disconnect() error
- func (d *DamengConnection) Execute(query string) (int64, error)
- func (d *DamengConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
- func (d *DamengConnection) GetTableColumns(tableName string) ([]string, error)
- func (d *DamengConnection) GetTables() ([]string, error)
- func (d *DamengConnection) Query(query string) ([]map[string]interface{}, error)
- func (d *DamengConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
- type DbConfig
- type MSSQLConnection
- func (m *MSSQLConnection) Connect() error
- func (m *MSSQLConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
- func (m *MSSQLConnection) Disconnect() error
- func (m *MSSQLConnection) Execute(query string) (int64, error)
- func (m *MSSQLConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
- func (m *MSSQLConnection) GetTableColumns(tableName string) ([]string, error)
- func (m *MSSQLConnection) GetTables() ([]string, error)
- func (m *MSSQLConnection) Query(query string) ([]map[string]interface{}, error)
- func (m *MSSQLConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
- type MySQLConnection
- func (m *MySQLConnection) Connect() error
- func (m *MySQLConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
- func (m *MySQLConnection) Disconnect() error
- func (m *MySQLConnection) Execute(query string) (int64, error)
- func (m *MySQLConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
- func (m *MySQLConnection) GetTableColumns(tableName string) ([]string, error)
- func (m *MySQLConnection) GetTables() ([]string, error)
- func (m *MySQLConnection) Query(query string) ([]map[string]interface{}, error)
- func (m *MySQLConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
- type OracleConnection
- func (o *OracleConnection) Connect() error
- func (o *OracleConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
- func (o *OracleConnection) Disconnect() error
- func (o *OracleConnection) Execute(query string) (int64, error)
- func (o *OracleConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
- func (o *OracleConnection) GetTableColumns(tableName string) ([]string, error)
- func (o *OracleConnection) GetTables() ([]string, error)
- func (o *OracleConnection) Query(query string) ([]map[string]interface{}, error)
- func (o *OracleConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
- type PostgresConnection
- func (p *PostgresConnection) Connect() error
- func (p *PostgresConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
- func (p *PostgresConnection) Disconnect() error
- func (p *PostgresConnection) Execute(query string) (int64, error)
- func (p *PostgresConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
- func (p *PostgresConnection) GetTableColumns(tableName string) ([]string, error)
- func (p *PostgresConnection) GetTables() ([]string, error)
- func (p *PostgresConnection) Query(query string) ([]map[string]interface{}, error)
- func (p *PostgresConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connection ¶
type Connection interface {
Connect() error
Disconnect() error
Query(query string) ([]map[string]interface{}, error)
QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
Execute(query string) (int64, error)
ExecuteWithParams(query string, args ...interface{}) (int64, error)
GetTables() ([]string, error)
DescribeTable(tableName string) ([]map[string]interface{}, error)
GetTableColumns(tableName string) ([]string, error)
}
Connection 数据库连接接口
func NewOracleConnection ¶
func NewOracleConnection(config *DbConfig) (Connection, error)
NewOracleConnection 创建Oracle数据库连接
type DamengConnection ¶
type DamengConnection struct {
// contains filtered or unexported fields
}
DamengConnection 达梦数据库连接
func NewDamengConnection ¶
func NewDamengConnection(config *DbConfig) (*DamengConnection, error)
NewDamengConnection 创建达梦数据库连接
func (*DamengConnection) DescribeTable ¶
func (d *DamengConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
DescribeTable 获取表结构
func (*DamengConnection) Execute ¶
func (d *DamengConnection) Execute(query string) (int64, error)
Execute 执行更新/插入/删除语句
func (*DamengConnection) ExecuteWithParams ¶
func (d *DamengConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
ExecuteWithParams 执行带参数的更新/插入/删除语句
func (*DamengConnection) GetTableColumns ¶
func (d *DamengConnection) GetTableColumns(tableName string) ([]string, error)
GetTableColumns 获取表字段列表,按字段在表中的顺序排序
func (*DamengConnection) GetTables ¶
func (d *DamengConnection) GetTables() ([]string, error)
GetTables 获取所有表
func (*DamengConnection) Query ¶
func (d *DamengConnection) Query(query string) ([]map[string]interface{}, error)
Query 执行查询语句
func (*DamengConnection) QueryWithParams ¶
func (d *DamengConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
QueryWithParams 执行带参数的查询语句
type MSSQLConnection ¶
type MSSQLConnection struct {
// contains filtered or unexported fields
}
MSSQLConnection MSSQL数据库连接
func NewMSSQLConnection ¶
func NewMSSQLConnection(config *DbConfig) (*MSSQLConnection, error)
NewMSSQLConnection 创建MSSQL数据库连接
func (*MSSQLConnection) DescribeTable ¶
func (m *MSSQLConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
DescribeTable 获取表结构
func (*MSSQLConnection) Execute ¶
func (m *MSSQLConnection) Execute(query string) (int64, error)
Execute 执行更新/插入/删除语句
func (*MSSQLConnection) ExecuteWithParams ¶
func (m *MSSQLConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
ExecuteWithParams 执行带参数的更新/插入/删除语句
func (*MSSQLConnection) GetTableColumns ¶
func (m *MSSQLConnection) GetTableColumns(tableName string) ([]string, error)
GetTableColumns 获取表列名
func (*MSSQLConnection) GetTables ¶
func (m *MSSQLConnection) GetTables() ([]string, error)
GetTables 获取所有表
func (*MSSQLConnection) Query ¶
func (m *MSSQLConnection) Query(query string) ([]map[string]interface{}, error)
Query 执行查询语句
func (*MSSQLConnection) QueryWithParams ¶
func (m *MSSQLConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
QueryWithParams 执行带参数的查询语句
type MySQLConnection ¶
type MySQLConnection struct {
// contains filtered or unexported fields
}
MySQLConnection MySQL数据库连接
func NewMySQLConnection ¶
func NewMySQLConnection(config *DbConfig) (*MySQLConnection, error)
NewMySQLConnection 创建MySQL数据库连接
func (*MySQLConnection) DescribeTable ¶
func (m *MySQLConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
DescribeTable 获取表结构
func (*MySQLConnection) Execute ¶
func (m *MySQLConnection) Execute(query string) (int64, error)
Execute 执行更新/插入/删除语句
func (*MySQLConnection) ExecuteWithParams ¶
func (m *MySQLConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
ExecuteWithParams 执行带参数的更新/插入/删除语句
func (*MySQLConnection) GetTableColumns ¶
func (m *MySQLConnection) GetTableColumns(tableName string) ([]string, error)
GetTableColumns 获取表字段列表,按字段在表中的顺序排序
func (*MySQLConnection) GetTables ¶
func (m *MySQLConnection) GetTables() ([]string, error)
GetTables 获取所有表
func (*MySQLConnection) Query ¶
func (m *MySQLConnection) Query(query string) ([]map[string]interface{}, error)
Query 执行查询语句
func (*MySQLConnection) QueryWithParams ¶
func (m *MySQLConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
QueryWithParams 执行带参数的查询语句
type OracleConnection ¶
type OracleConnection struct {
// contains filtered or unexported fields
}
OracleConnection Oracle数据库连接
func (*OracleConnection) DescribeTable ¶
func (o *OracleConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
DescribeTable 获取表结构
func (*OracleConnection) Execute ¶
func (o *OracleConnection) Execute(query string) (int64, error)
Execute 执行更新/插入/删除语句
func (*OracleConnection) ExecuteWithParams ¶
func (o *OracleConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
ExecuteWithParams 执行带参数的更新/插入/删除语句
func (*OracleConnection) GetTableColumns ¶
func (o *OracleConnection) GetTableColumns(tableName string) ([]string, error)
GetTableColumns 获取表列名
func (*OracleConnection) GetTables ¶
func (o *OracleConnection) GetTables() ([]string, error)
GetTables 获取所有表
func (*OracleConnection) Query ¶
func (o *OracleConnection) Query(query string) ([]map[string]interface{}, error)
Query 执行查询语句
func (*OracleConnection) QueryWithParams ¶
func (o *OracleConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
QueryWithParams 执行带参数的查询语句
type PostgresConnection ¶
type PostgresConnection struct {
// contains filtered or unexported fields
}
PostgresConnection PostgreSQL数据库连接
func NewPostgresConnection ¶
func NewPostgresConnection(config *DbConfig) (*PostgresConnection, error)
NewPostgresConnection 创建PostgreSQL数据库连接
func (*PostgresConnection) Connect ¶
func (p *PostgresConnection) Connect() error
Connect 连接到PostgreSQL数据库
func (*PostgresConnection) DescribeTable ¶
func (p *PostgresConnection) DescribeTable(tableName string) ([]map[string]interface{}, error)
DescribeTable 获取表结构
func (*PostgresConnection) Disconnect ¶
func (p *PostgresConnection) Disconnect() error
Disconnect 断开连接
func (*PostgresConnection) Execute ¶
func (p *PostgresConnection) Execute(query string) (int64, error)
Execute 执行更新/插入/删除语句
func (*PostgresConnection) ExecuteWithParams ¶
func (p *PostgresConnection) ExecuteWithParams(query string, args ...interface{}) (int64, error)
ExecuteWithParams 执行带参数的更新/插入/删除语句
func (*PostgresConnection) GetTableColumns ¶
func (p *PostgresConnection) GetTableColumns(tableName string) ([]string, error)
GetTableColumns 获取表字段列表,按字段在表中的顺序排序
func (*PostgresConnection) GetTables ¶
func (p *PostgresConnection) GetTables() ([]string, error)
GetTables 获取所有表
func (*PostgresConnection) Query ¶
func (p *PostgresConnection) Query(query string) ([]map[string]interface{}, error)
Query 执行查询语句
func (*PostgresConnection) QueryWithParams ¶
func (p *PostgresConnection) QueryWithParams(query string, args ...interface{}) ([]map[string]interface{}, error)
QueryWithParams 执行带参数的查询语句