table

package
v0.0.0-...-cc996d8 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Zlib Imports: 5 Imported by: 0

Documentation

Overview

table give a logical in-memory buffer row a database table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Name string
	Row  []Row

	// Result set, which should include current buffer if not nil.
	Set []*Buffer
	// contains filtered or unexported fields
}

func Fill

func Fill(res *rdb.Result) (*Buffer, error)

func FillCommand

func FillCommand(q rdb.Queryer, cmd *rdb.Command, params ...rdb.Param) (*Buffer, error)

func FillSet

func FillSet(res *rdb.Result) ([]*Buffer, error)

func (*Buffer) AddRow

func (b *Buffer) AddRow(v ...interface{}) *Row

func (*Buffer) ColumnIndex

func (b *Buffer) ColumnIndex(name string) int

ColumnIndex returns the index of the named column. If the name is not present it returns -1.

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) Schema

func (b *Buffer) Schema() []*rdb.Column

func (*Buffer) SetSchema

func (b *Buffer) SetSchema(schema []*rdb.Column) error

type JsonRowArray

type JsonRowArray struct {
	*Buffer
	FlushAt int

	// Additional properties to add to the output.
	Meta map[string]interface{}

	ResultNameName    string // Default field name is "Name".
	ColumnHeadersName string // Default field name is "Column".
	DataRowsName      string // Default field name is "Data".
}

Serialize the table buffer as an object with a column name array and an an array of rows. Each row is an array of values. Supports many result sets by chaining them together.

func (*JsonRowArray) MarshalJSON

func (coder *JsonRowArray) MarshalJSON() ([]byte, error)

func (*JsonRowArray) WriteTo

func (coder *JsonRowArray) WriteTo(writer io.Writer) (n int64, err error)

type JsonRowObject

type JsonRowObject struct {
	*Buffer
	FlushAt int
}

Serialize table buffer as an array of JSON objects. When multiple results are returned, turns into an array of arrays.

func (*JsonRowObject) MarshalJSON

func (coder *JsonRowObject) MarshalJSON() ([]byte, error)

func (*JsonRowObject) WriteTo

func (coder *JsonRowObject) WriteTo(writer io.Writer) (n int64, err error)

type Row

type Row struct {
	Field []rdb.Nullable
	// contains filtered or unexported fields
}

func (Row) Get

func (row Row) Get(name string) interface{}

func (Row) GetN

func (row Row) GetN(name string) rdb.Nullable

func (Row) HasColumn

func (row Row) HasColumn(name string) bool

func (Row) Index

func (row Row) Index(name string) int

Jump to

Keyboard shortcuts

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