table

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapKeys

func MapKeys[T any](input map[string]T) []string

Types

type ColumnSet

type ColumnSet map[string]any

type Dump

type Dump struct {
	Schema schema.T    `json:"schema"`
	Data   []ColumnSet `json:"data"`
	Name   string      `json:"name"`
}

Dump table.

type Set

type Set[T any] map[string]T

type T

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

func NewTable

func NewTable(sch schema.T) (*T, error)

Validate schema and create new table

func (*T) DeleteDuplicates

func (t *T) DeleteDuplicates() (uint, error)

Update rows from table

func (*T) DeleteRows

func (t *T) DeleteRows(rawCondition ColumnSet) (uint, error)

Update rows from table

func (*T) Dump

func (t *T) Dump(tableName string) (*Dump, error)

func (*T) InsertRows

func (t *T) InsertRows(rows *[]ColumnSet) (uint, error)

Insert rows to table

func (*T) LoadDump

func (t *T) LoadDump(data *[]ColumnSet) error

func (*T) Schema

func (t *T) Schema() schema.T

Introspect schema

func (*T) SelectRows

func (t *T) SelectRows(columns *[]string, conditions ColumnSet) (*[]ColumnSet, error)

Select data from table, empty columns list and empty conditions considered as "select all"

func (*T) UpdateRows

func (t *T) UpdateRows(rawCondition ColumnSet, newRawData ColumnSet) (uint, error)

Update rows in table

Jump to

Keyboard shortcuts

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