datasource

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DS

type DS struct {
	Operator dboperator.IOperator
}

func GetDS

func GetDS(dataSourceType gormx.DBType) (ds *DS, err error)

func (*DS) Close

func (ds *DS) Close(dbName string) error

Close database by name

func (*DS) CreateSchema

func (ds *DS) CreateSchema(ctx context.Context, dbName, schemaName, commentInfo string) (err error)

CreateSchema 创建逻辑库

func (*DS) ExecuteDDL

func (ds *DS) ExecuteDDL(ctx context.Context, dbName, logicDBName, tableName, ddlStatement string) (err error)

ExecuteDDL 执行DDL

func (*DS) GetColumns

func (ds *DS) GetColumns(ctx context.Context, dbName string) (dbTableColMap map[string]map[string]*dboperator.TableColInfo, err error)

GetColumns 获取指定库所有逻辑库及表下字段列表

func (*DS) GetColumnsUnderTable

func (ds *DS) GetColumnsUnderTable(ctx context.Context, dbName, logicDBName string, tableNames []string) (tableColMap map[string]*dboperator.TableColInfo, err error)

GetColumnsUnderTable 获取指定库表下字段列表

func (*DS) GetDataBySQL

func (ds *DS) GetDataBySQL(ctx context.Context, dbName, sqlStatement string) (rows []map[string]interface{}, err error)

GetDataBySQL 执行自定义

func (*DS) GetTableData

func (ds *DS) GetTableData(ctx context.Context, dbName, schemaName, tableName string, pageInfo *dboperator.Pagination) (rows []map[string]interface{}, err error)

GetTableData 执行查询表数据, pageInfo为nil时不分页

func (*DS) GetTablesUnderDB

func (ds *DS) GetTablesUnderDB(ctx context.Context, dbName string) (dbTableMap map[string]*dboperator.LogicDBInfo, err error)

GetTablesUnderDB 获取该库下所有逻辑库及表名

func (*DS) Open

func (ds *DS) Open(config *gormx.Config) error

Open open database by config

func (*DS) Ping

func (ds *DS) Ping(dbName string) error

Ping verifies a connection to the database is still alive, establishing a connection if necessary

Jump to

Keyboard shortcuts

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