octillery: go.knocknote.io/octillery/connection/adapter Index | Files

package adapter

import "go.knocknote.io/octillery/connection/adapter"

Index

Package Files

adapter.go

func Register Uses

func Register(name string, adapter DBAdapter)

Register register DBAdapter with driver name

type DBAdapter Uses

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 Uses

func Adapter(name string) (DBAdapter, error)

Adapter get adapter by driver name

Package adapter imports 5 packages (graph) and is imported by 3 packages. Updated 2018-12-03. Refresh now. Tools for package owners.