field

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const EmptyFieldID = ID(0)

EmptyFieldID represents empty value for field id.

Variables

This section is empty.

Functions

func UnmarshalBinary

func UnmarshalBinary(data []byte) (Metas, ID, error)

Types

type AggType

type AggType uint8

AggType represents field's aggregator type.

const (
	Sum AggType = iota + 1
	Count
	Min
	Max
	Last
	First
)

Defines all aggregator types for field

func (AggType) Aggregate

func (t AggType) Aggregate(a, b float64) float64

Aggregate aggregates two float64 values into one

type Field

type Field struct {
	Name  []byte
	Type  Type
	Value interface{}
}

type Fields

type Fields []Field

Fields implements sort.Interface

func (Fields) Insert

func (fs Fields) Insert(f Field) Fields

Insert adds or replace a Field

func (Fields) Len

func (fs Fields) Len() int

func (Fields) Less

func (fs Fields) Less(i, j int) bool

func (Fields) Search

func (fs Fields) Search(name []byte) (idx int, ok bool)

func (Fields) Swap

func (fs Fields) Swap(i, j int)

type ID

type ID uint8

ID represents field id.

type Meta

type Meta struct {
	ID   ID   `json:"id"`   // query not use id, don't get id in query phase
	Type Type `json:"type"` // query not use type
	Name Name `json:"name"`
}

Meta is the meta-data for field, which contains field-name, fieldID and field-type

func (*Meta) MarshalBinary

func (m *Meta) MarshalBinary() (data []byte, err error)

type Metas

type Metas []Meta

Metas implements sort.Interface, it's sorted by name

func (Metas) Clone

func (fms Metas) Clone() (x2 Metas)

Clone clones a copy of fieldsMetas

func (Metas) Find

func (fms Metas) Find(fieldName Name) (Meta, bool)

Find returns Meta by given field name, if not exist returns false.

func (Metas) GetFromID

func (fms Metas) GetFromID(fieldID ID) (Meta, bool)

GetFromID searches the meta by fieldID, returns false when not exist

func (Metas) GetFromName

func (fms Metas) GetFromName(fieldName Name) (Meta, bool)

GetFromName searches the meta by fieldName, return false when not exist

func (Metas) Insert

func (fms Metas) Insert(m Meta) Metas

Insert appends a new Meta to the list and sort it.

func (Metas) Intersects

func (fms Metas) Intersects(fields Metas) (x2 Metas, isSubSet bool)

Intersects checks whether each fieldID is in the list, and returns the new meta-list corresponding with the fieldID-list.

func (Metas) Len

func (fms Metas) Len() int

func (Metas) Less

func (fms Metas) Less(i, j int) bool

func (Metas) String

func (fms Metas) String() string

Stringer returns the fields in string

func (Metas) Swap

func (fms Metas) Swap(i, j int)

type Name

type Name string

Name represents field name.

func (Name) String

func (n Name) String() string

type Type

type Type uint8

Type represents field type for LinDB support

const (
	Unknown Type = iota
	SumField
	MinField
	MaxField
	LastField
	HistogramField // alias for sumField, only visible for tsdb
	FirstField
)

Defines all field types for LinDB support(user write)

func (Type) AggType

func (t Type) AggType() AggType

AggType returns the aggregate function

func (Type) DownSamplingFunc

func (t Type) DownSamplingFunc() function.FuncType

func (Type) GetDefaultFuncFieldParams

func (t Type) GetDefaultFuncFieldParams() []AggType

GetDefaultFuncFieldParams returns default agg type for field aggregator.

func (Type) GetFuncFieldParams

func (t Type) GetFuncFieldParams(funcType function.FuncType) []AggType

GetFuncFieldParams returns agg type for field aggregator by given function type.

func (Type) GetOrderByFunc

func (t Type) GetOrderByFunc() function.FuncType

GetOrderByFunc returns the order by function.

func (Type) IsFuncSupported

func (t Type) IsFuncSupported(funcType function.FuncType) bool

func (Type) String

func (t Type) String() string

String returns the field type's string value

Jump to

Keyboard shortcuts

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