adapter

package
Version: v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, adapter DBAdapter)

Register register DBAdapter with driver name

Types

type DBAdapter

type DBAdapter interface {
	// get current unique id for all shards by sequencer
	CurrentSequenceID(conn *sql.DB, tableName string) (int64, error)

	// get next unique id for all shards by sequencer
	NextSequenceID(conn *sql.DB, tableName string) (int64, error)

	// create database if not exists by database configuration file.
	ExecDDL(config *config.DatabaseConfig) error

	// open connection by database configuration file
	OpenConnection(config *config.DatabaseConfig, queryValues string) (*sql.DB, error)

	// create table for sequencer if not exists
	CreateSequencerTableIfNotExists(conn *sql.DB, tableName string) error

	// insert first row to sequencer if not exists
	InsertRowToSequencerIfNotExists(conn *sql.DB, tableName string) error
}

DBAdapter is a adapter for common sequence each database driver.

octillery currently supports mysql and sqlite3. If use the other new adapter, implement the following interface as plugin ( new_adapter.go ) and call adapter.Register("adapter_name", &NewAdapterStructure{}). Also, new_adapter.go file should put inside go.knocknote.io/octillery/plugin directory.

func Adapter

func Adapter(name string) (DBAdapter, error)

Adapter get adapter by driver name

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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