cantabularmetadata

package
v2.260.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const (
	Service         = "cantabularMetadata"
	SoftwareVersion = "v10"
)

Cantabular service names

View Source
const QueryDefaultClassification = `` /* 170-byte string literal not displayed */

QueryDefaultClassification is the graphQL query to determine which of the provided variables is the default categorisation

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the client for interacting with the Cantabular API

func NewClient

func NewClient(cfg Config, ua httpClient) *Client

NewClient returns a new Client

func (*Client) Checker

func (c *Client) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker contacts the /graphql endpoint with an empty query and updates the healthcheck state accordingly.

func (*Client) StatusCode

func (c *Client) StatusCode(err error) int

StatusCode provides a callback function whereby users can check a returned error for an embedded HTTP status code

type Config

type Config struct {
	Host           string
	GraphQLTimeout time.Duration
}

Config holds the config used to initialise the Cantabular Client

type Data

type Data struct {
	Dataset `json:"dataset"`
}

type Dataset

type Dataset struct {
	Vars []Var `json:"vars"`
}

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse models the error response from cantabular

type GQLError

type GQLError struct {
	Message   string     `json:"message"`
	Locations []Location `json:"locations"`
	Path      []string   `json:"path"`
}

func (*GQLError) StatusCode

func (e *GQLError) StatusCode() int

StatusCode returns the status code defined at the begining of the Error message. For example: a status 404 is extracted from '404 Not Found: dataset not loaded in this server'. If no status code is provided, then a value of 502 bad gateway is returned.

type GetDefaultClassificationRequest

type GetDefaultClassificationRequest struct {
	Dataset   string
	Variables []string
}

type GetDefaultClassificationResponse

type GetDefaultClassificationResponse struct {
	Variables []string
}

type Location

type Location struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

type Meta

type Meta struct {
	DefaultClassificationFlag string `json:"Default_Classification_Flag"`
}

type QueryData

type QueryData struct {
	Dataset   string
	Variables []string
}

QueryData holds all the possible required variables to encode any of the graphql queries defined in this file.

func (*QueryData) Encode

func (data *QueryData) Encode(query string) (bytes.Buffer, error)

Encode the provided graphQL query with the data in QueryData returns a byte buffer with the encoded query, along with any encoding error that might happen

type Var

type Var struct {
	Name string `json:"name"`
	Meta Meta   `json:"meta"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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