plugin

package
v1.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatasource

NewDatasource creates a new datasource instance.

Types

type Datasource

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

Datasource is an example datasource which can respond to data queries, reports its health and has streaming skills.

func (*Datasource) CallResource

func (*Datasource) CheckHealth

CheckHealth handles health checks sent from Grafana to the plugin. The main use case for these health checks is the test button on the datasource configuration page which allows users to verify that a datasource is working as expected.

func (*Datasource) Dispose

func (d *Datasource) Dispose()

Dispose here tells plugin SDK that plugin wants to clean up resources when a new instance created. As soon as datasource settings change detected by SDK old datasource instance will be disposed and a new one will be created using NewSampleDatasource factory function.

func (*Datasource) QueryData

QueryData handles multiple queries and returns multiple responses. req contains the queries []DataQuery (where each query contains RefID as a unique identifier). The QueryDataResponse contains a map of RefID to the response for each query, and each response contains Frames ([]*Frame).

type IonReader

type IonReader struct {
	// Symbols is the current symbol table.
	// Calls to IonReader.Next will update the symbol table as symbol table annotations are
	// encountered in the source data stream.
	Symbols ion.Symtab
	// contains filtered or unexported fields
}

IonReader is a stateful ION reader.

func NewReader

func NewReader(r io.Reader, max int) *IonReader

NewReader constructs a reader that reads values from r up to the given maximum size.

func (*IonReader) Annotations

func (r *IonReader) Annotations() ([]string, error)

Annotations returns the annotations of the current value, if any. Returns a nil value if no annotations are present.

func (*IonReader) Error

func (r *IonReader) Error() error

Error returns any error occurred in the Next function.

func (*IonReader) FieldName

func (r *IonReader) FieldName() (string, error)

FieldName returns the name of the current field, when inside a struct.

func (*IonReader) LookupSymbol

func (r *IonReader) LookupSymbol(sym ion.Symbol) (string, error)

LookupSymbol looks up a symbol in the symbol table and returns the corresponding string value.

func (*IonReader) Next

func (r *IonReader) Next() bool

Next moves the internal iterator to the next value. Error should be checked, if this function return false to determine if an error occurred or the end of the iterator is reached.

func (*IonReader) ReadBool

func (r *IonReader) ReadBool() (bool, error)

func (*IonReader) ReadBytes

func (r *IonReader) ReadBytes() ([]byte, error)

func (*IonReader) ReadFloat

func (r *IonReader) ReadFloat() (float64, error)

func (*IonReader) ReadInt

func (r *IonReader) ReadInt() (int64, error)

func (*IonReader) ReadList

func (r *IonReader) ReadList() ([]any, error)

ReadList reads an arbitrary ION list. This is slightly more efficient than using Unmarshal with an any-typed list target.

func (*IonReader) ReadNull

func (r *IonReader) ReadNull() error

ReadNull reads an ion.NullType value, by discarding the descriptor. This is effectively the same as calling Next.

func (*IonReader) ReadNullableBool

func (r *IonReader) ReadNullableBool() (*bool, error)

func (*IonReader) ReadNullableBytes

func (r *IonReader) ReadNullableBytes() ([]byte, error)

func (*IonReader) ReadNullableFloat

func (r *IonReader) ReadNullableFloat() (*float64, error)

func (*IonReader) ReadNullableInt

func (r *IonReader) ReadNullableInt() (*int64, error)

func (*IonReader) ReadNullableNumber

func (r *IonReader) ReadNullableNumber() (*float64, error)

ReadNullableNumber reads any numeric value and returns it as a *float64. Fails, if the current value is not of type ion.NullType, ion.UintType, ion.IntType or ion.FloatType.

func (*IonReader) ReadNullableString

func (r *IonReader) ReadNullableString() (*string, error)

func (*IonReader) ReadNullableSymbol

func (r *IonReader) ReadNullableSymbol() (*ion.Symbol, error)

func (*IonReader) ReadNullableText

func (r *IonReader) ReadNullableText() (*string, error)

ReadNullableText reads any text value and returns it as a string. Fails, if the current value is not of type ion.NullType, ion.SymbolType or ion.StringType.

func (*IonReader) ReadNullableTimestamp

func (r *IonReader) ReadNullableTimestamp() (*date.Time, error)

func (*IonReader) ReadNullableUint

func (r *IonReader) ReadNullableUint() (*uint64, error)

func (*IonReader) ReadNumber

func (r *IonReader) ReadNumber() (float64, error)

ReadNumber reads any numeric value and returns it as a float64. Fails, if the current value is not of type ion.UintType, ion.IntType or ion.FloatType.

func (*IonReader) ReadString

func (r *IonReader) ReadString() (string, error)

func (*IonReader) ReadStruct

func (r *IonReader) ReadStruct() (map[string]any, error)

ReadStruct reads an arbitrary ION struct. This is slightly more efficient than using Unmarshal with an any-typed map target.

func (*IonReader) ReadSymbol

func (r *IonReader) ReadSymbol() (ion.Symbol, error)

func (*IonReader) ReadText

func (r *IonReader) ReadText() (string, error)

ReadText reads any text value and returns it as a string. Fails, if the current value is not of type ion.SymbolType or ion.StringType.

func (*IonReader) ReadTimestamp

func (r *IonReader) ReadTimestamp() (date.Time, error)

func (*IonReader) ReadUint

func (r *IonReader) ReadUint() (uint64, error)

func (*IonReader) ReadValue

func (r *IonReader) ReadValue() (any, error)

ReadValue reads an arbitrary ION value and returns it as a boxed 'any' value.

func (*IonReader) StepIn

func (r *IonReader) StepIn() error

StepIn steps into a struct or a list.

func (*IonReader) StepOut

func (r *IonReader) StepOut() error

StepOut steps out of a struct or a list, discarding any unconsumed inner values.

func (*IonReader) Type

func (r *IonReader) Type() ion.Type

Type returns the type of the current value.

func (*IonReader) Unmarshal

func (r *IonReader) Unmarshal(v any) error

Unmarshal uses reflection to unmarshal the current value.

Jump to

Keyboard shortcuts

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