entities

package
v0.0.0-...-fa7900d Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggType

type AggType string
const (
	AggTypeCount  AggType = "count"
	AggTypeSum    AggType = "sum"
	AggTypeAvg    AggType = "avg"
	AggTypeMax    AggType = "max"
	AggTypeMin    AggType = "min"
	AggTypeRange  AggType = "range"
	AggTypeFunc   AggType = "func"
	AggTypeUnique AggType = "unique"
)

type Event

type Event struct {
	Id   string `json:"id"`
	Time string `json:"time"`

	EventType string         `json:"eventType"`
	Subject   string         `json:"subject"`
	Data      map[string]any `json:"data"`
}

func (*Event) IsValid

func (m *Event) IsValid() error

func (*Event) Key

func (e *Event) Key() string

func (*Event) ParseBytes

func (e *Event) ParseBytes(b []byte) error

func (*Event) ToJson

func (e *Event) ToJson() ([]byte, error)

type Meter

type Meter struct {
	Id          string `json:"id"`
	Description string `json:"description"`

	EventType string `json:"eventType"`

	Aggregation   AggType           `json:"aggregation"`
	ValueProperty string            `json:"valueProperty"`
	GroupBy       map[string]string `json:"groupBy"`
}

func (*Meter) Hash

func (m *Meter) Hash() string

func (*Meter) IsValid

func (m *Meter) IsValid() error

func (*Meter) Key

func (m *Meter) Key() string

type Reading

type Reading struct {
	Event   string `json:"event"`
	MeterId string `json:"meterId"`
	Subject string `json:"subject"`
	Segment string `json:"segment,omitempty"`

	Type AggType `json:"type"`

	Count int     `json:"count,omitempty"`
	Sum   float64 `json:"sum,omitempty"`
	Avg   float64 `json:"avg,omitempty"`
	Max   float64 `json:"max,omitempty"`
	Min   float64 `json:"min,omitempty"`

	Func string `json:"func,omitempty"`

	Unique map[string]int `json:"unique,omitempty"`
}

Jump to

Keyboard shortcuts

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