Documentation ¶
Overview ¶
Package clickhouse implements gdb.Driver, which supports operations for database ClickHouse.
Index ¶
- func New() gdb.Driver
- type Driver
- func (d *Driver) Begin(ctx context.Context) (tx gdb.TX, err error)
- func (d *Driver) ConvertValueForField(ctx context.Context, fieldType string, fieldValue interface{}) (interface{}, error)
- func (d *Driver) DoCommit(ctx context.Context, in gdb.DoCommitInput) (out gdb.DoCommitOutput, err error)
- func (d *Driver) DoDelete(ctx context.Context, link gdb.Link, table string, condition string, ...) (result sql.Result, err error)
- func (d *Driver) DoFilter(ctx context.Context, link gdb.Link, originSql string, args []interface{}) (newSql string, newArgs []interface{}, err error)
- func (d *Driver) DoInsert(ctx context.Context, link gdb.Link, table string, list gdb.List, ...) (result sql.Result, err error)
- func (d *Driver) DoUpdate(ctx context.Context, link gdb.Link, table string, data interface{}, ...) (result sql.Result, err error)
- func (d *Driver) InsertAndGetId(ctx context.Context, table string, data interface{}, batch ...int) (int64, error)
- func (d *Driver) InsertIgnore(ctx context.Context, table string, data interface{}, batch ...int) (sql.Result, error)
- func (d *Driver) New(core *gdb.Core, node *gdb.ConfigNode) (gdb.DB, error)
- func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error)
- func (d *Driver) PingMaster() error
- func (d *Driver) PingSlave() error
- func (d *Driver) Replace(ctx context.Context, table string, data interface{}, batch ...int) (sql.Result, error)
- func (d *Driver) TableFields(ctx context.Context, table string, schema ...string) (fields map[string]*gdb.TableField, err error)
- func (d *Driver) Tables(ctx context.Context, schema ...string) (tables []string, err error)
- func (d *Driver) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
Driver is the driver for postgresql database.
func (*Driver) ConvertValueForField ¶
func (d *Driver) ConvertValueForField(ctx context.Context, fieldType string, fieldValue interface{}) (interface{}, error)
ConvertValueForField converts value to the type of the record field.
func (*Driver) DoCommit ¶
func (d *Driver) DoCommit(ctx context.Context, in gdb.DoCommitInput) (out gdb.DoCommitOutput, err error)
DoCommit commits current sql and arguments to underlying sql driver.
func (*Driver) DoDelete ¶
func (d *Driver) DoDelete(ctx context.Context, link gdb.Link, table string, condition string, args ...interface{}) (result sql.Result, err error)
DoDelete does "DELETE FROM ... " statement for the table.
func (*Driver) DoFilter ¶
func (d *Driver) DoFilter( ctx context.Context, link gdb.Link, originSql string, args []interface{}, ) (newSql string, newArgs []interface{}, err error)
DoFilter handles the sql before posts it to database.
func (*Driver) DoInsert ¶
func (d *Driver) DoInsert( ctx context.Context, link gdb.Link, table string, list gdb.List, option gdb.DoInsertOption, ) (result sql.Result, err error)
DoInsert inserts or updates data for given table.
func (*Driver) DoUpdate ¶
func (d *Driver) DoUpdate(ctx context.Context, link gdb.Link, table string, data interface{}, condition string, args ...interface{}) (result sql.Result, err error)
DoUpdate does "UPDATE ... " statement for the table.
func (*Driver) InsertAndGetId ¶
func (d *Driver) InsertAndGetId(ctx context.Context, table string, data interface{}, batch ...int) (int64, error)
InsertAndGetId Other queries for modifying data parts are not supported: REPLACE, MERGE, UPSERT, INSERT UPDATE.
func (*Driver) InsertIgnore ¶
func (d *Driver) InsertIgnore(ctx context.Context, table string, data interface{}, batch ...int) (sql.Result, error)
InsertIgnore Other queries for modifying data parts are not supported: REPLACE, MERGE, UPSERT, INSERT UPDATE.
func (*Driver) New ¶
New creates and returns a database object for clickhouse. It implements the interface of gdb.Driver for extra database driver installation.
func (*Driver) PingMaster ¶
PingMaster pings the master node to check authentication or keeps the connection alive.
func (*Driver) PingSlave ¶
PingSlave pings the slave node to check authentication or keeps the connection alive.
func (*Driver) Replace ¶
func (d *Driver) Replace(ctx context.Context, table string, data interface{}, batch ...int) (sql.Result, error)
Replace Other queries for modifying data parts are not supported: REPLACE, MERGE, UPSERT, INSERT UPDATE.
func (*Driver) TableFields ¶
func (d *Driver) TableFields(ctx context.Context, table string, schema ...string) (fields map[string]*gdb.TableField, err error)
TableFields retrieves and returns the fields' information of specified table of current schema. Also see DriverMysql.TableFields.