uql

package
v0.68.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errors

func Errors(errors []*Error) error

func GetAPIEndpoint added in v0.50.0

func GetAPIEndpoint(apiVersion ApiVersion) string

func NewDefaultBackend added in v0.51.0

func NewDefaultBackend(options ...BackendOption) defaultBackend

func NewSubCmd

func NewSubCmd() *cobra.Command

Types

type ApiVersion

type ApiVersion string

UQL API version type, supporting a limited set of values. Implements the StringEnumer interface defined by the fsoc config package in order to support parsing apiver from an fsoc config file.

const (
	ApiVersion1 ApiVersion = ApiVersion("v1")

	ApiVersionDefault ApiVersion = ApiVersion1
)

constants for direct use

func (*ApiVersion) String added in v0.50.0

func (a *ApiVersion) String() string

func (*ApiVersion) ValidateAndSet added in v0.50.0

func (a *ApiVersion) ValidateAndSet(v any) error

type BackendOption added in v0.51.0

type BackendOption func(c *defaultBackend)

func WithBackendApiOptions added in v0.51.0

func WithBackendApiOptions(options *api.Options) BackendOption

type Complex

type Complex interface {
	Model() *Model
	Values() [][]any
}

type ComplexData

type ComplexData struct {
	DataModel *Model
	Data      [][]any
}

func (ComplexData) Model

func (c ComplexData) Model() *Model

func (ComplexData) Values

func (c ComplexData) Values() [][]any

type Config added in v0.50.0

type Config struct {
	// TODO
	ApiVersion *ApiVersion `mapstructure:"apiver,omitempty" fsoc-help:"API version to use for UQL queries. The default is \"v1\"."`
}

Config defines the subsystem configuration under fsoc

var GlobalConfig Config

type DataSet

type DataSet struct {
	Name      string
	DataModel *Model
	Metadata  map[string]any
	Data      [][]any
	Links     map[string]Link
}

DataSet holds the result data along with its name, structure (Model) and metadata

func (DataSet) Model

func (d DataSet) Model() *Model

func (DataSet) Values

func (d DataSet) Values() [][]any

type DataSetRef

type DataSetRef struct {
	JsonPath string `json:"$jsonPath"`
	Dataset  string `json:"$dataset"`
}

DataSetRef is a reference to another data set within the Response

type DataType

type DataType interface {
	int | float64 | string | DataSetRef | bool | time.Time | jsonScalar | jsonObject
}

type Error

type Error struct {
	Type   string `json:"type"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

type Hint

type Hint struct {
	Kind  string `json:"kind"`
	Field string `json:"field"`
	Type  string `json:"type"`
}

Hint provides additional information about a ModelField such as the MELT kind, MELT field and type

type Link struct {
	Href string
}

type Model

type Model struct {
	Name   string       `json:"name"`
	Fields []ModelField `json:"fields"`
}

Model represents the structure of the response data

type ModelField

type ModelField struct {
	Alias string `json:"alias"`
	Type  string `json:"type"`
	Form  string `json:"form"`
	Hints *Hint  `json:"hints"`
	Model *Model `json:"model"`
}

ModelField is a description of one column of one data set

func (*ModelField) IsReference

func (mf *ModelField) IsReference() bool

type Query

type Query struct {
	Str string `json:"query"`
}

Query represents a UQL request body

type Response

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

Response represents a parsed UQL response body

func (*Response) Errors

func (resp *Response) Errors() []*Error

func (*Response) HasErrors

func (resp *Response) HasErrors() bool

func (*Response) Main

func (resp *Response) Main() *DataSet

func (*Response) Model

func (resp *Response) Model() *Model

func (*Response) Raw

func (resp *Response) Raw() string

type UqlClient added in v0.51.0

type UqlClient interface {
	// ExecuteQuery sends an execute request to the UQL service
	ExecuteQuery(query *Query) (*Response, error)

	// ContinueQuery sends a continue request to the UQL service
	ContinueQuery(dataSet *DataSet, rel string) (*Response, error)
}
var Client UqlClient = NewClient()

Default clients that can be used as `uql.Client` from other packages - Client should be used to go with the default API version (possibly overridden in fsoc config) - ClientV1 should be used when `v1` is required

func NewClient added in v0.51.0

func NewClient(options ...UqlClientOption) UqlClient

type UqlClientOption added in v0.51.0

type UqlClientOption func(c *defaultClient)

func WithClientApiVersion added in v0.51.0

func WithClientApiVersion(version ApiVersion) UqlClientOption

Jump to

Keyboard shortcuts

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