kingbase

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

README

kingbase

介绍

GoFrame的金仓版驱动

Documentation

Overview

Package kingbase implements gdb.Driver, which supports operations for database Kingbase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() gdb.Driver

New create and returns a driver that implements gdb.Driver, which supports operations for kingbase.

Types

type Driver

type Driver struct {
	*gdb.Core
}

func (*Driver) CheckLocalTypeForField

func (d *Driver) CheckLocalTypeForField(ctx context.Context, fieldType string, fieldValue interface{}) (gdb.LocalType, error)

CheckLocalTypeForField checks and returns corresponding local golang type for given db type.

func (*Driver) ConvertValueForField

func (d *Driver) ConvertValueForField(ctx context.Context, fieldType string, fieldValue interface{}) (interface{}, error)

ConvertValueForField converts value to database acceptable value.

func (*Driver) ConvertValueForLocal

func (d *Driver) ConvertValueForLocal(ctx context.Context, fieldType string, fieldValue interface{}) (interface{}, error)

ConvertValueForLocal converts value to local Golang type of value according field type name from database. The parameter `fieldType` is in lower case, like: `float(5,2)`, `unsigned double(5,2)`, `decimal(10,2)`, `char(45)`, `varchar(100)`, etc.

func (*Driver) FormatUpsert

func (d *Driver) FormatUpsert(columns []string, _ gdb.List, option gdb.DoInsertOption) (string, error)

FormatUpsert returns SQL clause of type upsert for Kingbase. For example: ON CONFLICT (id) DO UPDATE SET ...

func (*Driver) GetChars

func (d *Driver) GetChars() (charLeft string, charRight string)

GetChars returns the security char for this type of database.

func (*Driver) New

func (d *Driver) New(core *gdb.Core, _ *gdb.ConfigNode) (gdb.DB, error)

New creates and returns a database object for kingbase.

func (*Driver) Open

func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error)

Open creates and returns an underlying sql.DB object for kingbase.

func (*Driver) TableFields

func (d *Driver) TableFields(ctx context.Context, table string, schema ...string) (fields map[string]*gdb.TableField, err error)

func (*Driver) Tables

func (d *Driver) Tables(ctx context.Context, schema ...string) (tables []string, err error)

Tables retrieves and returns the tables of current schema. It's mainly used in cli tool chain for automatically generating the models.

Directories

Path Synopsis
gokb包为基于database/sql包的Kingbase驱动
gokb包为基于database/sql包的Kingbase驱动
oid
oid包定义了服务端数据类型的oid
oid包定义了服务端数据类型的oid
scram
***************************************************************************** * 版权信息:北京人大金仓信息技术股份有限公司
***************************************************************************** * 版权信息:北京人大金仓信息技术股份有限公司
sm3
***************************************************************************** * 版权信息:北京人大金仓信息技术股份有限公司
***************************************************************************** * 版权信息:北京人大金仓信息技术股份有限公司

Jump to

Keyboard shortcuts

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