Documentation ¶
Index ¶
- type Table
- func (t *Table) AddFieldColumn(name string, type_ types.ColumnType) error
- func (t *Table) AddRow(inputs ...any) error
- func (t *Table) AddTagColumn(name string, type_ types.ColumnType) error
- func (t *Table) AddTimestampColumn(name string, type_ types.ColumnType) error
- func (t *Table) GetName() (string, error)
- func (t *Table) GetRows() *gpb.Rows
- func (t *Table) IsColumnEmpty() bool
- func (t *Table) IsEmpty() bool
- func (t *Table) IsRowEmpty() bool
- func (t *Table) ToDeleteRequest() (*gpb.RowDeleteRequest, error)
- func (t *Table) ToInsertRequest() (*gpb.RowInsertRequest, error)
- func (t *Table) WithColumnsSchema(columnsSchema []*gpb.ColumnSchema) *Table
- func (t *Table) WithRows(rows *gpb.Rows) *Table
- func (t *Table) WithSanitate(sanitate_needed bool) *Table
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 (*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 ¶
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) IsColumnEmpty ¶
func (*Table) IsRowEmpty ¶
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) WithSanitate ¶
WithSanitate to change the sanitate behavior. Default is true. sanitate table and column name to snake and lower case.