metathings_data_storage_sdk

package
v1.3.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedDataStorageDriver = errors.New("unsupported data storage driver")
)

Functions

func ToDataStorage

func ToDataStorage(ds *DataStorage) func(string, interface{}) error

Types

type DataStorage

type DataStorage interface {
	Write(ctx context.Context, measurement string, tags map[string]string, data map[string]interface{}) error
	Query(ctx context.Context, measurement string, tags map[string]string, opts ...QueryOption) (QueryResult, error)
}

func NewDataStorage

func NewDataStorage(name string, args ...interface{}) (DataStorage, error)

func NewDummyDataStorage

func NewDummyDataStorage(args ...interface{}) (DataStorage, error)

func NewInfluxdb2DataStorage

func NewInfluxdb2DataStorage(args ...interface{}) (DataStorage, error)

type DataStorageFactory

type DataStorageFactory func(...interface{}) (DataStorage, error)

type DummyDataStorage

type DummyDataStorage struct {
	// contains filtered or unexported fields
}

func (*DummyDataStorage) Query added in v1.2.5

func (s *DummyDataStorage) Query(ctx context.Context, measurement string, tags map[string]string, opts ...QueryOption) (QueryResult, error)

func (*DummyDataStorage) Write

func (s *DummyDataStorage) Write(ctx context.Context, measurement string, tags map[string]string, data map[string]interface{}) error

type Influxdb2DataStorage

type Influxdb2DataStorage struct {
	// contains filtered or unexported fields
}

func (*Influxdb2DataStorage) Query added in v1.2.5

func (s *Influxdb2DataStorage) Query(ctx context.Context, measurement string, tags map[string]string, opts ...QueryOption) (QueryResult, error)

func (*Influxdb2DataStorage) Write

func (s *Influxdb2DataStorage) Write(ctx context.Context, measurement string, tags map[string]string, data map[string]interface{}) error

type Influxdb2DataStorageOption

type Influxdb2DataStorageOption struct {
	Address  string
	Token    string
	Username string
	Password string
	Org      string
	Bucket   string

	QueryPageSize        int32
	QueryRangeFromOffset time.Duration
}

func NewInfluxdb2DataStorageOption added in v1.2.5

func NewInfluxdb2DataStorageOption() *Influxdb2DataStorageOption

type MockDataStorage

type MockDataStorage struct {
	mock.Mock
	// contains filtered or unexported fields
}

func (*MockDataStorage) Query added in v1.2.5

func (m *MockDataStorage) Query(ctx context.Context, measurement string, tags map[string]string, opts ...QueryOption) (QueryResult, error)

func (*MockDataStorage) SetQueryResult added in v1.2.5

func (m *MockDataStorage) SetQueryResult(qr QueryResult)

func (*MockDataStorage) Write

func (m *MockDataStorage) Write(ctx context.Context, measurement string, tags map[string]string, data map[string]interface{}) error

type QueryOption added in v1.2.5

type QueryOption func(map[string]interface{})

func PageSize added in v1.2.5

func PageSize(size int32) QueryOption

func PageToken added in v1.2.5

func PageToken(token string) QueryOption

func QueryString added in v1.2.5

func QueryString(s string) QueryOption

func RangeFrom added in v1.2.5

func RangeFrom(t time.Time) QueryOption

func RangeTo added in v1.2.5

func RangeTo(t time.Time) QueryOption

type QueryRecord added in v1.2.5

type QueryRecord interface {
	Time() time.Time
	Data() map[string]interface{}
}

func NewQueryRecord added in v1.2.5

func NewQueryRecord(tm time.Time, dat map[string]interface{}) QueryRecord

type QueryResult added in v1.2.5

type QueryResult interface {
	Records() []QueryRecord
	NextPageToken() string
}

func NewQueryResult added in v1.2.5

func NewQueryResult(recs []QueryRecord, npt string) QueryResult

Jump to

Keyboard shortcuts

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