mock

package
v0.0.0-...-85622c8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRows

func NewRows(from, to int) []core.Row

NewRows returns a slice of rows in form of:

{ <index>(int), "row_<index>"(string) }

where the first index is "from" and the last one is one less than "to".

Types

type Adapter

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

func NewAdapter

func NewAdapter(data []core.Row, opts ...AdapterOption) *Adapter

func (*Adapter) Connect

func (a *Adapter) Connect(_ string) (core.Driver, error)

func (*Adapter) GetHelpers

func (a *Adapter) GetHelpers(opts *core.TableOptions) map[string]string

type AdapterOption

type AdapterOption func(*adapterConfig)

func AdapterWithQuerySideEffect

func AdapterWithQuerySideEffect(query string, sideEffect func(context.Context) error) AdapterOption

func AdapterWithResultStreamOpts

func AdapterWithResultStreamOpts(opts ...ResultStreamOption) AdapterOption

func AdapterWithTableDefinition

func AdapterWithTableDefinition(table string, columns []*core.Column) AdapterOption

func AdapterWithTableHelper

func AdapterWithTableHelper(name string, query string) AdapterOption

type ResultStream

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

func NewResultStream

func NewResultStream(rows []core.Row, opts ...ResultStreamOption) *ResultStream

NewResultStream returns a mocked result stream with provided rows. It creates a header that matches the number of columns in the first row in form of: <header_0>, <header_1>, etc.

func (*ResultStream) Close

func (rs *ResultStream) Close()

func (*ResultStream) HasNext

func (rs *ResultStream) HasNext() bool

func (*ResultStream) Header

func (rs *ResultStream) Header() core.Header

func (*ResultStream) Meta

func (rs *ResultStream) Meta() *core.Meta

func (*ResultStream) Next

func (rs *ResultStream) Next() (core.Row, error)

type ResultStreamOption

type ResultStreamOption func(*resultStreamConfig)

func ResultStreamWithHeader

func ResultStreamWithHeader(header core.Header) ResultStreamOption

func ResultStreamWithMeta

func ResultStreamWithMeta(meta *core.Meta) ResultStreamOption

func ResultStreamWithNextSleep

func ResultStreamWithNextSleep(s time.Duration) ResultStreamOption

Jump to

Keyboard shortcuts

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