Documentation
¶
Index ¶
- func NewDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- type Datasource
- func (d *Datasource) CallResource(ctx context.Context, req *backend.CallResourceRequest, ...) error
- func (d *Datasource) CheckHealth(ctx context.Context, _ *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *Datasource) Dispose()
- func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- type IonReader
- func (r *IonReader) Annotations() ([]string, error)
- func (r *IonReader) Error() error
- func (r *IonReader) FieldName() (string, error)
- func (r *IonReader) LookupSymbol(sym ion.Symbol) (string, error)
- func (r *IonReader) Next() bool
- func (r *IonReader) ReadBool() (bool, error)
- func (r *IonReader) ReadBytes() ([]byte, error)
- func (r *IonReader) ReadFloat() (float64, error)
- func (r *IonReader) ReadInt() (int64, error)
- func (r *IonReader) ReadList() ([]any, error)
- func (r *IonReader) ReadNull() error
- func (r *IonReader) ReadNullableBool() (*bool, error)
- func (r *IonReader) ReadNullableBytes() ([]byte, error)
- func (r *IonReader) ReadNullableFloat() (*float64, error)
- func (r *IonReader) ReadNullableInt() (*int64, error)
- func (r *IonReader) ReadNullableNumber() (*float64, error)
- func (r *IonReader) ReadNullableString() (*string, error)
- func (r *IonReader) ReadNullableSymbol() (*ion.Symbol, error)
- func (r *IonReader) ReadNullableText() (*string, error)
- func (r *IonReader) ReadNullableTimestamp() (*date.Time, error)
- func (r *IonReader) ReadNullableUint() (*uint64, error)
- func (r *IonReader) ReadNumber() (float64, error)
- func (r *IonReader) ReadString() (string, error)
- func (r *IonReader) ReadStruct() (map[string]any, error)
- func (r *IonReader) ReadSymbol() (ion.Symbol, error)
- func (r *IonReader) ReadText() (string, error)
- func (r *IonReader) ReadTimestamp() (date.Time, error)
- func (r *IonReader) ReadUint() (uint64, error)
- func (r *IonReader) ReadValue() (any, error)
- func (r *IonReader) StepIn() error
- func (r *IonReader) StepOut() error
- func (r *IonReader) Type() ion.Type
- func (r *IonReader) Unmarshal(v any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatasource ¶
func NewDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
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 (d *Datasource) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
func (*Datasource) CheckHealth ¶
func (d *Datasource) CheckHealth(ctx context.Context, _ *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
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 ¶
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
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 ¶
NewReader constructs a reader that reads values from r up to the given maximum size.
func (*IonReader) Annotations ¶
Annotations returns the annotations of the current value, if any. Returns a nil value if no annotations are present.
func (*IonReader) FieldName ¶
FieldName returns the name of the current field, when inside a struct.
func (*IonReader) LookupSymbol ¶
LookupSymbol looks up a symbol in the symbol table and returns the corresponding string value.
func (*IonReader) Next ¶
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) ReadList ¶
ReadList reads an arbitrary ION list. This is slightly more efficient than using Unmarshal with an any-typed list target.
func (*IonReader) ReadNull ¶
ReadNull reads an ion.NullType value, by discarding the descriptor. This is effectively the same as calling Next.
func (*IonReader) ReadNullableBool ¶
func (*IonReader) ReadNullableBytes ¶
func (*IonReader) ReadNullableFloat ¶
func (*IonReader) ReadNullableInt ¶
func (*IonReader) ReadNullableNumber ¶
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 (*IonReader) ReadNullableSymbol ¶
func (*IonReader) ReadNullableText ¶
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 (*IonReader) ReadNullableUint ¶
func (*IonReader) ReadNumber ¶
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 (*IonReader) ReadStruct ¶
ReadStruct reads an arbitrary ION struct. This is slightly more efficient than using Unmarshal with an any-typed map target.
func (*IonReader) ReadText ¶
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) ReadValue ¶
ReadValue reads an arbitrary ION value and returns it as a boxed 'any' value.
func (*IonReader) StepOut ¶
StepOut steps out of a struct or a list, discarding any unconsumed inner values.