datahub

package
v4.5.2003+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func DeepCopyEntity

func DeepCopyEntity(entities interface{}, results *data.Data)

func ExtractDatahubEntity

func ExtractDatahubEntity(entities interface{}) reflect.StructField

func NewColumns

func NewColumns(entities interface{}, fields []string) []string

func NewCondition

func NewCondition(opt Option) *common.Condition

func NewDeleteData

func NewDeleteData(entities interface{}, opts ...Option) *data.DeleteData

func NewDeleteDataRequest

func NewDeleteDataRequest(entities interface{}, opts ...Option) *data.DeleteDataRequest

func NewFunction

func NewFunction(function *Function) *common.Function

func NewQueryCondition

func NewQueryCondition(selects []string, timeRange *TimeRange, function *Function, opts ...Option) *common.QueryCondition

func NewReadData

func NewReadData(entities interface{}, fields []string, timeRange *TimeRange, function *Function, opts ...Option) *data.ReadData

func NewReadDataRequest

func NewReadDataRequest(entities interface{}, fields []string, timeRange *TimeRange, function *Function, opts ...Option) *data.ReadDataRequest

func NewRow

func NewRow(value reflect.Value, columns []string) *common.Row

func NewRows

func NewRows(entities interface{}, columns []string) []*common.Row

func NewSchemaMeta

func NewSchemaMeta(entities interface{}) *schemas.SchemaMeta

func NewTimeRange

func NewTimeRange(tr *TimeRange) *common.TimeRange

func NewTimestampProto

func NewTimestampProto(ts *time.Time) *timestamp.Timestamp

func NewWriteData

func NewWriteData(entities interface{}, fields []string) *data.WriteData

func NewWriteDataRequest

func NewWriteDataRequest(entities interface{}, fields []string) *data.WriteDataRequest

Types

type Client

type Client struct {
	datahub.DatahubServiceClient
	Connection *grpc.ClientConn
	Address    string
}

func NewClient

func NewClient(address string) *Client

func (*Client) Close

func (p *Client) Close() error

func (*Client) Create

func (p *Client) Create(entities interface{}, fields ...string) error

func (*Client) Delete

func (p *Client) Delete(entities interface{}) error

Delete by tags

func (*Client) DeleteByOpts

func (p *Client) DeleteByOpts(entity interface{}, opts ...Option) error

Entity is indicator, delete by options

func (*Client) List

func (p *Client) List(entities interface{}, opts ...Option) error

func (*Client) ListTS

func (p *Client) ListTS(entities interface{}, timeRange *TimeRange, function *Function, fields []string, opts ...Option) error

type Function

type Function struct {
	Type   FunctionType
	Target string
	Unit   string
	Number int64
}

type FunctionType

type FunctionType = int

Function type enumerator

const (
	NoneFunction FunctionType = iota

	// Aggregation Function
	FunctionCount  // Returns the number of non-null field values
	FuncDistinct   // Returns the list of unique field values
	FuncIntegral   // Returns the area under the curve for subsequent field values
	FunctionMean   // Returns the arithmetic mean (average) of field values
	FunctionMedian // Returns the middle value from a sorted list of field values
	FunctionMode   // Returns the most frequent value in a list of field values
	FunctionSpread // Returns the difference between the minimum and maximum field values
	FunctionStddev // Returns the standard deviation of field values
	FunctionSum    // Returns the sum of field values

	// Selector function
	FunctionBottom     // Returns the smallest N field values
	FunctionFirst      // Returns the field value with the oldest timestamp
	FunctionLast       // Returns the field value with the most recent timestamp
	FunctionMax        // Returns the greatest field value
	FunctionMin        // Returns the lowest field value
	FunctionPercentile // Returns the Nth percentile field value
	FunctionSample     // Returns a random sample of N field values. SAMPLE() uses reservoir sampling to generate the random points
	FunctionTop        // Returns the greatest N field values

	// Transformation function
	FuncDerivative // Returns the rate of change between subsequent field values
)

type Option

type Option struct {
	Entity interface{}
	Fields []string
}

type Order

type Order = int

Order enumerator

const (
	NoneOrder Order = iota
	Asc             // Represent ascending order
	Desc            // Represent descending order
)

Sort order definition

type TimeRange

type TimeRange struct {
	StartTime *time.Time
	EndTime   *time.Time
	Order     Order
	Limit     uint64
	Step      int
}

Jump to

Keyboard shortcuts

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