mockcsv

package
v0.0.0-...-fc2d520 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

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

Constants

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

Variables

View Source
var (

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

Functions

func LoadTable

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

func Schema() *schema.Schema

Schema global accessor to the mockcsv schema

Types

type Source

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

func New() *Source

New create csv mock source.

func (*Source) Close

func (m *Source) Close() error

Close csv source.

func (*Source) CreateTable

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

CreateTable create a csv table in this source.

func (*Source) DropTable

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

DropTable Drop table schema

func (*Source) Init

func (m *Source) Init()

Init no-op meets interface

func (*Source) Open

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

Open connection to given tablename.

func (*Source) Setup

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

Setup accept schema

func (*Source) Table

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

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

Tables list of tables.

type Table

type Table struct {
	*membtree.StaticDataSource
}

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

Jump to

Keyboard shortcuts

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