Documentation ¶
Overview ¶
Package 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 of the table in the buffer. May be manually set for further encoding. Name string Row []Row // Row data. // Truncated may be manually set to true if the returned row set has been truncated. Truncated bool // Result set, which should include current buffer if not nil. Set []*Buffer // contains filtered or unexported fields }
Buffer represents a table buffer that holds one or more query.
func FillCommand ¶
func FillCommand(ctx context.Context, q rdb.Queryer, cmd *rdb.Command, params ...rdb.Param) (*Buffer, error)
FillCommand runs a query, fills the result, and closes the query result.
func (*Buffer) AddBufferRow ¶
AddBufferRow adds a new row to the buffer manually.
func (*Buffer) ColumnIndex ¶
ColumnIndex returns the index of the named column. If the name is not present it returns -1.
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)
type JsonRowObject ¶
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)
type Row ¶
Row represents a single buffer row of a table.
func (Row) Get ¶
Get returns the column name as a value, nil if null. Panics if name is not a valid column.