db

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(db *Database, engine string, dbName string, tableName string) (int, error)

Count count the number of rows in a table.

func CreateTiFlashReplicationAndWaitToComplete

func CreateTiFlashReplicationAndWaitToComplete(a *TiFlashAction, db, table string, replicaCount int, timeout time.Duration) error

CreateTiFlashReplicationAndWaitToComplete create TiFlash replication and wait it to complete.

TODO: support to set replica to 0.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is a wrapper of sql.DB in order to provide some common fuction for test.

func NewDatabase

func NewDatabase(dataSourceName string) (*Database, error)

func NewDatabaseOrDie

func NewDatabaseOrDie(dataSourceName string) *Database

func (*Database) Close

func (d *Database) Close() error

func (*Database) Ping

func (d *Database) Ping() error

func (*Database) QueryInSession

func (d *Database) QueryInSession(query func(s *Session)) error

QueryInSession creates a new session and call the query function.

func (*Database) Session

func (d *Database) Session() (*Session, error)

Session creates a new session.

func (*Database) TiFlashAction

func (d *Database) TiFlashAction() *TiFlashAction

TiFlashAction create a TiFlashAction

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) Close

func (s *Session) Close() error

Close the connection.

func (*Session) Count

func (s *Session) Count(ctx context.Context, dbName string, table string) (int, error)

Count the number of rows in the table.

func (*Session) Query

func (s *Session) Query(ctx context.Context, sql string) (*sql.Rows, error)

func (*Session) SetEngine

func (s *Session) SetEngine(ctx context.Context, engines ...string) error

SetEngine set the storage engine of the database.

type TiFlashAction

type TiFlashAction struct {
	// contains filtered or unexported fields
}

func (*TiFlashAction) CreateReplicas

func (a *TiFlashAction) CreateReplicas(db, table string, count int) error

CreateReplicas create TiFLash replicas for a table

func (*TiFlashAction) QueryReplication

func (a *TiFlashAction) QueryReplication(db, table string) (*TiFlashReplication, error)

QueryReplication query replication progress

type TiFlashReplication

type TiFlashReplication struct {
	ReplicaCount int
	Available    bool
	Progress     float32
}

func (TiFlashReplication) IsAvailable

func (r TiFlashReplication) IsAvailable() bool

func (TiFlashReplication) IsComplete

func (r TiFlashReplication) IsComplete() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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