uql

package
v0.50.0-pre1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errors

func Errors(errors []*Error) error

func NewSubCmd

func NewSubCmd() *cobra.Command

Types

type ApiVersion

type ApiVersion string
const (
	ApiVersion1     ApiVersion = "v1"
	ApiVersion1Beta ApiVersion = "v1beta"
)

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 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 ContinueQuery

func ContinueQuery(dataSet *DataSet, rel string) (*Response, error)

ContinueQuery sends a continue request to the UQL service

func ExecuteQuery

func ExecuteQuery(query *Query, apiVersion ApiVersion) (*Response, error)

ExecuteQuery sends an execute request to the UQL service

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

Jump to

Keyboard shortcuts

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