client

package
v0.0.0-...-ae71d39 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 21 Imported by: 9

Documentation

Index

Constants

View Source
const (
	TraceAttributeEntityID     string = "entity-id"
	TraceAttributeNGSILDTenant string = "ngsild-tenant"
)

Variables

This section is empty.

Functions

func Debug

func Debug(enabled string) func(*cbClient)

func QueryEntities

func QueryEntities[T any](ctx context.Context, broker, tenant, entityType string, attributes []string, callback func(t T)) (count int, err error)

func RequestHeader

func RequestHeader(key string, value []string) func(*cbClient)

func Tenant

func Tenant(tenant string) func(*cbClient)

func UserAgent

func UserAgent(useragent string) func(*cbClient)

Types

type AggregationDurationDecoratorFunc

type AggregationDurationDecoratorFunc func(string) string

func Days

func Days(numberOfDays uint64) AggregationDurationDecoratorFunc

func Hours

func Hours(numberOfHours uint64) AggregationDurationDecoratorFunc

func Minutes

func Minutes(numberOfMinutes uint64) AggregationDurationDecoratorFunc

func Months

func Months(numberOfMonths uint64) AggregationDurationDecoratorFunc

func Weeks

func Weeks(numberOfWeeks uint64) AggregationDurationDecoratorFunc

type AggregationMethod

type AggregationMethod string
const (
	AggregatedAverage       AggregationMethod = "avg"
	AggregatedDistinctCount AggregationMethod = "distinctCount"
	AggregatedMax           AggregationMethod = "max"
	AggregatedMin           AggregationMethod = "min"
	AggregatedStdDev        AggregationMethod = "stddev"
	AggregatedSum           AggregationMethod = "sum"
	AggregatedSumOfSquares  AggregationMethod = "sumsq"
	AggregatedTotalCount    AggregationMethod = "totalCount"
)

type ContextBrokerClient

type ContextBrokerClient interface {
	CreateEntity(ctx context.Context, entity types.Entity, headers map[string][]string) (*ngsild.CreateEntityResult, error)
	QueryEntities(ctx context.Context, entityTypes, entityAttributes []string, query string, headers map[string][]string) (*ngsild.QueryEntitiesResult, error)
	RetrieveEntity(ctx context.Context, entityID string, headers map[string][]string) (types.Entity, error)
	QueryTemporalEvolutionOfEntities(ctx context.Context, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.QueryTemporalEntitiesResult, error)
	RetrieveTemporalEvolutionOfEntity(ctx context.Context, entityID string, headers map[string][]string, parameters ...RequestDecoratorFunc) (types.EntityTemporal, error)
	MergeEntity(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.MergeEntityResult, error)
	UpdateEntityAttributes(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.UpdateEntityAttributesResult, error)
	DeleteEntity(ctx context.Context, entityID string) (*ngsild.DeleteEntityResult, error)
}

func NewContextBrokerClient

func NewContextBrokerClient(broker string, options ...func(*cbClient)) ContextBrokerClient

type RequestDecoratorFunc

type RequestDecoratorFunc func([]string) []string

func After

func After(timeAt time.Time) RequestDecoratorFunc

func Aggregation

func Aggregation(aggrMethods []AggregationMethod, decorators ...AggregationDurationDecoratorFunc) RequestDecoratorFunc

func Attributes

func Attributes(attrs []string) RequestDecoratorFunc

func Before

func Before(timeAt time.Time) RequestDecoratorFunc

func Between

func Between(timeAt, endTimeAt time.Time) RequestDecoratorFunc

func IDs

func IDs(ids []string) RequestDecoratorFunc

func LastN

func LastN(count uint64) RequestDecoratorFunc

func NearPoint

func NearPoint(distance int, lon, lat float64) RequestDecoratorFunc

func Types

func Types(typeNames []string) RequestDecoratorFunc

Jump to

Keyboard shortcuts

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