driver

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CollectorStore = map[string]ResultCollection{}

CollectorStore holds a map of ResultCollection

View Source
var ConsistencyLookup = map[gocql.Consistency]string{
	gocql.Any:         `Any`,
	gocql.One:         `One`,
	gocql.LocalOne:    `LocalOne`,
	gocql.LocalQuorum: `LocalQuorum`,
	gocql.Quorum:      `Quorum`,
	gocql.All:         `All`,
}

ConsistencyLookup is a map of Cassandra consistency types. see https://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlClientRequestsReadExp.html?hl=consistency

View Source
var DriverManager = NewManager()

DriverManager is where drivers register.

Functions

This section is empty.

Types

type Args

type Args map[string]interface{}

Args are used for populating a query

func (Args) Get

func (r Args) Get(key string) interface{}

Get a value from Args

func (Args) Set

func (r Args) Set(key string, value interface{})

Set a value on Args

type Argset

type Argset struct {
	// contains filtered or unexported fields
}

Argset implements data.Driver

func (*Argset) ArgCount

func (a *Argset) ArgCount(query string) int

ArgCount calculate the number of expected arguments for a specified query with this driver.

func (*Argset) ConfigSurvey

func (a *Argset) ConfigSurvey(config Config, machineName string) error

ConfigSurvey is an implementation of Driver

func (*Argset) Configure

func (a *Argset) Configure(config Config) error

Configure (keys determined in ConfigSurvey)

func (*Argset) Done

func (a *Argset) Done() error

Done for Driver interface.

func (*Argset) ExpectedOut

func (a *Argset) ExpectedOut() (bool, int, error)

ExpectedOut returns true and the number of expected outbound records, false value mean indefinite.

func (*Argset) GetArgs

func (a *Argset) GetArgs() []string

GetArgs returns the args as a string slice.

func (*Argset) HasCountQuery

func (a *Argset) HasCountQuery() bool

HasCountQuery

func (*Argset) HasInQuery

func (a *Argset) HasInQuery() bool

HasInQuery

func (*Argset) HasOutQuery

func (a *Argset) HasOutQuery() bool

HasOutQuery

func (*Argset) In

func (a *Argset) In(query string, args []string, record Record) error

In for Driver interface. @TODO implementation

func (*Argset) Init

func (a *Argset) Init()

Init initializes at the beginning of each run.

func (*Argset) Out

func (a *Argset) Out(query string, args []string) (<-chan Record, error)

Out for Driver interface. Argset turns args into Record

type CSV

type CSV struct {
	// contains filtered or unexported fields
}

CSV implements data.Driver

func (*CSV) ArgCount

func (c *CSV) ArgCount(query string) int

ArgCount calculate the number of expected arguments for a specified query with this driver.

func (*CSV) ConfigSurvey

func (c *CSV) ConfigSurvey(config Config, machineName string) error

ConfigSurvey is an implementation of Driver

func (*CSV) Configure

func (c *CSV) Configure(config Config) error

Configure (keys determined in ConfigSurvey)

func (*CSV) Done

func (c *CSV) Done() error

Done for Driver interface.

func (*CSV) ExpectedOut

func (c *CSV) ExpectedOut() (bool, int, error)

ExpectedOut returns true and the number of expected outbound records, false value mean indefinite. TODO: Implement expected out for CSV

func (*CSV) HasCountQuery

func (c *CSV) HasCountQuery() bool

HasCountQuery is false for CSV TODO: implement counter

func (*CSV) HasInQuery

func (c *CSV) HasInQuery() bool

HasInQuery is false for CSV

func (*CSV) HasOutQuery

func (c *CSV) HasOutQuery() bool

HasOutQuery is false for CSV

func (*CSV) In

func (c *CSV) In(query string, args []string, record Record) error

In for Driver interface. @TODO implementation

func (*CSV) Init

func (c *CSV) Init()

Init initializes at the beginning of each run.

func (*CSV) Out

func (c *CSV) Out(query string, args []string) (<-chan Record, error)

Out for Driver interface. CSV ignores the query and args, reading the entire file and streaming each record as lines are parsed.

type Cassandra

type Cassandra struct {
	// contains filtered or unexported fields
}

Cassandra implements data.Driver

func (*Cassandra) ArgCount

func (c *Cassandra) ArgCount(query string) int

ArgCount calculate the number of expected arguments for a specified query with this driver.

func (*Cassandra) ConfigSurvey

func (c *Cassandra) ConfigSurvey(config Config, machineName string) error

ConfigSurvey is an implementation of Driver

func (*Cassandra) Configure

func (c *Cassandra) Configure(config Config) error

Configure (keys determined in ConfigSurvey)

func (*Cassandra) Done

func (c *Cassandra) Done() error

Done for Driver interface.

func (*Cassandra) ExpectedOut

func (c *Cassandra) ExpectedOut() (bool, int, error)

ExpectedOut returns true and the number of expected outbound records, false value mean indefinite.

func (*Cassandra) HasCountQuery

func (c *Cassandra) HasCountQuery() bool

HasCountQuery is true for Cassandra

func (*Cassandra) HasInQuery

func (c *Cassandra) HasInQuery() bool

HasInQuery is true for Cassandra

func (*Cassandra) HasOutQuery

func (c *Cassandra) HasOutQuery() bool

HasOutQuery is true for Cassandra

func (*Cassandra) In

func (c *Cassandra) In(query string, args []string, record Record) error

In for Driver interface.

func (*Cassandra) Init

func (c *Cassandra) Init()

Init initializes at the beginning of each run.

func (*Cassandra) Out

func (c *Cassandra) Out(query string, args []string) (<-chan Record, error)

Out for Driver interface. Data coming out of Cassandra

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector implements data.Driver TODO: implement a generate persistent kv object store

func (*Collector) ArgCount

func (c *Collector) ArgCount(query string) int

ArgCount calculate the number of expected arguments for a specified query with this driver.

func (*Collector) ConfigSurvey

func (c *Collector) ConfigSurvey(config Config, machineName string) error

ConfigSurvey is an implementation of Driver

func (*Collector) Configure

func (c *Collector) Configure(config Config) error

Configure (keys determined in ConfigSurvey)

func (*Collector) Done

func (c *Collector) Done() error

Done for Driver interface.

func (*Collector) ExpectedOut

func (c *Collector) ExpectedOut() (bool, int, error)

ExpectedOut returns true and the number of expected outbound records,

func (*Collector) GetCollection

func (c *Collector) GetCollection() []ResultCollectionItem

GetCollection returns slice of ResultCollectionItem

func (*Collector) HasCountQuery

func (c *Collector) HasCountQuery() bool

HasCountQuery is false for Collector

func (*Collector) HasInQuery

func (c *Collector) HasInQuery() bool

HasInQuery is false for Collector

func (*Collector) HasOutQuery

func (c *Collector) HasOutQuery() bool

HasOutQuery is false for Collector

func (*Collector) In

func (c *Collector) In(query string, args []string, record Record) error

In for Driver interface.

func (*Collector) Init

func (c *Collector) Init()

Init initializes at the beginning of each run.

func (*Collector) Out

func (c *Collector) Out(query string, args []string) (<-chan Record, error)

Out for Driver interface.

type Config

type Config map[string]interface{}

Config is a map or configuration data specific to a specialized Driver

type DataMap

type DataMap interface {
	Get(key string) interface{}
	Set(key string, value interface{})
}

DataMap is the minimal interface for Records and Args.

type Debug

type Debug struct {
	// contains filtered or unexported fields
}

Debug implements data.Driver

func (*Debug) ArgCount

func (d *Debug) ArgCount(query string) int

ArgCount calculate the number of expected arguments for a specified query with this driver.

func (*Debug) ConfigSurvey

func (d *Debug) ConfigSurvey(config Config, machineName string) error

ConfigSurvey is an implementation of Driver

func (*Debug) Configure

func (d *Debug) Configure(config Config) error

Configure (keys determined in ConfigSurvey)

func (*Debug) Done

func (d *Debug) Done() error

Done for Driver interface.

func (*Debug) ExpectedOut

func (d *Debug) ExpectedOut() (bool, int, error)

ExpectedOut returns true and the number of expected outbound records, false value mean indefinite.

func (*Debug) HasCountQuery

func (d *Debug) HasCountQuery() bool

HasCountQuery is false for Debug

func (*Debug) HasInQuery

func (d *Debug) HasInQuery() bool

HasInQuery is false for Debug

func (*Debug) HasOutQuery

func (d *Debug) HasOutQuery() bool

HasOutQuery is false for Debug

func (*Debug) In

func (d *Debug) In(query string, args []string, record Record) error

In for Driver interface.

func (*Debug) Init

func (d *Debug) Init()

Init initializes at the beginning of each run.

func (*Debug) Out

func (d *Debug) Out(query string, args []string) (<-chan Record, error)

Out for Driver interface. CSV ignores the query and args, reading the entire file and streaming each record as lines are parsed.

type Driver

type Driver interface {
	Configure(config Config) error                          // Takes a config map
	ConfigSurvey(config Config, machineName string) error   // Interactive config generator
	Init()                                                  // Initialization tasks (as drivers may be reused)
	Out(query string, args []string) (<-chan Record, error) // outbound data
	In(query string, args []string, record Record) error    // inbound data
	Done() error                                            // finalization tasks when runner is done with In
	// ExpectedOut is the number of records we expect
	// from the source, some drivers can determine
	// expected output without a source query
	ArgCount(query string) int       // returns the number of expected args for a query
	ExpectedOut() (bool, int, error) // a false return means indefinite
	HasOutQuery() bool               // does this driver use a query to get data
	HasInQuery() bool                // does this driver use a query to set data
	HasCountQuery() bool             // does this driver have a count query
}

Driver managed configuration and of a database and executes queries against it.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles the collection of drivers

func NewManager

func NewManager() *Manager

NewManager creates a new driver manager

func (*Manager) AddDriver

func (m *Manager) AddDriver(machineName string, driverFactory func() Driver)

AddDriver adds a driver to the DriverManager

func (*Manager) GetNewDriver

func (m *Manager) GetNewDriver(machineName string) (Driver, error)

GetNewDriver returns a new un-configured Driver

func (*Manager) RegisteredDrivers

func (m *Manager) RegisteredDrivers() []string

RegisteredDrivers returns a string slice of driver machine names

type MySql

type MySql struct {
	// contains filtered or unexported fields
}

MySql implements data.Driver

func (*MySql) ArgCount

func (m *MySql) ArgCount(query string) int

ArgCount calculate the numer of expected arguments for a specified query with this driver.

func (*MySql) ConfigSurvey

func (m *MySql) ConfigSurvey(config Config, machineName string) error

ConfigSurvey is an implementation of Driver

func (*MySql) Configure

func (m *MySql) Configure(config Config) error

Configure (keys determined in ConfigSurvey)

func (*MySql) Done

func (m *MySql) Done() error

Done for Driver interface.

func (*MySql) ExpectedOut

func (m *MySql) ExpectedOut() (bool, int, error)

ExpectedOut returns true and the number of expected outbound records, false value mean indefinite. TODO: implement expected out for MySQL

func (*MySql) HasCountQuery

func (m *MySql) HasCountQuery() bool

HasCountQuery is true for MySql

func (*MySql) HasInQuery

func (m *MySql) HasInQuery() bool

HasInQuery is true for MySql

func (*MySql) HasOutQuery

func (m *MySql) HasOutQuery() bool

HasOutQuery is true for MySql

func (*MySql) In

func (m *MySql) In(query string, args []string, record Record) error

In for Driver interface. @TODO implementation

func (*MySql) Init

func (m *MySql) Init()

Init initializes at the beginning of each run.

func (*MySql) Out

func (m *MySql) Out(query string, args []string) (<-chan Record, error)

Out for Driver interface.

type Record

type Record map[string]interface{}

Record is a map of a single database record

func (Record) Get

func (r Record) Get(key string) interface{}

Get a value from a Record

func (Record) Set

func (r Record) Set(key string, value interface{})

Set a value on a Record

type ResultCollection

type ResultCollection []ResultCollectionItem

ResultCollection represents a slice of ResultCollectionItem

type ResultCollectionItem

type ResultCollectionItem struct {
	Record Record
	Args   []string
}

ResultCollectionItem represents a set of records and corresponding args.

Jump to

Keyboard shortcuts

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