Version: v1.1.11 Latest Latest

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




This section is empty.


This section is empty.


func Register

func Register(name string, adapter DBAdapter)

Register register DBAdapter with driver name


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 directory.

func Adapter

func Adapter(name string) (DBAdapter, error)

Adapter get adapter by driver name

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

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