txn

package
v1.0.0-rc2 Latest Latest
Warning

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

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

Documentation

Overview

The current package is based on an integration testing framework to test end-to-end transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// NewTxn create a txn to execute read and write command
	NewTxn(options ...client.TxnOption) (Txn, error)
}

Client used to execute read and write.

type Cluster

type Cluster interface {
	// Start start the cluster, block until all service started and all DNShard created
	Start()
	// Stop stop the cluster
	Stop()
	// Env return the test cluster env
	Env() service.Cluster
	// NewClient create a test txn client
	NewClient() Client
	// GetLogger returns the logger
	GetLogger() *zap.Logger
}

Cluster txn testing cluster

func NewCluster

func NewCluster(ctx context.Context, t *testing.T, options service.Options) (Cluster, error)

NewCluster new txn testing cluster based on the service.Cluster

type SQLBasedTxn

type SQLBasedTxn interface {
	Txn
	// ExecSQL exec sql, ddl/insert/update/delete
	ExecSQL(sql string) (sql.Result, error)
	// ExecSQLQuery exec query
	ExecSQLQuery(sql string) (*sql.Rows, error)
}

SQLBasedTxn support exec raw sql Txn

type Txn

type Txn interface {
	// Commit commit the txn
	Commit() error
	// Rollback rollback the txn
	Rollback() error
	// Read read by key
	Read(key string) (string, error)
	// Write write key
	Write(key, value string) error
}

Txn txn operation handler

Jump to

Keyboard shortcuts

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