mockcsv

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 6 Imported by: 11 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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