schema

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

type Aggregate map[string]any

Aggregate represents an aggregated query object

func (Aggregate) AsColumnCount

func (j Aggregate) AsColumnCount() (*AggregateColumnCount, error)

AsColumnCount tries to convert the instance to AggregateColumnCount type

func (Aggregate) AsSingleColumn

func (j Aggregate) AsSingleColumn() (*AggregateSingleColumn, error)

AsSingleColumn tries to convert the instance to AggregateSingleColumn type

func (Aggregate) AsStarCount

func (j Aggregate) AsStarCount() (*AggregateStarCount, error)

AsStarCount tries to convert the instance to AggregateStarCount type

func (Aggregate) Interface

func (j Aggregate) Interface() AggregateEncoder

Interface tries to convert the instance to AggregateEncoder interface

func (Aggregate) InterfaceT

func (j Aggregate) InterfaceT() (AggregateEncoder, error)

InterfaceT tries to convert the instance to AggregateEncoder interface safely with explicit error

func (Aggregate) Type

func (j Aggregate) Type() (AggregateType, error)

Type gets the type enum of the current type

func (*Aggregate) UnmarshalJSON

func (j *Aggregate) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type AggregateColumnCount

type AggregateColumnCount struct {
	Type AggregateType `json:"type" yaml:"type" mapstructure:"type"`
	// The column to apply the aggregation function to
	Column string `json:"column" yaml:"column" mapstructure:"column"`
	// Whether or not only distinct items should be counted.
	Distinct bool `json:"distinct" yaml:"distinct" mapstructure:"distinct"`
}

AggregateColumnCount represents an aggregate object which count the number of rows with non-null values in the specified columns. If the distinct flag is set, then the count should only count unique non-null values of those columns.

func NewAggregateColumnCount

func NewAggregateColumnCount(column string, distinct bool) *AggregateColumnCount

NewAggregateColumnCount creates a new AggregateColumnCount instance

func (AggregateColumnCount) Encode

func (ag AggregateColumnCount) Encode() Aggregate

Encode converts the instance to raw Aggregate

type AggregateEncoder

type AggregateEncoder interface {
	Encode() Aggregate
}

AggregateEncoder abstracts the serialization interface for Aggregate

type AggregateFunctionDefinition

type AggregateFunctionDefinition struct {
	// The scalar or object type of the result of this function
	ResultType Type `json:"result_type" yaml:"result_type" mapstructure:"result_type"`
}

The definition of an aggregation function on a scalar type

func (*AggregateFunctionDefinition) UnmarshalJSON

func (j *AggregateFunctionDefinition) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type AggregateSingleColumn

type AggregateSingleColumn struct {
	Type AggregateType `json:"type" yaml:"type" mapstructure:"type"`
	// The column to apply the aggregation function to
	Column string `json:"column" yaml:"column" mapstructure:"column"`
	// Single column aggregate function name.
	Function string `json:"function" yaml:"function" mapstructure:"function"`
}

AggregateSingleColumn represents an aggregate object which applies an aggregation function (as defined by the column's scalar type in the schema response) to a column.

func NewAggregateSingleColumn

func NewAggregateSingleColumn(column string, function string) *AggregateSingleColumn

NewAggregateSingleColumn creates a new AggregateSingleColumn instance

func (AggregateSingleColumn) Encode

func (ag AggregateSingleColumn) Encode() Aggregate

Encode converts the instance to raw Aggregate

type AggregateStarCount

type AggregateStarCount struct {
	Type AggregateType `json:"type" mapstructure:"type"`
}

AggregateStarCount represents an aggregate object which counts all matched rows

func NewAggregateStarCount

func NewAggregateStarCount() *AggregateStarCount

NewAggregateStarCount creates a new AggregateStarCount instance

func (AggregateStarCount) Encode

func (ag AggregateStarCount) Encode() Aggregate

Encode converts the instance to raw Aggregate

type AggregateType

type AggregateType string

AggregateType represents an aggregate type

const (
	// AggregateTypeColumnCount aggregates count the number of rows with non-null values in the specified columns.
	// If the distinct flag is set, then the count should only count unique non-null values of those columns,
	AggregateTypeColumnCount AggregateType = "column_count"
	// AggregateTypeSingleColumn aggregates apply an aggregation function (as defined by the column's scalar type in the schema response) to a column
	AggregateTypeSingleColumn AggregateType = "single_column"
	// AggregateTypeStarCount aggregates count all matched rows
	AggregateTypeStarCount AggregateType = "star_count"
)

func ParseAggregateType

func ParseAggregateType(input string) (AggregateType, error)

ParseAggregateType parses an aggregate type argument type from string

func (AggregateType) IsValid added in v0.4.0

func (j AggregateType) IsValid() bool

IsValid checks if the value is invalid

func (*AggregateType) UnmarshalJSON

func (j *AggregateType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Argument

type Argument struct {
	Type  ArgumentType `json:"type" yaml:"type" mapstructure:"type"`
	Name  string       `json:"name" yaml:"name" mapstructure:"name"`
	Value any          `json:"value" yaml:"value" mapstructure:"value"`
}

Argument is provided by reference to a variable or as a literal value

func (Argument) MarshalJSON added in v0.5.0

func (j Argument) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Argument) UnmarshalJSON

func (j *Argument) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ArgumentInfo

type ArgumentInfo struct {
	// Argument description
	Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// The name of the type of this argument
	Type Type `json:"type" yaml:"type" mapstructure:"type"`
}

func (*ArgumentInfo) UnmarshalJSON

func (j *ArgumentInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ArgumentType

type ArgumentType string

ArgumentType represents an argument type enum

const (
	ArgumentTypeLiteral  ArgumentType = "literal"
	ArgumentTypeVariable ArgumentType = "variable"
)

func ParseArgumentType

func ParseArgumentType(input string) (ArgumentType, error)

ParseArgumentType parses an argument type from string

func (ArgumentType) IsValid added in v0.4.0

func (j ArgumentType) IsValid() bool

IsValid checks if the value is invalid

func (*ArgumentType) UnmarshalJSON

func (j *ArgumentType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ArrayType

type ArrayType struct {
	Type TypeEnum `json:"type" yaml:"type" mapstructure:"type"`
	// The type of the elements of the array
	ElementType Type `json:"element_type" yaml:"element_type" mapstructure:"element_type"`
}

ArrayType represents an array type

func NewArrayType

func NewArrayType(elementType TypeEncoder) *ArrayType

NewArrayType creates a new ArrayType instance

func (ArrayType) Encode

func (ty ArrayType) Encode() Type

Encode returns the raw Type instance

type Capabilities

type Capabilities struct {
	// Mutation corresponds to the JSON schema field "mutation".
	Mutation MutationCapabilities `json:"mutation" yaml:"mutation" mapstructure:"mutation"`

	// Query corresponds to the JSON schema field "query".
	Query QueryCapabilities `json:"query" yaml:"query" mapstructure:"query"`

	// Relationships corresponds to the JSON schema field "relationships".
	Relationships interface{} `json:"relationships,omitempty" yaml:"relationships,omitempty" mapstructure:"relationships,omitempty"`
}

Describes the features of the specification which a data connector implements.

func (*Capabilities) UnmarshalJSON

func (j *Capabilities) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CapabilitiesResponse

type CapabilitiesResponse struct {
	// Capabilities corresponds to the JSON schema field "capabilities".
	Capabilities Capabilities `json:"capabilities" yaml:"capabilities" mapstructure:"capabilities"`

	// Version corresponds to the JSON schema field "version".
	Version string `json:"version" yaml:"version" mapstructure:"version"`
}

func (CapabilitiesResponse) MarshalCapabilitiesJSON added in v0.2.0

func (j CapabilitiesResponse) MarshalCapabilitiesJSON() ([]byte, error)

MarshalCapabilitiesJSON encodes the NDC schema response to JSON

func (*CapabilitiesResponse) UnmarshalJSON

func (j *CapabilitiesResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CapabilitiesResponseMarshaler added in v0.2.0

type CapabilitiesResponseMarshaler interface {
	MarshalCapabilitiesJSON() ([]byte, error)
}

CapabilitiesResponseMarshaler abstract the response for /capabilities handler

type CollectionInfo

type CollectionInfo struct {
	// Any arguments that this collection requires
	Arguments CollectionInfoArguments `json:"arguments" yaml:"arguments" mapstructure:"arguments"`

	// Description of the collection
	Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Any foreign key constraints enforced on this collection
	ForeignKeys CollectionInfoForeignKeys `json:"foreign_keys" yaml:"foreign_keys" mapstructure:"foreign_keys"`

	// The name of the collection
	//
	// Note: these names are abstract - there is no requirement that this name
	// correspond to the name of an actual collection in the database.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// The name of the collection's object type
	Type string `json:"type" yaml:"type" mapstructure:"type"`

	// Any uniqueness constraints enforced on this collection
	UniquenessConstraints CollectionInfoUniquenessConstraints `json:"uniqueness_constraints" yaml:"uniqueness_constraints" mapstructure:"uniqueness_constraints"`
}

func (*CollectionInfo) UnmarshalJSON

func (j *CollectionInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CollectionInfoArguments

type CollectionInfoArguments map[string]ArgumentInfo

Any arguments that this collection requires

type CollectionInfoForeignKeys

type CollectionInfoForeignKeys map[string]ForeignKeyConstraint

Any foreign key constraints enforced on this collection

type CollectionInfoUniquenessConstraints

type CollectionInfoUniquenessConstraints map[string]UniquenessConstraint

Any uniqueness constraints enforced on this collection

type ColumnField

type ColumnField struct {
	Type FieldType `json:"type" yaml:"type" mapstructure:"type"`
	// Column name
	Column string `json:"column" yaml:"column" mapstructure:"column"`
	// When the type of the column is a (possibly-nullable) array or object,
	// the caller can request a subset of the complete column data, by specifying fields to fetch here.
	// If omitted, the column data will be fetched in full.
	Fields NestedField `json:"fields,omitempty" yaml:"fields,omitempty" mapstructure:"fields"`
}

ColumnField represents a column field

func NewColumnField

func NewColumnField(column string, fields NestedFieldEncoder) *ColumnField

NewColumnField creates a new ColumnField instance

func (ColumnField) Encode

func (f ColumnField) Encode() Field

Encode converts the instance to raw Field

type ComparisonOperatorCustom

type ComparisonOperatorCustom struct {
	Type ComparisonOperatorDefinitionType `json:"type" yaml:"type" mapstructure:"type"`
	// The type of the argument to this operator
	ArgumentType Type `json:"argument_type" yaml:"argument_type" mapstructure:"argument_type"`
}

ComparisonOperatorCustom presents a custom comparison operator

func NewComparisonOperatorCustom

func NewComparisonOperatorCustom(argumentType TypeEncoder) *ComparisonOperatorCustom

NewComparisonOperatorCustom create a new ComparisonOperatorCustom instance

func (ComparisonOperatorCustom) Encode

Encode converts the instance to raw ComparisonOperatorDefinition

type ComparisonOperatorDefinition

type ComparisonOperatorDefinition map[string]any

ComparisonOperatorDefinition the definition of a comparison operator on a scalar type

func (ComparisonOperatorDefinition) AsCustom

AsCustom tries to convert the instance to ComparisonOperatorIn type

func (ComparisonOperatorDefinition) AsEqual

AsEqual tries to convert the instance to ComparisonOperatorEqual type

func (ComparisonOperatorDefinition) AsIn

AsIn tries to convert the instance to ComparisonOperatorIn type

func (ComparisonOperatorDefinition) Interface

Interface tries to convert the instance to ComparisonOperatorDefinitionEncoder interface

func (ComparisonOperatorDefinition) InterfaceT

InterfaceT tries to convert the instance to ComparisonOperatorDefinitionEncoder interface safely with explicit error

func (ComparisonOperatorDefinition) Type

Type gets the type enum of the current type

func (*ComparisonOperatorDefinition) UnmarshalJSON

func (j *ComparisonOperatorDefinition) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ComparisonOperatorDefinitionEncoder

type ComparisonOperatorDefinitionEncoder interface {
	Encode() ComparisonOperatorDefinition
}

ComparisonOperatorDefinitionEncoder abstracts the serialization interface for ComparisonOperatorDefinition

type ComparisonOperatorDefinitionType

type ComparisonOperatorDefinitionType string

ComparisonOperatorDefinitionType represents a binary comparison operator type enum

const (
	ComparisonOperatorDefinitionTypeEqual  ComparisonOperatorDefinitionType = "equal"
	ComparisonOperatorDefinitionTypeIn     ComparisonOperatorDefinitionType = "in"
	ComparisonOperatorDefinitionTypeCustom ComparisonOperatorDefinitionType = "custom"
)

func ParseComparisonOperatorDefinitionType

func ParseComparisonOperatorDefinitionType(input string) (ComparisonOperatorDefinitionType, error)

ParseComparisonOperatorDefinitionType parses a type of a comparison operator definition

func (ComparisonOperatorDefinitionType) IsValid added in v0.4.0

IsValid checks if the value is invalid

func (*ComparisonOperatorDefinitionType) UnmarshalJSON

func (j *ComparisonOperatorDefinitionType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ComparisonOperatorEqual

type ComparisonOperatorEqual struct {
	Type ComparisonOperatorDefinitionType `json:"type" yaml:"type" mapstructure:"type"`
}

ComparisonOperatorEqual presents an equal comparison operator

func NewComparisonOperatorEqual

func NewComparisonOperatorEqual() *ComparisonOperatorEqual

NewComparisonOperatorEqual create a new ComparisonOperatorEqual instance

func (ComparisonOperatorEqual) Encode

Encode converts the instance to raw ComparisonOperatorDefinition

type ComparisonOperatorIn

type ComparisonOperatorIn struct {
	Type ComparisonOperatorDefinitionType `json:"type" yaml:"type" mapstructure:"type"`
}

ComparisonOperatorIn presents an in comparison operator

func NewComparisonOperatorIn

func NewComparisonOperatorIn() *ComparisonOperatorIn

NewComparisonOperatorIn create a new ComparisonOperatorIn instance

func (ComparisonOperatorIn) Encode

Encode converts the instance to raw ComparisonOperatorDefinition

type ComparisonTarget

type ComparisonTarget struct {
	Type ComparisonTargetType `json:"type" yaml:"type" mapstructure:"type"`
	Name string               `json:"name" yaml:"name" mapstructure:"name"`
	Path []PathElement        `json:"path,omitempty" yaml:"path,omitempty" mapstructure:"path"`
}

ComparisonTarget represents a comparison target object

type ComparisonTargetType

type ComparisonTargetType string

ComparisonTargetType represents comparison target enums

const (
	ComparisonTargetTypeColumn               ComparisonTargetType = "column"
	ComparisonTargetTypeRootCollectionColumn ComparisonTargetType = "root_collection_column"
)

func ParseComparisonTargetType

func ParseComparisonTargetType(input string) (ComparisonTargetType, error)

ParseComparisonTargetType parses a comparison target type argument type from string

func (ComparisonTargetType) IsValid added in v0.4.0

func (j ComparisonTargetType) IsValid() bool

IsValid checks if the value is invalid

func (*ComparisonTargetType) UnmarshalJSON

func (j *ComparisonTargetType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ComparisonValue

type ComparisonValue map[string]any

ComparisonValue represents a raw comparison value object with validation

func (ComparisonValue) AsColumn

func (cv ComparisonValue) AsColumn() (*ComparisonValueColumn, error)

AsColumn tries to convert the comparison value to column

func (ComparisonValue) AsScalar

func (cv ComparisonValue) AsScalar() (*ComparisonValueScalar, error)

AsScalar tries to convert the comparison value to scalar

func (ComparisonValue) AsVariable

func (cv ComparisonValue) AsVariable() (*ComparisonValueVariable, error)

AsVariable tries to convert the comparison value to column

func (ComparisonValue) Interface

func (cv ComparisonValue) Interface() ComparisonValueEncoder

Interface converts the comparison value to its generic interface

func (ComparisonValue) InterfaceT

func (cv ComparisonValue) InterfaceT() (ComparisonValueEncoder, error)

InterfaceT converts the comparison value to its generic interface safely with explicit error

func (ComparisonValue) Type

GetType gets the type of comparison value

func (*ComparisonValue) UnmarshalJSON

func (j *ComparisonValue) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ComparisonValueColumn

type ComparisonValueColumn struct {
	Type   ComparisonValueType `json:"type" yaml:"type" mapstructure:"type"`
	Column ComparisonTarget    `json:"column" yaml:"column" mapstructure:"column"`
}

ComparisonValueColumn represents a comparison value with column type

func (ComparisonValueColumn) Encode

Encode converts to the raw comparison value

type ComparisonValueEncoder

type ComparisonValueEncoder interface {
	Encode() ComparisonValue
}

ComparisonValueEncoder represents a comparison value encoder interface

type ComparisonValueScalar

type ComparisonValueScalar struct {
	Type  ComparisonValueType `json:"type" yaml:"type" mapstructure:"type"`
	Value any                 `json:"value" yaml:"value" mapstructure:"value"`
}

ComparisonValueScalar represents a comparison value with scalar type

func (ComparisonValueScalar) Encode

Encode converts to the raw comparison value

type ComparisonValueType

type ComparisonValueType string

ComparisonValueType represents a comparison value type enum

const (
	ComparisonValueTypeColumn   ComparisonValueType = "column"
	ComparisonValueTypeScalar   ComparisonValueType = "scalar"
	ComparisonValueTypeVariable ComparisonValueType = "variable"
)

func ParseComparisonValueType

func ParseComparisonValueType(input string) (ComparisonValueType, error)

ParseComparisonValueType parses a comparison value type from string

func (ComparisonValueType) IsValid added in v0.4.0

func (j ComparisonValueType) IsValid() bool

IsValid checks if the value is invalid

func (*ComparisonValueType) UnmarshalJSON

func (j *ComparisonValueType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ComparisonValueVariable

type ComparisonValueVariable struct {
	Type ComparisonValueType `json:"type" yaml:"type" mapstructure:"type"`
	Name string              `json:"name" yaml:"name" mapstructure:"name"`
}

ComparisonValueVariable represents a comparison value with variable type

func (ComparisonValueVariable) Encode

Encode converts to the raw comparison value

type ConnectorError

type ConnectorError struct {

	// A human-readable summary of the error
	Message string `json:"message" yaml:"message" mapstructure:"message"`
	// Any additional structured information about the error
	Details map[string]any `json:"details" yaml:"details" mapstructure:"details"`
	// contains filtered or unexported fields
}

ConnectorError represents a connector error that follows NDC error handling specs

func BadGatewayError

func BadGatewayError(message string, details map[string]any) *ConnectorError

BadGatewayError returns an error when the request could not be handled because an upstream service was unavailable or returned an unexpected response, e.g., a connection to a database server failed

func BadRequestError

func BadRequestError(message string, details map[string]any) *ConnectorError

BadRequestError returns an error when the request did not match the data connector's expectation based on this specification

func ConflictError

func ConflictError(message string, details map[string]any) *ConnectorError

ConflictError returns an error when the request could not be handled because it would create a conflicting state for the data source, for example, a mutation might fail because a foreign key constraint was not met

func ForbiddenError

func ForbiddenError(message string, details map[string]any) *ConnectorError

ForbiddenError returns an error when the request could not be handled because a permission check failed, for example, a mutation might fail because a check constraint was not met

func InternalServerError

func InternalServerError(message string, details map[string]any) *ConnectorError

InternalServerError returns an error when the request could not be handled because of an error on the server

func NewConnectorError

func NewConnectorError(statusCode int, message string, details map[string]any) *ConnectorError

NewConnectorError creates a ConnectorError instance

func NotSupportedError

func NotSupportedError(message string, details map[string]any) *ConnectorError

NotSupportedError returns an error when the request could not be handled because it relies on an unsupported capability. Note: this ought to indicate an error on the caller side, since the caller should not generate requests which are incompatible with the indicated capabilities

func UnauthorizeError

func UnauthorizeError(message string, details map[string]any) *ConnectorError

UnauthorizeError returns an unauthorized error.

func UnprocessableContentError

func UnprocessableContentError(message string, details map[string]any) *ConnectorError

UnprocessableContentError returns an error when the request could not be handled because, while the request was well-formed, it was not semantically correct. For example, a value for a custom scalar type was provided, but with an incorrect type.

func (ConnectorError) Error

func (ce ConnectorError) Error() string

Error implements the Error interface

func (ConnectorError) StatusCode

func (ce ConnectorError) StatusCode() int

StatusCode gets the inner status code

func (ConnectorError) String

func (ce ConnectorError) String() string

String implements the Stringer interface

type ErrorResponse

type ErrorResponse struct {
	// Any additional structured information about the error
	Details interface{} `json:"details" yaml:"details" mapstructure:"details"`

	// A human-readable summary of the error
	Message string `json:"message" yaml:"message" mapstructure:"message"`
}

func (ErrorResponse) Error

func (ce ErrorResponse) Error() string

Error implements the Error interface

func (ErrorResponse) String

func (ce ErrorResponse) String() string

String implements the Stringer interface

func (*ErrorResponse) UnmarshalJSON

func (j *ErrorResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ExistsInCollection

type ExistsInCollection map[string]any

ExistsInCollection represents an Exists In Collection object

func (ExistsInCollection) AsRelated

AsRelated tries to convert the instance to related type

func (ExistsInCollection) AsUnrelated

AsRelated tries to convert the instance to unrelated type

func (ExistsInCollection) Interface

Interface tries to convert the instance to the ExistsInCollectionEncoder interface

func (ExistsInCollection) InterfaceT

InterfaceT tries to convert the instance to the ExistsInCollectionEncoder interface safely with explicit error

func (ExistsInCollection) Type

Type gets the type enum of the current type

func (*ExistsInCollection) UnmarshalJSON

func (j *ExistsInCollection) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ExistsInCollectionEncoder

type ExistsInCollectionEncoder interface {
	Encode() ExistsInCollection
}

ExistsInCollectionEncoder abstracts the ExistsInCollection serialization interface

type ExistsInCollectionRelated

type ExistsInCollectionRelated struct {
	Type         ExistsInCollectionType `json:"type" yaml:"type" mapstructure:"type"`
	Relationship string                 `json:"relationship" yaml:"relationship" mapstructure:"relationship"`
	// Values to be provided to any collection arguments
	Arguments map[string]RelationshipArgument `json:"arguments" yaml:"arguments" mapstructure:"arguments"`
}

ExistsInCollectionRelated represents Related collections that are related to the original collection by a relationship in the collection_relationships field of the top-level QueryRequest.

func (ExistsInCollectionRelated) Encode

Encode converts the instance to its raw type

type ExistsInCollectionType

type ExistsInCollectionType string

ExistsInCollectionType represents an exists in collection type enum

const (
	ExistsInCollectionTypeRelated   ExistsInCollectionType = "related"
	ExistsInCollectionTypeUnrelated ExistsInCollectionType = "unrelated"
)

func ParseExistsInCollectionType

func ParseExistsInCollectionType(input string) (ExistsInCollectionType, error)

ParseExistsInCollectionType parses a comparison value type from string

func (ExistsInCollectionType) IsValid added in v0.4.0

func (j ExistsInCollectionType) IsValid() bool

IsValid checks if the value is invalid

func (*ExistsInCollectionType) UnmarshalJSON

func (j *ExistsInCollectionType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ExistsInCollectionUnrelated

type ExistsInCollectionUnrelated struct {
	Type ExistsInCollectionType `json:"type" yaml:"type" mapstructure:"type"`
	// The name of a collection
	Collection string `json:"collection" yaml:"collection" mapstructure:"collection"`
	// Values to be provided to any collection arguments
	Arguments map[string]RelationshipArgument `json:"arguments" yaml:"arguments" mapstructure:"arguments"`
}

ExistsInCollectionUnrelated represents unrelated collections.

func (ExistsInCollectionUnrelated) Encode

Encode converts the instance to its raw type

type ExplainResponse

type ExplainResponse struct {
	// A list of human-readable key-value pairs describing a query execution plan. For
	// example, a connector for a relational database might return the generated SQL
	// and/or the output of the `EXPLAIN` command. An API-based connector might encode
	// a list of statically-known API calls which would be made.
	Details ExplainResponseDetails `json:"details" yaml:"details" mapstructure:"details"`
}

func (*ExplainResponse) UnmarshalJSON

func (j *ExplainResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ExplainResponseDetails

type ExplainResponseDetails map[string]string

A list of human-readable key-value pairs describing a query execution plan. For example, a connector for a relational database might return the generated SQL and/or the output of the `EXPLAIN` command. An API-based connector might encode a list of statically-known API calls which would be made.

type Expression

type Expression map[string]any

Expression represents the query expression object

func (Expression) AsAnd

func (j Expression) AsAnd() (*ExpressionAnd, error)

AsAnd tries to convert the instance to and type

func (Expression) AsBinaryComparisonOperator

func (j Expression) AsBinaryComparisonOperator() (*ExpressionBinaryComparisonOperator, error)

AsBinaryComparisonOperator tries to convert the instance to ExpressionBinaryComparisonOperator instance

func (Expression) AsExists

func (j Expression) AsExists() (*ExpressionExists, error)

AsExists tries to convert the instance to ExpressionExists instance

func (Expression) AsNot

func (j Expression) AsNot() (*ExpressionNot, error)

AsNot tries to convert the instance to ExpressionNot instance

func (Expression) AsOr

func (j Expression) AsOr() (*ExpressionOr, error)

AsOr tries to convert the instance to ExpressionOr instance

func (Expression) AsUnaryComparisonOperator

func (j Expression) AsUnaryComparisonOperator() (*ExpressionUnaryComparisonOperator, error)

AsUnaryComparisonOperator tries to convert the instance to ExpressionUnaryComparisonOperator instance

func (Expression) Interface

func (j Expression) Interface() ExpressionEncoder

Interface tries to convert the instance to the ExpressionEncoder interface

func (Expression) InterfaceT

func (j Expression) InterfaceT() (ExpressionEncoder, error)

InterfaceT tries to convert the instance to the ExpressionEncoder interface safely with explicit error

func (Expression) Type

func (j Expression) Type() (ExpressionType, error)

Type gets the type enum of the current type

func (*Expression) UnmarshalJSON

func (j *Expression) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ExpressionAnd

type ExpressionAnd struct {
	Type        ExpressionType `json:"type" yaml:"type" mapstructure:"type"`
	Expressions []Expression   `json:"expressions" yaml:"expressions" mapstructure:"expressions"`
}

ExpressionAnd is an object which represents the conjunction of expressions

func (ExpressionAnd) Encode

func (exp ExpressionAnd) Encode() Expression

Encode converts the instance to a raw Expression

type ExpressionBinaryComparisonOperator

type ExpressionBinaryComparisonOperator struct {
	Type     ExpressionType   `json:"type" yaml:"type" mapstructure:"type"`
	Operator string           `json:"operator" yaml:"operator" mapstructure:"operator"`
	Column   ComparisonTarget `json:"column" yaml:"column" mapstructure:"column"`
	Value    ComparisonValue  `json:"value" yaml:"value" mapstructure:"value"`
}

ExpressionBinaryComparisonOperator is an object which represents an binary operator expression

func (ExpressionBinaryComparisonOperator) Encode

Encode converts the instance to a raw Expression

type ExpressionEncoder

type ExpressionEncoder interface {
	Encode() Expression
}

ExpressionEncoder abstracts the expression encoder interface

type ExpressionExists

type ExpressionExists struct {
	Type         ExpressionType     `json:"type" yaml:"type" mapstructure:"type"`
	Predicate    Expression         `json:"predicate" yaml:"predicate" mapstructure:"predicate"`
	InCollection ExistsInCollection `json:"in_collection" yaml:"in_collection" mapstructure:"in_collection"`
}

ExpressionExists is an object which represents an EXISTS expression

func (ExpressionExists) Encode

func (exp ExpressionExists) Encode() Expression

Encode converts the instance to a raw Expression

type ExpressionNot

type ExpressionNot struct {
	Type       ExpressionType `json:"type" yaml:"type" mapstructure:"type"`
	Expression Expression     `json:"expression" yaml:"expression" mapstructure:"expression"`
}

ExpressionNot is an object which represents the negation of an expression

func (ExpressionNot) Encode

func (exp ExpressionNot) Encode() Expression

Encode converts the instance to a raw Expression

type ExpressionOr

type ExpressionOr struct {
	Type        ExpressionType `json:"type" yaml:"type" mapstructure:"type"`
	Expressions []Expression   `json:"expressions" yaml:"expressions" mapstructure:"expressions"`
}

ExpressionOr is an object which represents the disjunction of expressions

func (ExpressionOr) Encode

func (exp ExpressionOr) Encode() Expression

Encode converts the instance to a raw Expression

type ExpressionType

type ExpressionType string

ExpressionType represents the filtering expression enums

const (
	ExpressionTypeAnd                      ExpressionType = "and"
	ExpressionTypeOr                       ExpressionType = "or"
	ExpressionTypeNot                      ExpressionType = "not"
	ExpressionTypeUnaryComparisonOperator  ExpressionType = "unary_comparison_operator"
	ExpressionTypeBinaryComparisonOperator ExpressionType = "binary_comparison_operator"
	ExpressionTypeExists                   ExpressionType = "exists"
)

func ParseExpressionType

func ParseExpressionType(input string) (ExpressionType, error)

ParseExpressionType parses a comparison target type argument type from string

func (ExpressionType) IsValid added in v0.4.0

func (j ExpressionType) IsValid() bool

IsValid checks if the value is invalid

func (*ExpressionType) UnmarshalJSON

func (j *ExpressionType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ExpressionUnaryComparisonOperator

type ExpressionUnaryComparisonOperator struct {
	Type     ExpressionType          `json:"type" yaml:"type" mapstructure:"type"`
	Operator UnaryComparisonOperator `json:"operator" yaml:"operator" mapstructure:"operator"`
	Column   ComparisonTarget        `json:"column" yaml:"column" mapstructure:"column"`
}

ExpressionUnaryComparisonOperator is an object which represents a unary operator expression

func (ExpressionUnaryComparisonOperator) Encode

Encode converts the instance to a raw Expression

type Field

type Field map[string]any

Field represents a field

func (Field) AsColumn

func (j Field) AsColumn() (*ColumnField, error)

AsColumn tries to convert the current type to ColumnField

func (Field) AsRelationship

func (j Field) AsRelationship() (*RelationshipField, error)

AsRelationship tries to convert the current type to RelationshipField

func (Field) Interface

func (j Field) Interface() FieldEncoder

Interface converts the comparison value to its generic interface

func (Field) InterfaceT

func (j Field) InterfaceT() (FieldEncoder, error)

InterfaceT converts the comparison value to its generic interface safely with explicit error

func (Field) Type

func (j Field) Type() (FieldType, error)

Type gets the type enum of the current type

func (*Field) UnmarshalJSON

func (j *Field) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type FieldEncoder

type FieldEncoder interface {
	Encode() Field
}

type FieldType

type FieldType string

FieldType represents a field type

const (
	FieldTypeColumn       FieldType = "column"
	FieldTypeRelationship FieldType = "relationship"
)

func ParseFieldType

func ParseFieldType(input string) (FieldType, error)

ParseFieldType parses a field type from string

func (FieldType) IsValid added in v0.4.0

func (j FieldType) IsValid() bool

IsValid checks if the value is invalid

func (*FieldType) UnmarshalJSON

func (j *FieldType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ForeignKeyConstraint

type ForeignKeyConstraint struct {
	// The columns on which you want want to define the foreign key.
	ColumnMapping ForeignKeyConstraintColumnMapping `json:"column_mapping" yaml:"column_mapping" mapstructure:"column_mapping"`

	// The name of a collection
	ForeignCollection string `json:"foreign_collection" yaml:"foreign_collection" mapstructure:"foreign_collection"`
}

func (*ForeignKeyConstraint) UnmarshalJSON

func (j *ForeignKeyConstraint) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ForeignKeyConstraintColumnMapping

type ForeignKeyConstraintColumnMapping map[string]string

The columns on which you want want to define the foreign key.

type FunctionInfo

type FunctionInfo struct {
	// Any arguments that this collection requires
	Arguments FunctionInfoArguments `json:"arguments" yaml:"arguments" mapstructure:"arguments"`

	// Description of the function
	Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// The name of the function
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// The name of the function's result type
	ResultType Type `json:"result_type" yaml:"result_type" mapstructure:"result_type"`
}

func (*FunctionInfo) UnmarshalJSON

func (j *FunctionInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*FunctionInfo) UnmarshalJSONMap added in v0.2.0

func (j *FunctionInfo) UnmarshalJSONMap(raw map[string]json.RawMessage) error

UnmarshalJSONMap decodes FunctionInfo from a JSON map.

type FunctionInfoArguments

type FunctionInfoArguments map[string]ArgumentInfo

Any arguments that this collection requires

type LeafCapability

type LeafCapability map[string]interface{}

A unit value to indicate a particular leaf capability is supported. This is an empty struct to allow for future sub-capabilities.

type MutationCapabilities

type MutationCapabilities struct {
	// Does the connector support explaining mutations
	Explain interface{} `json:"explain,omitempty" yaml:"explain,omitempty" mapstructure:"explain,omitempty"`

	// Does the connector support executing multiple mutations in a transaction.
	Transactional interface{} `json:"transactional,omitempty" yaml:"transactional,omitempty" mapstructure:"transactional,omitempty"`
}

type MutationOperation

type MutationOperation struct {
	Type MutationOperationType `json:"type" yaml:"type" mapstructure:"type"`
	// The name of the operation
	Name string `json:"name" yaml:"name" mapstructure:"name"`
	// Any named procedure arguments
	Arguments json.RawMessage `json:"arguments" yaml:"arguments" mapstructure:"arguments"`
	// The fields to return from the result, or null to return everything
	Fields NestedField `json:"fields,omitempty" yaml:"fields,omitempty" mapstructure:"fields"`
}

MutationOperation represents a mutation operation

func (*MutationOperation) UnmarshalJSON

func (j *MutationOperation) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MutationOperationResults

type MutationOperationResults map[string]any

MutationOperationResults represent the result of mutation operation

func (MutationOperationResults) AsProcedure

func (j MutationOperationResults) AsProcedure() (*ProcedureResult, error)

AsProcedure tries to convert the instance to ProcedureResult type

func (MutationOperationResults) Interface

Interface tries to convert the instance to MutationOperationResultsEncoder interface

func (MutationOperationResults) InterfaceT

InterfaceT tries to convert the instance to MutationOperationResultsEncoder interface safely with explicit error

func (MutationOperationResults) Type

Type gets the type enum of the current type

func (*MutationOperationResults) UnmarshalJSON

func (j *MutationOperationResults) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MutationOperationResultsEncoder

type MutationOperationResultsEncoder interface {
	Encode() MutationOperationResults
}

MutationOperationResultsEncoder abstracts the serialization interface for MutationOperationResults

type MutationOperationType

type MutationOperationType string

MutationOperationType represents the mutation operation type enum

const (
	MutationOperationProcedure MutationOperationType = "procedure"
)

func ParseMutationOperationType

func ParseMutationOperationType(input string) (*MutationOperationType, error)

ParseMutationOperationType parses a mutation operation type argument type from string

func (*MutationOperationType) UnmarshalJSON

func (j *MutationOperationType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MutationRequest

type MutationRequest struct {
	// The relationships between collections involved in the entire mutation request
	CollectionRelationships MutationRequestCollectionRelationships `json:"collection_relationships" yaml:"collection_relationships" mapstructure:"collection_relationships"`

	// The mutation operations to perform
	Operations []MutationOperation `json:"operations" yaml:"operations" mapstructure:"operations"`
}

func (*MutationRequest) UnmarshalJSON

func (j *MutationRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MutationRequestCollectionRelationships

type MutationRequestCollectionRelationships map[string]Relationship

The relationships between collections involved in the entire mutation request

type MutationResponse

type MutationResponse struct {
	// The results of each mutation operation, in the same order as they were received
	OperationResults []MutationOperationResults `json:"operation_results" yaml:"operation_results" mapstructure:"operation_results"`
}

func (*MutationResponse) UnmarshalJSON

func (j *MutationResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NamedType

type NamedType struct {
	Type TypeEnum `json:"type" yaml:"type" mapstructure:"type"`
	// The name can refer to a primitive type or a scalar type
	Name string `json:"name" yaml:"name" mapstructure:"name"`
}

NamedType represents a named type

func NewNamedType

func NewNamedType(name string) *NamedType

NewNamedType creates a new NamedType instance

func (NamedType) Encode

func (ty NamedType) Encode() Type

Encode returns the raw Type instance

type NestedArray

type NestedArray struct {
	Type   NestedFieldType `json:"type" yaml:"type" mapstructure:"type"`
	Fields NestedField     `json:"fields" yaml:"fields" mapstructure:"fields"`
}

NestedArray presents a nested array field

func NewNestedArray

func NewNestedArray(fields NestedFieldEncoder) *NestedArray

NewNestedArray create a new NestedArray instance

func (NestedArray) Encode

func (ob NestedArray) Encode() NestedField

Encode converts the instance to raw NestedField

type NestedField

type NestedField map[string]any

NestedField represents a nested field

func (NestedField) AsArray

func (j NestedField) AsArray() (*NestedArray, error)

AsArray tries to convert the instance to NestedArray type

func (NestedField) AsObject

func (j NestedField) AsObject() (*NestedObject, error)

AsObject tries to convert the instance to NestedObject type

func (NestedField) Interface

func (j NestedField) Interface() NestedFieldEncoder

Interface tries to convert the instance to NestedFieldEncoder interface

func (NestedField) InterfaceT

func (j NestedField) InterfaceT() (NestedFieldEncoder, error)

Interface tries to convert the instance to NestedFieldEncoder interface safely with explicit error

func (NestedField) IsNil added in v0.1.3

func (j NestedField) IsNil() bool

IsNil checks if the field is null or empty

func (NestedField) Type

func (j NestedField) Type() (NestedFieldType, error)

Type gets the type enum of the current type

func (*NestedField) UnmarshalJSON

func (j *NestedField) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NestedFieldEncoder

type NestedFieldEncoder interface {
	Encode() NestedField
}

NestedFieldEncoder abstracts the serialization interface for NestedField

type NestedFieldType

type NestedFieldType string

NestedFieldType represents a nested field type enum

const (
	NestedFieldTypeObject NestedFieldType = "object"
	NestedFieldTypeArray  NestedFieldType = "array"
)

func ParseNestedFieldType

func ParseNestedFieldType(input string) (NestedFieldType, error)

ParseNestedFieldType parses the type of nested field

func (NestedFieldType) IsValid added in v0.4.0

func (j NestedFieldType) IsValid() bool

IsValid checks if the value is invalid

func (*NestedFieldType) UnmarshalJSON

func (j *NestedFieldType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NestedObject

type NestedObject struct {
	Type   NestedFieldType  `json:"type" yaml:"type" mapstructure:"type"`
	Fields map[string]Field `json:"fields" yaml:"fields" mapstructure:"fields"`
}

NestedObject presents a nested object field

func NewNestedObject

func NewNestedObject(fields map[string]FieldEncoder) *NestedObject

NewNestedObject create a new NestedObject instance

func (NestedObject) Encode

func (ob NestedObject) Encode() NestedField

Encode converts the instance to raw NestedField

type NullableType

type NullableType struct {
	Type TypeEnum `json:"type" yaml:"type" mapstructure:"type"`
	// The type of the non-null inhabitants of this type
	UnderlyingType Type `json:"underlying_type" yaml:"underlying_type" mapstructure:"underlying_type"`
}

NullableType represents a nullable type

func NewNullableArrayType

func NewNullableArrayType(elementType TypeEncoder) *NullableType

NewNullableArrayType creates a new NullableType instance with underlying array type

func NewNullableNamedType

func NewNullableNamedType(name string) *NullableType

NewNullableNamedType creates a new NullableType instance with underlying named type

func NewNullableType

func NewNullableType(underlyingType TypeEncoder) *NullableType

NewNullableType creates a new NullableType instance with underlying type

func (NullableType) Encode

func (ty NullableType) Encode() Type

Encode returns the raw Type instance

type ObjectField

type ObjectField struct {
	// Description of this field
	Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// The type of this field
	Type Type `json:"type" yaml:"type" mapstructure:"type"`
}

The definition of an object field

func (*ObjectField) UnmarshalJSON

func (j *ObjectField) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ObjectType

type ObjectType struct {
	// Description of this type
	Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Fields defined on this object type
	Fields ObjectTypeFields `json:"fields" yaml:"fields" mapstructure:"fields"`
}

The definition of an object type

func (*ObjectType) UnmarshalJSON

func (j *ObjectType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ObjectTypeFields

type ObjectTypeFields map[string]ObjectField

Fields defined on this object type

type OrderBy

type OrderBy struct {
	// The elements to order by, in priority order
	Elements []OrderByElement `json:"elements" yaml:"elements" mapstructure:"elements"`
}

func (*OrderBy) UnmarshalJSON

func (j *OrderBy) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OrderByColumn

type OrderByColumn struct {
	Type OrderByTargetType `json:"type" yaml:"type" mapstructure:"type"`
	// The name of the column
	Name string `json:"name" yaml:"name" mapstructure:"name"`
	// Any relationships to traverse to reach this column
	Path []PathElement `json:"path" yaml:"path" mapstructure:"path"`
}

OrderByColumn represents an ordering object which compares the value in the selected column

func (OrderByColumn) Encode

func (ob OrderByColumn) Encode() OrderByTarget

Encode converts the instance to raw OrderByTarget

type OrderByElement

type OrderByElement struct {
	// OrderDirection corresponds to the JSON schema field "order_direction".
	OrderDirection OrderDirection `json:"order_direction" yaml:"order_direction" mapstructure:"order_direction"`

	// Target corresponds to the JSON schema field "target".
	Target OrderByTarget `json:"target" yaml:"target" mapstructure:"target"`
}

func (*OrderByElement) UnmarshalJSON

func (j *OrderByElement) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OrderBySingleColumnAggregate

type OrderBySingleColumnAggregate struct {
	Type OrderByTargetType `json:"type" yaml:"name" mapstructure:"type"`
	// The column to apply the aggregation function to
	Column string `json:"column" yaml:"column" mapstructure:"column"`
	// Single column aggregate function name.
	Function string `json:"function" yaml:"function" mapstructure:"function"`
	// Non-empty collection of relationships to traverse
	Path []PathElement `json:"path" yaml:"path" mapstructure:"path"`
}

OrderBySingleColumnAggregate An ordering of type single_column_aggregate orders rows by an aggregate computed over rows in some related collection. If the respective aggregates are incomparable, the ordering should continue to the next OrderByElement.

func (OrderBySingleColumnAggregate) Encode

Encode converts the instance to raw OrderByTarget

type OrderByStarCountAggregate

type OrderByStarCountAggregate struct {
	Type OrderByTargetType `json:"type" yaml:"type" mapstructure:"type"`
	// Non-empty collection of relationships to traverse
	Path []PathElement `json:"path" yaml:"path" mapstructure:"path"`
}

OrderByStarCountAggregate An ordering of type star_count_aggregate orders rows by a count of rows in some related collection. If the respective aggregates are incomparable, the ordering should continue to the next OrderByElement.

func (OrderByStarCountAggregate) Encode

Encode converts the instance to raw OrderByTarget

type OrderByTarget

type OrderByTarget map[string]any

OrderByTarget represents an order_by field of the Query object

func (OrderByTarget) AsColumn

func (j OrderByTarget) AsColumn() (*OrderByColumn, error)

AsColumn tries to convert the instance to OrderByColumn type

func (OrderByTarget) AsSingleColumnAggregate

func (j OrderByTarget) AsSingleColumnAggregate() (*OrderBySingleColumnAggregate, error)

AsSingleColumnAggregate tries to convert the instance to OrderBySingleColumnAggregate type

func (OrderByTarget) AsStarCountAggregate

func (j OrderByTarget) AsStarCountAggregate() (*OrderByStarCountAggregate, error)

AsStarCountAggregate tries to convert the instance to OrderByStarCountAggregate type

func (OrderByTarget) Interface

func (j OrderByTarget) Interface() OrderByTargetEncoder

Interface tries to convert the instance to OrderByTargetEncoder interface

func (OrderByTarget) InterfaceT

func (j OrderByTarget) InterfaceT() (OrderByTargetEncoder, error)

InterfaceT tries to convert the instance to OrderByTargetEncoder interface safely with explicit error

func (OrderByTarget) Type

Type gets the type enum of the current type

func (*OrderByTarget) UnmarshalJSON

func (j *OrderByTarget) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OrderByTargetEncoder

type OrderByTargetEncoder interface {
	Encode() OrderByTarget
}

OrderByTargetEncoder abstracts the serialization interface for OrderByTarget

type OrderByTargetType

type OrderByTargetType string

OrderByTargetType represents a ordering target type

const (
	OrderByTargetTypeColumn                OrderByTargetType = "column"
	OrderByTargetTypeSingleColumnAggregate OrderByTargetType = "single_column_aggregate"
	OrderByTargetTypeStarCountAggregate    OrderByTargetType = "star_count_aggregate"
)

func ParseOrderByTargetType

func ParseOrderByTargetType(input string) (OrderByTargetType, error)

ParseOrderByTargetType parses a ordering target type argument type from string

func (OrderByTargetType) IsValid added in v0.4.0

func (j OrderByTargetType) IsValid() bool

IsValid checks if the value is invalid

func (*OrderByTargetType) UnmarshalJSON

func (j *OrderByTargetType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OrderDirection

type OrderDirection string
const OrderDirectionAsc OrderDirection = "asc"
const OrderDirectionDesc OrderDirection = "desc"

func (*OrderDirection) UnmarshalJSON

func (j *OrderDirection) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type PathElement

type PathElement struct {
	// Values to be provided to any collection arguments
	Arguments PathElementArguments `json:"arguments" yaml:"arguments" mapstructure:"arguments"`

	// A predicate expression to apply to the target collection
	Predicate Expression `json:"predicate,omitempty" yaml:"predicate,omitempty" mapstructure:"predicate,omitempty"`

	// The name of the relationship to follow
	Relationship string `json:"relationship" yaml:"relationship" mapstructure:"relationship"`
}

func (*PathElement) UnmarshalJSON

func (j *PathElement) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type PathElementArguments

type PathElementArguments map[string]RelationshipArgument

Values to be provided to any collection arguments

type PredicateType

type PredicateType struct {
	Type TypeEnum `json:"type" yaml:"type" mapstructure:"type"`
	// The name can refer to a primitive type or a scalar type
	ObjectTypeName string `json:"object_type_name" yaml:"object_type_name" mapstructure:"object_type_name"`
}

PredicateType represents a predicate type for a given object type

func NewPredicateType

func NewPredicateType(objectTypeName string) *PredicateType

NewPredicateType creates a new PredicateType instance

func (PredicateType) Encode

func (ty PredicateType) Encode() Type

Encode returns the raw Type instance

type ProcedureInfo

type ProcedureInfo struct {
	// Any arguments that this collection requires
	Arguments ProcedureInfoArguments `json:"arguments" yaml:"arguments" mapstructure:"arguments"`

	// Column description
	Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// The name of the procedure
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// The name of the result type
	ResultType Type `json:"result_type" yaml:"result_type" mapstructure:"result_type"`
}

func (*ProcedureInfo) UnmarshalJSON

func (j *ProcedureInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ProcedureInfo) UnmarshalJSONMap added in v0.2.0

func (j *ProcedureInfo) UnmarshalJSONMap(raw map[string]json.RawMessage) error

UnmarshalJSONMap decodes ProcedureInfo from a JSON map.

type ProcedureInfoArguments

type ProcedureInfoArguments map[string]ArgumentInfo

Any arguments that this collection requires

type ProcedureResult

type ProcedureResult struct {
	Type   MutationOperationType `json:"type" yaml:"type" mapstructure:"type"`
	Result any                   `json:"result" yaml:"result" mapstructure:"result"`
}

ProcedureResult represent the result of a procedure mutation operation

func NewProcedureResult

func NewProcedureResult(result any) *ProcedureResult

NewProcedureResult creates a MutationProcedureResult instance

func (ProcedureResult) Encode

Encode encodes the struct to MutationOperationResults

type Query

type Query struct {
	// Aggregate fields of the query
	Aggregates QueryAggregates `json:"aggregates,omitempty" yaml:"aggregates,omitempty" mapstructure:"aggregates,omitempty"`

	// Fields of the query
	Fields QueryFields `json:"fields,omitempty" yaml:"fields,omitempty" mapstructure:"fields,omitempty"`

	// Optionally limit to N results
	Limit *int `json:"limit,omitempty" yaml:"limit,omitempty" mapstructure:"limit,omitempty"`

	// Optionally offset from the Nth result
	Offset *int `json:"offset,omitempty" yaml:"offset,omitempty" mapstructure:"offset,omitempty"`

	// OrderBy corresponds to the JSON schema field "order_by".
	OrderBy *OrderBy `json:"order_by,omitempty" yaml:"order_by,omitempty" mapstructure:"order_by,omitempty"`

	// Predicate corresponds to the JSON schema field "predicate".
	Predicate Expression `json:"predicate,omitempty" yaml:"predicate,omitempty" mapstructure:"predicate,omitempty"`
}

type QueryAggregates

type QueryAggregates map[string]Aggregate

Aggregate fields of the query

type QueryCapabilities

type QueryCapabilities struct {
	// Does the connector support aggregate queries
	Aggregates interface{} `json:"aggregates,omitempty" yaml:"aggregates,omitempty" mapstructure:"aggregates,omitempty"`

	// Does the connector support explaining queries
	Explain interface{} `json:"explain,omitempty" yaml:"explain,omitempty" mapstructure:"explain,omitempty"`

	// Does the connector support queries which use variables
	Variables interface{} `json:"variables,omitempty" yaml:"variables,omitempty" mapstructure:"variables,omitempty"`
}

type QueryFields

type QueryFields map[string]Field

Fields of the query

type QueryRequest

type QueryRequest struct {
	// Values to be provided to any collection arguments
	Arguments QueryRequestArguments `json:"arguments" yaml:"arguments" mapstructure:"arguments"`

	// The name of a collection
	Collection string `json:"collection" yaml:"collection" mapstructure:"collection"`

	// Any relationships between collections involved in the query request
	CollectionRelationships QueryRequestCollectionRelationships `json:"collection_relationships" yaml:"collection_relationships" mapstructure:"collection_relationships"`

	// The query syntax tree
	Query Query `json:"query" yaml:"query" mapstructure:"query"`

	// One set of named variables for each rowset to fetch. Each variable set should
	// be subtituted in turn, and a fresh set of rows returned.
	Variables []QueryRequestVariablesElem `json:"variables,omitempty" yaml:"variables,omitempty" mapstructure:"variables,omitempty"`
}

This is the request body of the query POST endpoint

func (*QueryRequest) UnmarshalJSON

func (j *QueryRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type QueryRequestArguments

type QueryRequestArguments map[string]Argument

Values to be provided to any collection arguments

type QueryRequestCollectionRelationships

type QueryRequestCollectionRelationships map[string]Relationship

Any relationships between collections involved in the query request

type QueryRequestVariablesElem

type QueryRequestVariablesElem map[string]interface{}

type QueryResponse

type QueryResponse []RowSet

Query responses may return multiple RowSets when using queries with variables. Else, there should always be exactly one RowSet

type RawCapabilitiesResponse added in v0.2.0

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

RawCapabilitiesResponse represents a NDC capabilities response with pre-encoded raw bytes

func NewRawCapabilitiesResponse added in v0.2.0

func NewRawCapabilitiesResponse(data []byte) (*RawCapabilitiesResponse, error)

NewRawCapabilitiesResponse creates and validate a RawSchemaResponse instance

func NewRawCapabilitiesResponseUnsafe added in v0.3.0

func NewRawCapabilitiesResponseUnsafe(data []byte) *RawCapabilitiesResponse

NewRawCapabilitiesResponseUnsafe creates a RawSchemaResponse instance from raw bytes without validation

func (RawCapabilitiesResponse) MarshalCapabilitiesJSON added in v0.2.0

func (j RawCapabilitiesResponse) MarshalCapabilitiesJSON() ([]byte, error)

MarshalCapabilitiesJSON encodes the NDC schema response to JSON

type RawSchemaResponse added in v0.2.0

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

RawSchemaResponse represents a NDC schema response with pre-encoded raw bytes

func NewRawSchemaResponse added in v0.2.0

func NewRawSchemaResponse(data []byte) (*RawSchemaResponse, error)

NewRawSchemaResponse creates and validate a RawSchemaResponse instance

func NewRawSchemaResponseUnsafe added in v0.3.0

func NewRawSchemaResponseUnsafe(data []byte) *RawSchemaResponse

NewRawSchemaResponse creates a RawSchemaResponse instance from raw bytes without validation

func (RawSchemaResponse) MarshalSchemaJSON added in v0.2.0

func (j RawSchemaResponse) MarshalSchemaJSON() ([]byte, error)

MarshalSchemaJSON encodes the NDC schema response to JSON

type Relationship

type Relationship struct {
	// Values to be provided to any collection arguments
	Arguments RelationshipArguments `json:"arguments" yaml:"arguments" mapstructure:"arguments"`

	// A mapping between columns on the source collection to columns on the target
	// collection
	ColumnMapping RelationshipColumnMapping `json:"column_mapping" yaml:"column_mapping" mapstructure:"column_mapping"`

	// RelationshipType corresponds to the JSON schema field "relationship_type".
	RelationshipType RelationshipType `json:"relationship_type" yaml:"relationship_type" mapstructure:"relationship_type"`

	// The name of a collection
	TargetCollection string `json:"target_collection" yaml:"target_collection" mapstructure:"target_collection"`
}

func (*Relationship) UnmarshalJSON

func (j *Relationship) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RelationshipArgument

type RelationshipArgument struct {
	Type  RelationshipArgumentType `json:"type" yaml:"type" mapstructure:"type"`
	Name  string                   `json:"name" yaml:"name" mapstructure:"name"`
	Value any                      `json:"value" yaml:"value" mapstructure:"value"`
}

RelationshipArgument is provided by reference to a variable or as a literal value

func (*RelationshipArgument) UnmarshalJSON

func (j *RelationshipArgument) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RelationshipArgumentType

type RelationshipArgumentType string

RelationshipArgumentType represents a relationship argument type enum

const (
	RelationshipArgumentTypeLiteral  RelationshipArgumentType = "literal"
	RelationshipArgumentTypeVariable RelationshipArgumentType = "variable"
	RelationshipArgumentTypeColumn   RelationshipArgumentType = "column"
)

func ParseRelationshipArgumentType

func ParseRelationshipArgumentType(input string) (RelationshipArgumentType, error)

ParseRelationshipArgumentType parses a relationship argument type from string

func (RelationshipArgumentType) IsValid added in v0.4.0

func (j RelationshipArgumentType) IsValid() bool

IsValid checks if the value is invalid

func (*RelationshipArgumentType) UnmarshalJSON

func (j *RelationshipArgumentType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RelationshipArguments

type RelationshipArguments map[string]RelationshipArgument

Values to be provided to any collection arguments

type RelationshipCapabilities

type RelationshipCapabilities struct {
	// Does the connector support ordering by an aggregated array relationship?
	OrderByAggregate interface{} `json:"order_by_aggregate,omitempty" yaml:"order_by_aggregate,omitempty" mapstructure:"order_by_aggregate,omitempty"`

	// Does the connector support comparisons that involve related collections (ie.
	// joins)?
	RelationComparisons interface{} `json:"relation_comparisons,omitempty" yaml:"relation_comparisons,omitempty" mapstructure:"relation_comparisons,omitempty"`
}

type RelationshipColumnMapping

type RelationshipColumnMapping map[string]string

A mapping between columns on the source collection to columns on the target collection

type RelationshipField

type RelationshipField struct {
	Type FieldType `json:"type" yaml:"type" mapstructure:"type"`
	// The relationship query
	Query Query `json:"query" yaml:"query" mapstructure:"query"`
	// The name of the relationship to follow for the subquery
	Relationship string `json:"relationship" yaml:"relationship" mapstructure:"relationship"`
	// Values to be provided to any collection arguments
	Arguments map[string]RelationshipArgument `json:"arguments" yaml:"arguments" mapstructure:"arguments"`
}

RelationshipField represents a relationship field

func NewRelationshipField

func NewRelationshipField(query Query, relationship string, arguments map[string]RelationshipArgument) *RelationshipField

NewRelationshipField creates a new RelationshipField instance

func (RelationshipField) Encode

func (f RelationshipField) Encode() Field

Encode converts the instance to raw Field

type RelationshipType

type RelationshipType string
const RelationshipTypeArray RelationshipType = "array"
const RelationshipTypeObject RelationshipType = "object"

func (*RelationshipType) UnmarshalJSON

func (j *RelationshipType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RowFieldValue

type RowFieldValue interface{}

type RowSet

type RowSet struct {
	// The results of the aggregates returned by the query
	Aggregates RowSetAggregates `json:"aggregates,omitempty" yaml:"aggregates,omitempty" mapstructure:"aggregates,omitempty"`

	// The rows returned by the query, corresponding to the query's fields
	Rows []map[string]any `json:"rows,omitempty" yaml:"rows,omitempty" mapstructure:"rows,omitempty"`
}

type RowSetAggregates

type RowSetAggregates map[string]interface{}

The results of the aggregates returned by the query

type ScalarType

type ScalarType struct {
	// A map from aggregate function names to their definitions. Result type names
	// must be defined scalar types declared in ScalarTypesCapabilities.
	AggregateFunctions ScalarTypeAggregateFunctions `json:"aggregate_functions" yaml:"aggregate_functions" mapstructure:"aggregate_functions"`

	// A map from comparison operator names to their definitions. Argument type names
	// must be defined scalar types declared in ScalarTypesCapabilities.
	ComparisonOperators map[string]ComparisonOperatorDefinition `json:"comparison_operators" yaml:"comparison_operators" mapstructure:"comparison_operators"`

	// A description of valid values for this scalar type. Defaults to
	// `TypeRepresentation::JSON` if omitted
	Representation TypeRepresentation `json:"representation,omitempty" yaml:"representation,omitempty" mapstructure:"representation,omitempty"`
}

The definition of a scalar type, i.e. types that can be used as the types of columns.

func NewScalarType

func NewScalarType() *ScalarType

NewScalarType creates an empty ScalarType instance

func (*ScalarType) UnmarshalJSON

func (j *ScalarType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ScalarTypeAggregateFunctions

type ScalarTypeAggregateFunctions map[string]AggregateFunctionDefinition

A map from aggregate function names to their definitions. Result type names must be defined scalar types declared in ScalarTypesCapabilities.

type SchemaGeneratedJson

type SchemaGeneratedJson struct {
	// CapabilitiesResponse corresponds to the JSON schema field
	// "capabilities_response".
	CapabilitiesResponse CapabilitiesResponse `json:"capabilities_response" yaml:"capabilities_response" mapstructure:"capabilities_response"`

	// ErrorResponse corresponds to the JSON schema field "error_response".
	ErrorResponse ErrorResponse `json:"error_response" yaml:"error_response" mapstructure:"error_response"`

	// ExplainResponse corresponds to the JSON schema field "explain_response".
	ExplainResponse ExplainResponse `json:"explain_response" yaml:"explain_response" mapstructure:"explain_response"`

	// MutationRequest corresponds to the JSON schema field "mutation_request".
	MutationRequest MutationRequest `json:"mutation_request" yaml:"mutation_request" mapstructure:"mutation_request"`

	// MutationResponse corresponds to the JSON schema field "mutation_response".
	MutationResponse MutationResponse `json:"mutation_response" yaml:"mutation_response" mapstructure:"mutation_response"`

	// QueryRequest corresponds to the JSON schema field "query_request".
	QueryRequest QueryRequest `json:"query_request" yaml:"query_request" mapstructure:"query_request"`

	// QueryResponse corresponds to the JSON schema field "query_response".
	QueryResponse QueryResponse `json:"query_response" yaml:"query_response" mapstructure:"query_response"`

	// SchemaResponse corresponds to the JSON schema field "schema_response".
	SchemaResponse SchemaResponse `json:"schema_response" yaml:"schema_response" mapstructure:"schema_response"`

	// ValidateResponse corresponds to the JSON schema field "validate_response".
	ValidateResponse ValidateResponse `json:"validate_response" yaml:"validate_response" mapstructure:"validate_response"`
}

func (*SchemaGeneratedJson) UnmarshalJSON

func (j *SchemaGeneratedJson) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SchemaResponse

type SchemaResponse struct {
	// Collections which are available for queries
	Collections []CollectionInfo `json:"collections" yaml:"collections" mapstructure:"collections"`

	// Functions (i.e. collections which return a single column and row)
	Functions []FunctionInfo `json:"functions" yaml:"functions" mapstructure:"functions"`

	// A list of object types which can be used as the types of arguments, or return
	// types of procedures. Names should not overlap with scalar type names.
	ObjectTypes SchemaResponseObjectTypes `json:"object_types" yaml:"object_types" mapstructure:"object_types"`

	// Procedures which are available for execution as part of mutations
	Procedures []ProcedureInfo `json:"procedures" yaml:"procedures" mapstructure:"procedures"`

	// A list of scalar types which will be used as the types of collection columns
	ScalarTypes SchemaResponseScalarTypes `json:"scalar_types" yaml:"scalar_types" mapstructure:"scalar_types"`
}

func (SchemaResponse) MarshalSchemaJSON added in v0.2.0

func (j SchemaResponse) MarshalSchemaJSON() ([]byte, error)

MarshalSchemaJSON encodes the NDC schema response to JSON

func (*SchemaResponse) UnmarshalJSON

func (j *SchemaResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SchemaResponseMarshaler added in v0.2.0

type SchemaResponseMarshaler interface {
	MarshalSchemaJSON() ([]byte, error)
}

SchemaResponseMarshaler abstract the response for /schema handler

type SchemaResponseObjectTypes

type SchemaResponseObjectTypes map[string]ObjectType

A list of object types which can be used as the types of arguments, or return types of procedures. Names should not overlap with scalar type names.

type SchemaResponseScalarTypes

type SchemaResponseScalarTypes map[string]ScalarType

A list of scalar types which will be used as the types of collection columns

type Type

type Type map[string]any

Types track the valid representations of values as JSON

func (Type) AsArray

func (ty Type) AsArray() (*ArrayType, error)

AsArray tries to convert the current type to ArrayType

func (Type) AsNamed

func (ty Type) AsNamed() (*NamedType, error)

AsNamed tries to convert the current type to NamedType

func (Type) AsNullable

func (ty Type) AsNullable() (*NullableType, error)

AsNullable tries to convert the current type to NullableType

func (Type) AsPredicate

func (ty Type) AsPredicate() (*PredicateType, error)

AsPredicate tries to convert the current type to PredicateType

func (Type) Interface

func (ty Type) Interface() TypeEncoder

Interface converts the instance to the TypeEncoder interface

func (Type) InterfaceT

func (ty Type) InterfaceT() (TypeEncoder, error)

InterfaceT converts the instance to the TypeEncoder interface safely with explicit error

func (Type) Type

func (ty Type) Type() (TypeEnum, error)

Type gets the type enum of the current type

func (*Type) UnmarshalJSON

func (j *Type) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type TypeEncoder

type TypeEncoder interface {
	Encode() Type
}

TypeEncoder abstracts the Type interface

type TypeEnum

type TypeEnum string
const (
	TypeNamed     TypeEnum = "named"
	TypeNullable  TypeEnum = "nullable"
	TypeArray     TypeEnum = "array"
	TypePredicate TypeEnum = "predicate"
)

func ParseTypeEnum

func ParseTypeEnum(input string) (TypeEnum, error)

ParseTypeEnum parses a type enum from string

func (TypeEnum) IsValid

func (j TypeEnum) IsValid() bool

IsValid checks if the value is invalid

func (*TypeEnum) UnmarshalJSON

func (j *TypeEnum) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type TypeRepresentation added in v0.4.0

type TypeRepresentation map[string]any

Representations of scalar types

func (TypeRepresentation) AsBigDecimal added in v0.5.0

AsBigDecimal tries to convert the current type to TypeRepresentationBigDecimal

func (TypeRepresentation) AsBigInteger added in v0.5.1

AsBigInteger tries to convert the current type to TypeRepresentationBigInteger

func (TypeRepresentation) AsBoolean added in v0.4.0

AsBoolean tries to convert the current type to TypeRepresentationBoolean

func (TypeRepresentation) AsBytes added in v0.5.0

AsBytes tries to convert the current type to TypeRepresentationBytes

func (TypeRepresentation) AsDate added in v0.5.0

AsDate tries to convert the current type to TypeRepresentationDate

func (TypeRepresentation) AsEnum added in v0.4.0

AsEnum tries to convert the current type to TypeRepresentationEnum

func (TypeRepresentation) AsFloat32 added in v0.5.0

AsFloat32 tries to convert the current type to TypeRepresentationFloat32

func (TypeRepresentation) AsFloat64 added in v0.5.0

AsFloat64 tries to convert the current type to TypeRepresentationFloat64

func (TypeRepresentation) AsGeography added in v0.5.0

AsGeography tries to convert the current type to TypeRepresentationGeography

func (TypeRepresentation) AsGeometry added in v0.5.0

AsGeometry tries to convert the current type to TypeRepresentationGeometry

func (TypeRepresentation) AsInt16 added in v0.5.0

AsInt16 tries to convert the current type to TypeRepresentationInt16

func (TypeRepresentation) AsInt32 added in v0.5.0

AsInt32 tries to convert the current type to TypeRepresentationInt32

func (TypeRepresentation) AsInt64 added in v0.5.0

AsInt64 tries to convert the current type to TypeRepresentationInt64

func (TypeRepresentation) AsInt8 added in v0.5.0

AsInt8 tries to convert the current type to TypeRepresentationInt8

func (TypeRepresentation) AsInteger deprecated added in v0.4.0

AsInteger tries to convert the current type to TypeRepresentationInteger

Deprecated: Deprecate Int and Number representations

func (TypeRepresentation) AsJSON added in v0.5.0

AsJSON tries to convert the current type to TypeRepresentationJSON

func (TypeRepresentation) AsNumber deprecated added in v0.4.0

AsNumber tries to convert the current type to TypeRepresentationNumber

Deprecated: Deprecate Int and Number representations

func (TypeRepresentation) AsString added in v0.4.0

AsString tries to convert the current type to TypeRepresentationString

func (TypeRepresentation) AsTimestamp added in v0.5.0

AsTimestamp tries to convert the current type to TypeRepresentationTimestamp

func (TypeRepresentation) AsTimestampTZ added in v0.5.0

AsTimestampTZ tries to convert the current type to TypeRepresentationTimestampTZ

func (TypeRepresentation) AsUUID added in v0.5.0

AsUUID tries to convert the current type to TypeRepresentationUUID

func (TypeRepresentation) Interface added in v0.4.0

Interface converts the instance to the TypeRepresentationEncoder interface

func (TypeRepresentation) InterfaceT added in v0.4.0

InterfaceT converts the instance to the TypeRepresentationEncoder interface safely with explicit error

func (TypeRepresentation) Type added in v0.4.0

Type gets the type enum of the current type

func (*TypeRepresentation) UnmarshalJSON added in v0.4.0

func (j *TypeRepresentation) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type TypeRepresentationBigDecimal added in v0.5.0

type TypeRepresentationBigDecimal struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationBigDecimal represents an arbitrary-precision decimal string

func NewTypeRepresentationBigDecimal added in v0.5.0

func NewTypeRepresentationBigDecimal() *TypeRepresentationBigDecimal

NewTypeRepresentationBigDecimal creates a new TypeRepresentationBigDecimal instance

func (TypeRepresentationBigDecimal) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationBigInteger added in v0.5.1

type TypeRepresentationBigInteger struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationBigInteger represents an arbitrary-precision integer string

func NewTypeRepresentationBigInteger added in v0.5.1

func NewTypeRepresentationBigInteger() *TypeRepresentationBigInteger

NewTypeRepresentationBigInteger creates a new TypeRepresentationBigInteger instance

func (TypeRepresentationBigInteger) Encode added in v0.5.1

Encode returns the raw TypeRepresentation instance

type TypeRepresentationBoolean added in v0.4.0

type TypeRepresentationBoolean struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationBoolean represents a JSON boolean type representation

func NewTypeRepresentationBoolean added in v0.4.0

func NewTypeRepresentationBoolean() *TypeRepresentationBoolean

NewTypeRepresentationBoolean creates a new TypeRepresentationBoolean instance

func (TypeRepresentationBoolean) Encode added in v0.4.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationBytes added in v0.5.0

type TypeRepresentationBytes struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationBytes represent a base64-encoded bytes

func NewTypeRepresentationBytes added in v0.5.0

func NewTypeRepresentationBytes() *TypeRepresentationBytes

NewTypeRepresentationBytes creates a new TypeRepresentationBytes instance

func (TypeRepresentationBytes) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationDate added in v0.5.0

type TypeRepresentationDate struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationDate represents an ISO 8601 date

func NewTypeRepresentationDate added in v0.5.0

func NewTypeRepresentationDate() *TypeRepresentationDate

NewTypeRepresentationDate creates a new TypeRepresentationDate instance

func (TypeRepresentationDate) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationEncoder added in v0.4.0

type TypeRepresentationEncoder interface {
	Encode() TypeRepresentation
}

TypeRepresentationEncoder abstracts the TypeRepresentation interface

type TypeRepresentationEnum added in v0.4.0

type TypeRepresentationEnum struct {
	Type  TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
	OneOf []string               `json:"one_of" yaml:"one_of" mapstructure:"one_of"`
}

TypeRepresentationEnum represents an enum type representation

func NewTypeRepresentationEnum added in v0.4.0

func NewTypeRepresentationEnum(oneOf []string) *TypeRepresentationEnum

NewTypeRepresentationEnum creates a new TypeRepresentationEnum instance

func (TypeRepresentationEnum) Encode added in v0.4.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationFloat32 added in v0.5.0

type TypeRepresentationFloat32 struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationFloat32 represents an IEEE-754 single-precision floating-point number

func NewTypeRepresentationFloat32 added in v0.5.0

func NewTypeRepresentationFloat32() *TypeRepresentationFloat32

NewTypeRepresentationFloat32 creates a new TypeRepresentationFloat32 instance

func (TypeRepresentationFloat32) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationFloat64 added in v0.5.0

type TypeRepresentationFloat64 struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationFloat64 represents an IEEE-754 double-precision floating-point number

func NewTypeRepresentationFloat64 added in v0.5.0

func NewTypeRepresentationFloat64() *TypeRepresentationFloat64

NewTypeRepresentationFloat64 creates a new TypeRepresentationFloat64 instance

func (TypeRepresentationFloat64) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationGeography added in v0.5.0

type TypeRepresentationGeography struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationGeography represents a geography JSON object

func NewTypeRepresentationGeography added in v0.5.0

func NewTypeRepresentationGeography() *TypeRepresentationGeography

NewTypeRepresentationGeography creates a new TypeRepresentationGeography instance

func (TypeRepresentationGeography) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationGeometry added in v0.5.0

type TypeRepresentationGeometry struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationGeometry represents a geography JSON object

func NewTypeRepresentationGeometry added in v0.5.0

func NewTypeRepresentationGeometry() *TypeRepresentationGeometry

NewTypeRepresentationGeometry creates a new TypeRepresentationGeometry instance

func (TypeRepresentationGeometry) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationInt16 added in v0.5.0

type TypeRepresentationInt16 struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationInt16 represents a 16-bit signed integer with a minimum value of -2^15 and a maximum value of 2^15 - 1

func NewTypeRepresentationInt16 added in v0.5.0

func NewTypeRepresentationInt16() *TypeRepresentationInt16

NewTypeRepresentationInt16 creates a new TypeRepresentationInt16 instance

func (TypeRepresentationInt16) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationInt32 added in v0.5.0

type TypeRepresentationInt32 struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationInt32 represents a 32-bit signed integer with a minimum value of -2^31 and a maximum value of 2^31 - 1

func NewTypeRepresentationInt32 added in v0.5.0

func NewTypeRepresentationInt32() *TypeRepresentationInt32

NewTypeRepresentationInt32 creates a new TypeRepresentationInt32 instance

func (TypeRepresentationInt32) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationInt64 added in v0.5.0

type TypeRepresentationInt64 struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationInt64 represents a 64-bit signed integer with a minimum value of -2^63 and a maximum value of 2^63 - 1

func NewTypeRepresentationInt64 added in v0.5.0

func NewTypeRepresentationInt64() *TypeRepresentationInt64

NewTypeRepresentationInt64 creates a new TypeRepresentationInt64 instance

func (TypeRepresentationInt64) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationInt8 added in v0.5.0

type TypeRepresentationInt8 struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationInt8 represents a 8-bit signed integer with a minimum value of -2^7 and a maximum value of 2^7 - 1

func NewTypeRepresentationInt8 added in v0.5.0

func NewTypeRepresentationInt8() *TypeRepresentationInt8

NewTypeRepresentationInt8 creates a new TypeRepresentationInt8 instance

func (TypeRepresentationInt8) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationInteger deprecated added in v0.4.0

type TypeRepresentationInteger struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationInteger represents a JSON integer type representation

Deprecated: Deprecate Int and Number representations

func NewTypeRepresentationInteger added in v0.4.0

func NewTypeRepresentationInteger() *TypeRepresentationInteger

NewTypeRepresentationInteger creates a new TypeRepresentationInteger instance

func (TypeRepresentationInteger) Encode added in v0.4.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationJSON added in v0.5.0

type TypeRepresentationJSON struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationJSON represents an arbitrary JSON

func NewTypeRepresentationJSON added in v0.5.0

func NewTypeRepresentationJSON() *TypeRepresentationJSON

NewTypeRepresentationJSON creates a new TypeRepresentationBytes instance

func (TypeRepresentationJSON) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationNumber deprecated added in v0.4.0

type TypeRepresentationNumber struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationNumber represents a JSON number type representation

Deprecated: Deprecate Int and Number representations

func NewTypeRepresentationNumber added in v0.4.0

func NewTypeRepresentationNumber() *TypeRepresentationNumber

NewTypeRepresentationNumber creates a new TypeRepresentationNumber instance

func (TypeRepresentationNumber) Encode added in v0.4.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationString added in v0.4.0

type TypeRepresentationString struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationString represents a JSON string type representation

func NewTypeRepresentationString added in v0.4.0

func NewTypeRepresentationString() *TypeRepresentationString

NewTypeRepresentationString creates a new TypeRepresentationString instance

func (TypeRepresentationString) Encode added in v0.4.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationTimestamp added in v0.5.0

type TypeRepresentationTimestamp struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationTimestamp represents an ISO 8601 timestamp

func NewTypeRepresentationTimestamp added in v0.5.0

func NewTypeRepresentationTimestamp() *TypeRepresentationTimestamp

NewTypeRepresentationTimestamp creates a new TypeRepresentationTimestamp instance

func (TypeRepresentationTimestamp) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationTimestampTZ added in v0.5.0

type TypeRepresentationTimestampTZ struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationTimestampTZ represents an ISO 8601 timestamp-with-timezone

func NewTypeRepresentationTimestampTZ added in v0.5.0

func NewTypeRepresentationTimestampTZ() *TypeRepresentationTimestampTZ

NewTypeRepresentationTimestampTZ creates a new TypeRepresentationTimestampTZ instance

func (TypeRepresentationTimestampTZ) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type TypeRepresentationType added in v0.4.0

type TypeRepresentationType string

TypeRepresentationType represents the type enum of TypeRepresentation

const (
	// JSON booleans
	TypeRepresentationTypeBoolean TypeRepresentationType = "boolean"
	// JSON booleans
	TypeRepresentationTypeString TypeRepresentationType = "string"
	// Any JSON number
	//
	// Deprecated: [Deprecate Int and Number representations]
	//
	// [Deprecate Int and Number representations]: https://github.com/hasura/ndc-spec/blob/main/rfcs/0007-additional-type-representations.md#deprecate-int-and-number-representations
	TypeRepresentationTypeNumber TypeRepresentationType = "number"
	// Any JSON number, with no decimal part
	//
	// Deprecated: [Deprecate Int and Number representations]
	//
	// [Deprecate Int and Number representations]: https://github.com/hasura/ndc-spec/blob/main/rfcs/0007-additional-type-representations.md#deprecate-int-and-number-representations
	TypeRepresentationTypeInteger TypeRepresentationType = "integer"
	// One of the specified string values
	TypeRepresentationTypeEnum TypeRepresentationType = "enum"
	// A 8-bit signed integer with a minimum value of -2^7 and a maximum value of 2^7 - 1
	TypeRepresentationTypeInt8 TypeRepresentationType = "int8"
	// A 16-bit signed integer with a minimum value of -2^15 and a maximum value of 2^15 - 1
	TypeRepresentationTypeInt16 TypeRepresentationType = "int16"
	// A 32-bit signed integer with a minimum value of -2^31 and a maximum value of 2^31 - 1
	TypeRepresentationTypeInt32 TypeRepresentationType = "int32"
	// A 64-bit signed integer with a minimum value of -2^63 and a maximum value of 2^63 - 1
	TypeRepresentationTypeInt64 TypeRepresentationType = "int64"
	// An IEEE-754 single-precision floating-point number
	TypeRepresentationTypeFloat32 TypeRepresentationType = "float32"
	// An IEEE-754 double-precision floating-point number
	TypeRepresentationTypeFloat64 TypeRepresentationType = "float64"
	// Arbitrary-precision integer string
	TypeRepresentationTypeBigInteger TypeRepresentationType = "biginteger"
	// Arbitrary-precision decimal string
	TypeRepresentationTypeBigDecimal TypeRepresentationType = "bigdecimal"
	// UUID string (8-4-4-4-12)
	TypeRepresentationTypeUUID TypeRepresentationType = "uuid"
	// ISO 8601 date
	TypeRepresentationTypeDate TypeRepresentationType = "date"
	// ISO 8601 timestamp
	TypeRepresentationTypeTimestamp TypeRepresentationType = "timestamp"
	// ISO 8601 timestamp-with-timezone
	TypeRepresentationTypeTimestampTZ TypeRepresentationType = "timestamptz"
	// GeoJSON, per RFC 7946
	TypeRepresentationTypeGeography TypeRepresentationType = "geography"
	// GeoJSON Geometry object, per RFC 7946
	TypeRepresentationTypeGeometry TypeRepresentationType = "geometry"
	// Base64-encoded bytes
	TypeRepresentationTypeBytes TypeRepresentationType = "bytes"
	// Arbitrary JSON
	TypeRepresentationTypeJSON TypeRepresentationType = "json"
)

func ParseTypeRepresentationType added in v0.4.0

func ParseTypeRepresentationType(input string) (TypeRepresentationType, error)

ParseTypeRepresentationType parses a TypeRepresentationType enum from string

func (TypeRepresentationType) IsValid added in v0.4.0

func (j TypeRepresentationType) IsValid() bool

IsValid checks if the value is invalid

func (*TypeRepresentationType) UnmarshalJSON added in v0.4.0

func (j *TypeRepresentationType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type TypeRepresentationUUID added in v0.5.0

type TypeRepresentationUUID struct {
	Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
}

TypeRepresentationUUID represents an UUID string (8-4-4-4-12)

func NewTypeRepresentationUUID added in v0.5.0

func NewTypeRepresentationUUID() *TypeRepresentationUUID

NewTypeRepresentationUUID creates a new TypeRepresentationUUID instance

func (TypeRepresentationUUID) Encode added in v0.5.0

Encode returns the raw TypeRepresentation instance

type UnaryComparisonOperator

type UnaryComparisonOperator string
const UnaryComparisonOperatorIsNull UnaryComparisonOperator = "is_null"

func (*UnaryComparisonOperator) UnmarshalJSON

func (j *UnaryComparisonOperator) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type UniquenessConstraint

type UniquenessConstraint struct {
	// A list of columns which this constraint requires to be unique
	UniqueColumns []string `json:"unique_columns" yaml:"unique_columns" mapstructure:"unique_columns"`
}

func (*UniquenessConstraint) UnmarshalJSON

func (j *UniquenessConstraint) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ValidateResponse

type ValidateResponse struct {
	// Capabilities corresponds to the JSON schema field "capabilities".
	Capabilities CapabilitiesResponse `json:"capabilities" yaml:"capabilities" mapstructure:"capabilities"`

	// ResolvedConfiguration corresponds to the JSON schema field
	// "resolved_configuration".
	ResolvedConfiguration string `json:"resolved_configuration" yaml:"resolved_configuration" mapstructure:"resolved_configuration"`

	// Schema corresponds to the JSON schema field "schema".
	Schema SchemaResponse `json:"schema" yaml:"schema" mapstructure:"schema"`
}

func (*ValidateResponse) UnmarshalJSON

func (j *ValidateResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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