table

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

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

Table is a struct that holds the table name, columns, and rows. Call New() to create a new table. then Call AddTagColumn(), AddFieldColumn() or AddTimestampColumn() to add columns. then Call AddRow() to add rows.

NOTE: column counts MUST match the number of inputs in AddRow()

func New

func New(name string) (*Table, error)

func (*Table) AddFieldColumn

func (t *Table) AddFieldColumn(name string, type_ types.ColumnType) error

AddFieldColumn helps to add the field column. You can find details in Data Model.

func (*Table) AddRow

func (t *Table) AddRow(inputs ...any) error

AddRow is to add real data based on the schema defined before by AddTagColumn(), AddFieldColumn() or AddTimestampColumn().

NOTE: The order of inputs MUST match the order of columns in the schema.

tbl := table.New(<tableName>)

// add column at first. This is to define the schema of the table.
tbl.AddTagColumn("tag1", types.INT64)
tbl.AddFieldColumn("field1", types.STRING)
tbl.AddTimestampColumn("timestamp", types.TIMESTAMP_MILLISECONDS)

// you can add multiple row(s). This is the real data.
tbl.AddRow(1, "hello", time.Now())
tbl.AddRow(2, "world", time.Now())

func (*Table) AddTagColumn

func (t *Table) AddTagColumn(name string, type_ types.ColumnType) error

AddTagColumn helps to add the tag column. You can find details in Data Model.

func (*Table) AddTimestampColumn

func (t *Table) AddTimestampColumn(name string, type_ types.ColumnType) error

AddTimestampColumn helps to add the timestamp column. A table can only have one timestamp column. You can find details in Data Model.

func (*Table) GetName added in v0.1.1

func (t *Table) GetName() (string, error)

func (*Table) GetRows added in v0.1.1

func (t *Table) GetRows() *gpb.Rows

func (*Table) IsColumnEmpty

func (t *Table) IsColumnEmpty() bool

func (*Table) IsEmpty

func (t *Table) IsEmpty() bool

func (*Table) IsRowEmpty

func (t *Table) IsRowEmpty() bool

func (*Table) ToDeleteRequest added in v0.5.0

func (t *Table) ToDeleteRequest() (*gpb.RowDeleteRequest, error)

func (*Table) ToInsertRequest added in v0.5.0

func (t *Table) ToInsertRequest() (*gpb.RowInsertRequest, error)

func (*Table) WithColumnsSchema added in v0.1.1

func (t *Table) WithColumnsSchema(columnsSchema []*gpb.ColumnSchema) *Table

func (*Table) WithRows added in v0.1.1

func (t *Table) WithRows(rows *gpb.Rows) *Table

func (*Table) WithSanitate

func (t *Table) WithSanitate(sanitate_needed bool) *Table

WithSanitate to change the sanitate behavior. Default is true. sanitate table and column name to snake and lower case.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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