records

package
v0.0.0-...-c9c7940 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TagIndexStart = 100000

Variables

View Source
var ErrNotFound = vm.ErrNotFound

Functions

func ColumnNotFound

func ColumnNotFound(tableName, columnName string) error

func TableNotExists

func TableNotExists(table string, err ...error) error

func TagNotFound

func TagNotFound(tableName, tagName string) error

func ToMap

func ToMap(columns []Column, record []Value) map[string]interface{}

Types

type Column

type Column struct {
	TableName string
	TableAs   string
	Name      string
}

func MkColumn

func MkColumn(name string) Column

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

func CloneKeyValues

func CloneKeyValues(keyValues []KeyValue) []KeyValue

func MapToTags

func MapToTags(tags map[string]string) []KeyValue

type KeyValues

type KeyValues []KeyValue

func (KeyValues) Equal

func (kvs KeyValues) Equal(to KeyValues) bool

func (KeyValues) Get

func (kvs KeyValues) Get(key string) (string, bool)

func (KeyValues) Len

func (kvs KeyValues) Len() int

func (KeyValues) Less

func (kvs KeyValues) Less(i, j int) bool

func (KeyValues) Swap

func (kvs KeyValues) Swap(i, j int)

func (KeyValues) ToKey

func (kvs KeyValues) ToKey() string

type Measurement

type Measurement struct {
	Name          TableName
	IsSingleValue bool
	Time          time.Time
	Data          Table

	ErrTime time.Time
	Err     error
}

type Record

type Record struct {
	Tags    KeyValues
	Columns []Column
	Values  []Value
}

func MergeRecord

func MergeRecord(outerAs string, outer Record, innerAs string, inner Record) Record

func SortByColumnName

func SortByColumnName(r Record) Record

func (*Record) At

func (r *Record) At(idx int) Value

func (*Record) Clone

func (r *Record) Clone() Record

func (*Record) EqualTo

func (r *Record) EqualTo(to Record, opt vm.CompareOption) (bool, error)

func (*Record) Get

func (r *Record) Get(name string) (Value, bool)

func (*Record) GetByQualifierName

func (r *Record) GetByQualifierName(tableAs, name string) (Value, bool)

func (Record) GoString

func (r Record) GoString() string

func (*Record) IsEmpty

func (r *Record) IsEmpty() bool

func (Record) MarshalText

func (r Record) MarshalText() ([]byte, error)

func (*Record) Search

func (r *Record) Search(name string) int

func (*Record) ToLine

func (r *Record) ToLine(w io.Writer, sep string)

type RecordSet

type RecordSet []Record

func (*RecordSet) Add

func (set *RecordSet) Add(r Record)

func (*RecordSet) Delete

func (set *RecordSet) Delete(idx int)

func (*RecordSet) Has

func (set *RecordSet) Has(r Record) bool

func (*RecordSet) Search

func (set *RecordSet) Search(r Record) int

type Storage

type Storage interface {
	From(tablename string, filter func(name TableName) (bool, error)) ([]Measurement, error)
	Set(name string, tags []KeyValue, isSingleValue bool, t time.Time, table Table, err error) error
	Exists(name string, tags []KeyValue, predateLimit time.Time) bool
}

func NewStorage

func NewStorage() Storage

type Table

type Table struct {
	Columns []Column
	Records [][]Value
}

func ToTable

func ToTable(values []map[string]interface{}) (Table, error)

func (*Table) Add

func (table *Table) Add(columns []Column, values []Value)

func (*Table) At

func (table *Table) At(idx int) Record

func (*Table) ForEach

func (table *Table) ForEach(fn func(columns []Column, record []Value))

func (*Table) Length

func (table *Table) Length() int

type TableAlias

type TableAlias struct {
	Name  string
	Alias string
}

func (TableAlias) Equal

func (a TableAlias) Equal(name string) bool

type TableName

type TableName struct {
	Table string
	Tags  KeyValues
}

func (TableName) String

func (tn TableName) String() string

type Value

type Value = vm.Value

Jump to

Keyboard shortcuts

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