db

package
v0.0.0-...-d4bf905 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(dbType common.Engine, f driverFunc)

Register makes a database driver available by the provided type. If Register is called twice with the same name or if driver is nil, it panics.

Types

type ConnectionConfig

type ConnectionConfig struct {
	Host     string
	Port     string
	Username string
	Password string
	Database string
}

type Driver

type Driver interface {
	Open(ctx context.Context, dbType common.Engine, config ConnectionConfig) (Driver, error)
	Close(ctx context.Context) error
	Ping(ctx context.Context) error
	GetType() common.Engine
	GetDB() *sql.DB
	// QueryConn Used for execute readonly SELECT statement
	QueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *QueryContext) ([]*v1pb.QueryResult, error)
}

Driver is the interface for database driver

func Open

func Open(ctx context.Context, dbType common.Engine, config ConnectionConfig) (Driver, error)

Open opens a database specified by its database driver type and connection config without verifying the connection.

type ExecuteOptions

type ExecuteOptions struct {
}

ExecuteOptions is the options for execute.

type QueryContext

type QueryContext struct {
	// Limit is the maximum row count returned. No limit enforced if limit <= 0
	Limit int
	// CurrentDatabase is for MySQL
	CurrentDatabase string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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