txn

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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