Documentation ¶
Index ¶
- Variables
- func Frame(res *pb.Response, qm models.QueryModel) (*data.Frame, error)
- func NewColumn(col *pb.ColumnSpec, name string, alias string, kind string, labels data.Labels) column
- func NewDatasource(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- type AstraDatasource
- type BaseDriver
- func (d BaseDriver) Connect(context.Context, backend.DataSourceInstanceSettings, json.RawMessage) (*sql.DB, error)
- func (d BaseDriver) Converters() []sqlutil.Converter
- func (d BaseDriver) Macros() sqlds.Macros
- func (d BaseDriver) Settings(context.Context, backend.DataSourceInstanceSettings) sqlds.DriverSettings
- type Converted
- type Int
- type Number
Constants ¶
This section is empty.
Variables ¶
View Source
var BigIntConverter = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableInt64, Converter: func(v any) (any, error) { return convertBigInt(v.(*pb.Value)) }, }
BigIntConverter converts bigInt to float64
View Source
var DecimalToNullableFloat64 = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableFloat64, Converter: func(v any) (any, error) { convert := func(val *pb.Value) (*float64, error) { dec, err := client.ToDecimal(val) if err != nil { return nil, err } str := dec.String() if float, err := strconv.ParseFloat(str, 64); err == nil { return &float, nil } return nil, errors.New("unable to convert decimal to float") } return toNullable(v.(*pb.Value), convert) }, }
DecimalToNullableFloat64 returns an error if the input is not a float64.
View Source
var Float32ToNullableFloat64 = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableFloat64, Converter: func(v any) (any, error) { convert := func(val any) (*float64, error) { v, ok := v.(float32) if !ok { return nil, errors.New("failed converting to float64") } f64 := math.Round((float64(v) * 100)) / 100 return &f64, nil } return anyToNullable(v, convert) }, }
Float32ToNullableFloat64 converts float32 to float64
View Source
var SmallIntConverter = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableInt64, Converter: func(v any) (any, error) { return convertSmallInt(v.(*pb.Value)) }, }
SmallIntConverter converts smallInt to int64
View Source
var TimeConverter = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableInt64, Converter: func(v any) (any, error) { convert := func(val any) (*uint64, error) { v := val.(uint64) return &v, nil } return anyToNullable(v, convert) }, }
TimeConverter converts uint64 to nullable uint64
View Source
var TimestampConverter = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableInt64, Converter: func(v any) (any, error) { return convertIntToTimestamp(v.(int64)) }, }
TimestampConverter converts uint64 to time
View Source
var VarIntConverter = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableInt64, Converter: func(v any) (any, error) { return convertVarInt(v.(*pb.Value)) }, }
VarIntConverter converts smallInt to int64
Functions ¶
func NewDatasource ¶
func NewDatasource(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
Types ¶
type AstraDatasource ¶
type AstraDatasource struct {
// contains filtered or unexported fields
}
func (*AstraDatasource) CheckHealth ¶
func (d *AstraDatasource) CheckHealth(_ context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
func (*AstraDatasource) Dispose ¶
func (d *AstraDatasource) Dispose()
func (*AstraDatasource) QueryData ¶
func (d *AstraDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
type BaseDriver ¶
type BaseDriver struct { }
BaseDriver implements the driver interface for macro interpolation sqlds provides default macros using sqlds.Interpolate
func (BaseDriver) Connect ¶
func (d BaseDriver) Connect(context.Context, backend.DataSourceInstanceSettings, json.RawMessage) (*sql.DB, error)
func (BaseDriver) Converters ¶
func (d BaseDriver) Converters() []sqlutil.Converter
func (BaseDriver) Macros ¶
func (d BaseDriver) Macros() sqlds.Macros
func (BaseDriver) Settings ¶
func (d BaseDriver) Settings(context.Context, backend.DataSourceInstanceSettings) sqlds.DriverSettings
Click to show internal directories.
Click to hide internal directories.