qlbridge: github.com/araddon/qlbridge/datasource/mockcsv Index | Files

package mockcsv

import "github.com/araddon/qlbridge/datasource/mockcsv"

Package mockcsv implements an in-memory csv data source for testing usage implemented by wrapping the mem-b-tree, loading csv data into it. NOT intended for any production usages, test only.

Index

Package Files

mockcsv.go

Constants

const (
    // SchemaName is "mockcsv"
    SchemaName = "mockcsv"
)

Variables

var (

    // CsvGlobal mock csv in mem store
    CsvGlobal = New()
)

func LoadTable Uses

func LoadTable(schemaName, name, csvRaw string)

LoadTable MockCsv is used for mocking so has a global data source we can load data into

func Schema Uses

func Schema() *schema.Schema

Schema global accessor to the mockcsv schema

type Source Uses

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

Source DataSource for testing creates an in memory b-tree per "table". Is not thread safe.

func New Uses

func New() *Source

New create csv mock source.

func (*Source) Close Uses

func (m *Source) Close() error

Close csv source.

func (*Source) CreateTable Uses

func (m *Source) CreateTable(tableName, csvRaw string)

CreateTable create a csv table in this source.

func (*Source) DropTable Uses

func (m *Source) DropTable(t string) error

DropTable Drop table schema

func (*Source) Init Uses

func (m *Source) Init()

Init no-op meets interface

func (*Source) Open Uses

func (m *Source) Open(tableName string) (schema.Conn, error)

Open connection to given tablename.

func (*Source) Setup Uses

func (m *Source) Setup(s *schema.Schema) error

Setup accept schema

func (*Source) Table Uses

func (m *Source) Table(tableName string) (*schema.Table, error)

Table get table schema for given table name. If given table is not currently defined, will load, infer schema.

func (*Source) Tables Uses

func (m *Source) Tables() []string

Tables list of tables.

type Table Uses

type Table struct {
    *membtree.StaticDataSource
}

Table converts the static csv-source into a schema.Conn source

Package mockcsv imports 6 packages (graph) and is imported by 3 packages. Updated 2018-07-27. Refresh now. Tools for package owners.