ql

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Separator = ":"

Separator defines FOXDEN query separator

View Source
var Verbose int

Verbose defines verbosity level for this module

Functions

func ParseQuery

func ParseQuery(query string) (map[string]any, error)

ParseQuery function provides basic parser for user queries and return results in bson dictionary

Types

type QLManager added in v0.2.2

type QLManager struct {
	Map     ServiceMap
	Records []QLRecord
}

QLManager represents QL manager

func (*QLManager) Init added in v0.2.2

func (q *QLManager) Init(fname string) error

Init function loads service map from given file name

func (*QLManager) Keys added in v0.2.2

func (q *QLManager) Keys(srv string) []string

Keys provides list of keys associated with FOXDEN service name

func (*QLManager) QueryKeyAllowed added in v0.3.4

func (q *QLManager) QueryKeyAllowed(key string, service string) bool

Determines if a key from a user query is allowed for querying the given service. A user query key is considered "allowed" if it is an exact match for one of the service's allowed query keys OR if the user query key has a prefix equal to one of the allowed service query keys followed by a ".". The latter matching condition allows for queries on nested fields with dot notation.

func (*QLManager) ServiceQueries added in v0.2.2

func (q *QLManager) ServiceQueries(query string) (map[string]map[string]any, error)

ServiceQueries parses given query string into list of service queries

func (*QLManager) Services added in v0.2.2

func (q *QLManager) Services() []string

Services returns list of services known to QL manager

type QLRecord added in v0.2.9

type QLRecord struct {
	Key         string `json:"key"`
	Description string `json:"description,omitempty"`
	Service     string `json:"service"`
	Units       string `json:"units,omitempty"`
	Schema      string `json:"schema,omitempty"`
	DataType    string `json:"type"`
	DBType      string `json:"db,omitempty"`
}

QLRecord defines structure of QL key

func QLRecords added in v0.2.9

func QLRecords(qlKey string) ([]QLRecord, error)

QLRecords return list of ql keys

func (*QLRecord) Details added in v0.2.9

func (q *QLRecord) Details(show string) string

Details function provides record representation

func (*QLRecord) FillEmpty added in v0.2.9

func (q *QLRecord) FillEmpty()

FillEmpty assign N/A to empty attributes

func (*QLRecord) String added in v0.2.9

func (q *QLRecord) String() string

String returns string representation of ql key

type SchemaKeys

type SchemaKeys map[string]string

SchemaKeys represents full collection of schema keys across all schemas

type ServiceMap

type ServiceMap map[string][]string

ServiceMap defines FOXDEN service QL mapping

Jump to

Keyboard shortcuts

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