Documentation ¶
Index ¶
- Variables
- func Contains[E comparable](s []E, v E) bool
- func Index[E comparable](s []E, v E) int
- type Aggregate
- func (j Aggregate) AsColumnCount() (*AggregateColumnCount, error)
- func (j Aggregate) AsSingleColumn() (*AggregateSingleColumn, error)
- func (j Aggregate) AsStarCount() (*AggregateStarCount, error)
- func (j Aggregate) Interface() AggregateEncoder
- func (j Aggregate) InterfaceT() (AggregateEncoder, error)
- func (j Aggregate) Type() (AggregateType, error)
- func (j *Aggregate) UnmarshalJSON(b []byte) error
- type AggregateColumnCount
- type AggregateEncoder
- type AggregateFunctionDefinition
- type AggregateSingleColumn
- type AggregateStarCount
- type AggregateType
- type Argument
- type ArgumentInfo
- type ArgumentType
- type ArrayType
- type Capabilities
- type CapabilitiesResponse
- type CollectionInfo
- type CollectionInfoArguments
- type CollectionInfoForeignKeys
- type CollectionInfoUniquenessConstraints
- type ColumnField
- type ComparisonOperatorCustom
- type ComparisonOperatorDefinition
- func (j ComparisonOperatorDefinition) AsCustom() (*ComparisonOperatorCustom, error)
- func (j ComparisonOperatorDefinition) AsEqual() (*ComparisonOperatorEqual, error)
- func (j ComparisonOperatorDefinition) AsIn() (*ComparisonOperatorIn, error)
- func (j ComparisonOperatorDefinition) Interface() ComparisonOperatorDefinitionEncoder
- func (j ComparisonOperatorDefinition) InterfaceT() (ComparisonOperatorDefinitionEncoder, error)
- func (j ComparisonOperatorDefinition) Type() (ComparisonOperatorDefinitionType, error)
- func (j *ComparisonOperatorDefinition) UnmarshalJSON(b []byte) error
- type ComparisonOperatorDefinitionEncoder
- type ComparisonOperatorDefinitionType
- type ComparisonOperatorEqual
- type ComparisonOperatorIn
- type ComparisonTarget
- type ComparisonTargetType
- type ComparisonValue
- func (cv ComparisonValue) AsColumn() (*ComparisonValueColumn, error)
- func (cv ComparisonValue) AsScalar() (*ComparisonValueScalar, error)
- func (cv ComparisonValue) AsVariable() (*ComparisonValueVariable, error)
- func (cv ComparisonValue) Interface() ComparisonValueEncoder
- func (cv ComparisonValue) InterfaceT() (ComparisonValueEncoder, error)
- func (cv ComparisonValue) Type() (ComparisonValueType, error)
- func (j *ComparisonValue) UnmarshalJSON(b []byte) error
- type ComparisonValueColumn
- type ComparisonValueEncoder
- type ComparisonValueScalar
- type ComparisonValueType
- type ComparisonValueVariable
- type ConnectorError
- func BadGatewayError(message string, details map[string]any) *ConnectorError
- func BadRequestError(message string, details map[string]any) *ConnectorError
- func ConflictError(message string, details map[string]any) *ConnectorError
- func ForbiddenError(message string, details map[string]any) *ConnectorError
- func InternalServerError(message string, details map[string]any) *ConnectorError
- func NewConnectorError(statusCode int, message string, details map[string]any) *ConnectorError
- func NotSupportedError(message string, details map[string]any) *ConnectorError
- func UnauthorizeError(message string, details map[string]any) *ConnectorError
- func UnprocessableContentError(message string, details map[string]any) *ConnectorError
- type ErrorResponse
- type ExistsInCollection
- func (j ExistsInCollection) AsRelated() (*ExistsInCollectionRelated, error)
- func (j ExistsInCollection) AsUnrelated() (*ExistsInCollectionUnrelated, error)
- func (j ExistsInCollection) Interface() ExistsInCollectionEncoder
- func (j ExistsInCollection) InterfaceT() (ExistsInCollectionEncoder, error)
- func (j ExistsInCollection) Type() (ExistsInCollectionType, error)
- func (j *ExistsInCollection) UnmarshalJSON(b []byte) error
- type ExistsInCollectionEncoder
- type ExistsInCollectionRelated
- type ExistsInCollectionType
- type ExistsInCollectionUnrelated
- type ExplainResponse
- type ExplainResponseDetails
- type Expression
- func (j Expression) AsAnd() (*ExpressionAnd, error)
- func (j Expression) AsBinaryComparisonOperator() (*ExpressionBinaryComparisonOperator, error)
- func (j Expression) AsExists() (*ExpressionExists, error)
- func (j Expression) AsNot() (*ExpressionNot, error)
- func (j Expression) AsOr() (*ExpressionOr, error)
- func (j Expression) AsUnaryComparisonOperator() (*ExpressionUnaryComparisonOperator, error)
- func (j Expression) Interface() ExpressionEncoder
- func (j Expression) InterfaceT() (ExpressionEncoder, error)
- func (j Expression) Type() (ExpressionType, error)
- func (j *Expression) UnmarshalJSON(b []byte) error
- type ExpressionAnd
- type ExpressionBinaryComparisonOperator
- type ExpressionEncoder
- type ExpressionExists
- type ExpressionNot
- type ExpressionOr
- type ExpressionType
- type ExpressionUnaryComparisonOperator
- type Field
- type FieldEncoder
- type FieldType
- type ForeignKeyConstraint
- type ForeignKeyConstraintColumnMapping
- type FunctionInfo
- type FunctionInfoArguments
- type LeafCapability
- type MutationCapabilities
- type MutationOperation
- type MutationOperationResults
- func (j MutationOperationResults) AsProcedure() (*ProcedureResult, error)
- func (j MutationOperationResults) Interface() MutationOperationResultsEncoder
- func (j MutationOperationResults) InterfaceT() (MutationOperationResultsEncoder, error)
- func (j MutationOperationResults) Type() (MutationOperationType, error)
- func (j *MutationOperationResults) UnmarshalJSON(b []byte) error
- type MutationOperationResultsEncoder
- type MutationOperationType
- type MutationRequest
- type MutationRequestCollectionRelationships
- type MutationResponse
- type NamedType
- type NestedArray
- type NestedField
- func (j NestedField) AsArray() (*NestedArray, error)
- func (j NestedField) AsObject() (*NestedObject, error)
- func (j NestedField) Interface() NestedFieldEncoder
- func (j NestedField) InterfaceT() (NestedFieldEncoder, error)
- func (j NestedField) Type() (NestedFieldType, error)
- func (j *NestedField) UnmarshalJSON(b []byte) error
- type NestedFieldEncoder
- type NestedFieldType
- type NestedObject
- type NullableType
- type ObjectField
- type ObjectType
- type ObjectTypeFields
- type OrderBy
- type OrderByColumn
- type OrderByElement
- type OrderBySingleColumnAggregate
- type OrderByStarCountAggregate
- type OrderByTarget
- func (j OrderByTarget) AsColumn() (*OrderByColumn, error)
- func (j OrderByTarget) AsSingleColumnAggregate() (*OrderBySingleColumnAggregate, error)
- func (j OrderByTarget) AsStarCountAggregate() (*OrderByStarCountAggregate, error)
- func (j OrderByTarget) Interface() OrderByTargetEncoder
- func (j OrderByTarget) InterfaceT() (OrderByTargetEncoder, error)
- func (j OrderByTarget) Type() (OrderByTargetType, error)
- func (j *OrderByTarget) UnmarshalJSON(b []byte) error
- type OrderByTargetEncoder
- type OrderByTargetType
- type OrderDirection
- type PathElement
- type PathElementArguments
- type PredicateType
- type ProcedureInfo
- type ProcedureInfoArguments
- type ProcedureResult
- type Query
- type QueryAggregates
- type QueryCapabilities
- type QueryFields
- type QueryRequest
- type QueryRequestArguments
- type QueryRequestCollectionRelationships
- type QueryRequestVariablesElem
- type QueryResponse
- type Relationship
- type RelationshipArgument
- type RelationshipArgumentType
- type RelationshipArguments
- type RelationshipCapabilities
- type RelationshipColumnMapping
- type RelationshipField
- type RelationshipType
- type RowFieldValue
- type RowSet
- type RowSetAggregates
- type ScalarType
- type ScalarTypeAggregateFunctions
- type SchemaGeneratedJson
- type SchemaResponse
- type SchemaResponseObjectTypes
- type SchemaResponseScalarTypes
- type Type
- func (ty Type) AsArray() (*ArrayType, error)
- func (ty Type) AsNamed() (*NamedType, error)
- func (ty Type) AsNullable() (*NullableType, error)
- func (ty Type) AsPredicate() (*PredicateType, error)
- func (ty Type) Interface() TypeEncoder
- func (ty Type) InterfaceT() (TypeEncoder, error)
- func (ty Type) Type() (TypeEnum, error)
- func (j *Type) UnmarshalJSON(b []byte) error
- type TypeEncoder
- type TypeEnum
- type UnaryComparisonOperator
- type UniquenessConstraint
- type ValidateResponse
Constants ¶
This section is empty.
Variables ¶
var ( CapabilitiesResponseSchema = schemaForType("CapabilitiesResponse") SchemaResponseSchema = schemaForType("SchemaResponse") QueryRequestSchema = schemaForType("QueryRequest") QueryResponseSchema = schemaForType("QueryResponse") ExplainResponseSchema = schemaForType("ExplainResponse") MutationRequestSchema = schemaForType("MutationRequest") MutationResponseSchema = schemaForType("MutationResponse") ErrorResponseSchema = schemaForType("ErrorResponse") ValidateResponseSchema = schemaForType("ValidateResponse") )
Functions ¶
func Contains ¶
func Contains[E comparable](s []E, v E) bool
Contains checks whether the value is present in slice.
func Index ¶
func Index[E comparable](s []E, v E) int
Index returns the index of the first occurrence of item in slice, or -1 if not present.
Types ¶
type Aggregate ¶
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 ¶
UnmarshalJSON implements json.Unmarshaler.
type AggregateColumnCount ¶
type AggregateColumnCount struct { Type AggregateType `json:"type" mapstructure:"type"` // The column to apply the aggregation function to Column string `json:"column" mapstructure:"column"` // Whether or not only distinct items should be counted. Distinct bool `json:"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" mapstructure:"type"` // The column to apply the aggregation function to Column string `json:"column" mapstructure:"column"` // Single column aggregate function name. Function string `json:"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) UnmarshalJSON ¶
func (j *AggregateType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Argument ¶
type Argument struct { Type ArgumentType `json:"type" mapstructure:"type"` Name string `json:"name" mapstructure:"name"` Value any `json:"value" mapstructure:"value"` }
Argument is provided by reference to a variable or as a literal value
func (*Argument) UnmarshalJSON ¶
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) UnmarshalJSON ¶
func (j *ArgumentType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ArrayType ¶
type ArrayType struct { Type TypeEnum `json:"type" mapstructure:"type"` // The type of the elements of the array ElementType Type `json:"element_type" mapstructure:"element_type"` }
ArrayType represents an array type
func NewArrayType ¶
func NewArrayType(elementType TypeEncoder) *ArrayType
NewArrayType creates a new ArrayType 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) UnmarshalJSON ¶
func (j *CapabilitiesResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
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" mapstructure:"type"` // Column name Column string `json:"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" 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" mapstructure:"type"` // The type of the argument to this operator ArgumentType Type `json:"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 ¶
func (ob ComparisonOperatorCustom) Encode() ComparisonOperatorDefinition
Encode converts the instance to raw ComparisonOperatorDefinition
type ComparisonOperatorDefinition ¶
ComparisonOperatorDefinition the definition of a comparison operator on a scalar type
func (ComparisonOperatorDefinition) AsCustom ¶
func (j ComparisonOperatorDefinition) AsCustom() (*ComparisonOperatorCustom, error)
AsCustom tries to convert the instance to ComparisonOperatorIn type
func (ComparisonOperatorDefinition) AsEqual ¶
func (j ComparisonOperatorDefinition) AsEqual() (*ComparisonOperatorEqual, error)
AsEqual tries to convert the instance to ComparisonOperatorEqual type
func (ComparisonOperatorDefinition) AsIn ¶
func (j ComparisonOperatorDefinition) AsIn() (*ComparisonOperatorIn, error)
AsIn tries to convert the instance to ComparisonOperatorIn type
func (ComparisonOperatorDefinition) Interface ¶
func (j ComparisonOperatorDefinition) Interface() ComparisonOperatorDefinitionEncoder
Interface tries to convert the instance to ComparisonOperatorDefinitionEncoder interface
func (ComparisonOperatorDefinition) InterfaceT ¶
func (j ComparisonOperatorDefinition) InterfaceT() (ComparisonOperatorDefinitionEncoder, error)
InterfaceT tries to convert the instance to ComparisonOperatorDefinitionEncoder interface safely with explicit error
func (ComparisonOperatorDefinition) Type ¶
func (j ComparisonOperatorDefinition) Type() (ComparisonOperatorDefinitionType, error)
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) UnmarshalJSON ¶
func (j *ComparisonOperatorDefinitionType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ComparisonOperatorEqual ¶
type ComparisonOperatorEqual struct {
Type ComparisonOperatorDefinitionType `json:"type" mapstructure:"type"`
}
ComparisonOperatorEqual presents an equal comparison operator
func NewComparisonOperatorEqual ¶
func NewComparisonOperatorEqual() *ComparisonOperatorEqual
NewComparisonOperatorEqual create a new ComparisonOperatorEqual instance
func (ComparisonOperatorEqual) Encode ¶
func (ob ComparisonOperatorEqual) Encode() ComparisonOperatorDefinition
Encode converts the instance to raw ComparisonOperatorDefinition
type ComparisonOperatorIn ¶
type ComparisonOperatorIn struct {
Type ComparisonOperatorDefinitionType `json:"type" mapstructure:"type"`
}
ComparisonOperatorIn presents an in comparison operator
func NewComparisonOperatorIn ¶
func NewComparisonOperatorIn() *ComparisonOperatorIn
NewComparisonOperatorIn create a new ComparisonOperatorIn instance
func (ComparisonOperatorIn) Encode ¶
func (ob ComparisonOperatorIn) Encode() ComparisonOperatorDefinition
Encode converts the instance to raw ComparisonOperatorDefinition
type ComparisonTarget ¶
type ComparisonTarget struct { Type ComparisonTargetType `json:"type" mapstructure:"type"` Name string `json:"name" mapstructure:"name"` Path []PathElement `json:"path,omitempty" mapstructure:"path"` }
ComparisonTarget represents a comparison target object
type ComparisonTargetType ¶
type ComparisonTargetType string
ComparisonTarget 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) UnmarshalJSON ¶
func (j *ComparisonTargetType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ComparisonValue ¶
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 ¶
func (cv ComparisonValue) Type() (ComparisonValueType, error)
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" mapstructure:"type"` Column ComparisonTarget `json:"column" mapstructure:"column"` }
ComparisonValueColumn represents a comparison value with column type
func (ComparisonValueColumn) Encode ¶
func (cv ComparisonValueColumn) Encode() ComparisonValue
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" mapstructure:"type"` Value any `json:"value" mapstructure:"value"` }
ComparisonValueScalar represents a comparison value with scalar type
func (ComparisonValueScalar) Encode ¶
func (cv ComparisonValueScalar) Encode() ComparisonValue
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) UnmarshalJSON ¶
func (j *ComparisonValueType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ComparisonValueVariable ¶
type ComparisonValueVariable struct { Type ComparisonValueType `json:"type" mapstructure:"type"` Name string `json:"name" mapstructure:"name"` }
ComparisonValueVariable represents a comparison value with variable type
func (ComparisonValueVariable) Encode ¶
func (cv ComparisonValueVariable) Encode() ComparisonValue
Encode converts to the raw comparison value
type ConnectorError ¶
type ConnectorError struct { // A human-readable summary of the error Message string `json:"message"` // Any additional structured information about the error Details map[string]any `json:"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 ¶
ExistsInCollection represents an Exists In Collection object
func (ExistsInCollection) AsRelated ¶
func (j ExistsInCollection) AsRelated() (*ExistsInCollectionRelated, error)
AsRelated tries to convert the instance to related type
func (ExistsInCollection) AsUnrelated ¶
func (j ExistsInCollection) AsUnrelated() (*ExistsInCollectionUnrelated, error)
AsRelated tries to convert the instance to unrelated type
func (ExistsInCollection) Interface ¶
func (j ExistsInCollection) Interface() ExistsInCollectionEncoder
Interface tries to convert the instance to the ExistsInCollectionEncoder interface
func (ExistsInCollection) InterfaceT ¶
func (j ExistsInCollection) InterfaceT() (ExistsInCollectionEncoder, error)
InterfaceT tries to convert the instance to the ExistsInCollectionEncoder interface safely with explicit error
func (ExistsInCollection) Type ¶
func (j ExistsInCollection) Type() (ExistsInCollectionType, error)
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" mapstructure:"type"` Relationship string `json:"relationship" mapstructure:"relationship"` // Values to be provided to any collection arguments Arguments map[string]RelationshipArgument `json:"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 ¶
func (ei ExistsInCollectionRelated) Encode() ExistsInCollection
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" )
func ParseExistsInCollectionType ¶
func ParseExistsInCollectionType(input string) (*ExistsInCollectionType, error)
ParseExistsInCollectionType parses a comparison value type from string
func (*ExistsInCollectionType) UnmarshalJSON ¶
func (j *ExistsInCollectionType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ExistsInCollectionUnrelated ¶
type ExistsInCollectionUnrelated struct { string `json:"collection" mapstructure:"collection"` Arguments map[string]RelationshipArgument `json:"arguments" mapstructure:"arguments"` }Collection
ExistsInCollectionUnrelated represents unrelated collections.
func (ExistsInCollectionUnrelated) Encode ¶
func (ei ExistsInCollectionUnrelated) Encode() ExistsInCollection
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 ¶
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 ¶
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" mapstructure:"type"` Expressions []Expression `json:"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" mapstructure:"type"` Operator string `json:"operator" mapstructure:"operator"` Column ComparisonTarget `json:"column" mapstructure:"column"` Value ComparisonValue `json:"value" mapstructure:"value"` }
ExpressionBinaryComparisonOperator is an object which represents an binary operator expression
func (ExpressionBinaryComparisonOperator) Encode ¶
func (exp ExpressionBinaryComparisonOperator) Encode() Expression
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" mapstructure:"type"` Predicate Expression `json:"predicate" mapstructure:"predicate"` InCollection ExistsInCollection `json:"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" mapstructure:"type"` Expression Expression `json:"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" mapstructure:"type"` Expressions []Expression `json:"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) UnmarshalJSON ¶
func (j *ExpressionType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ExpressionUnaryComparisonOperator ¶
type ExpressionUnaryComparisonOperator struct { Type ExpressionType `json:"type" mapstructure:"type"` Operator UnaryComparisonOperator `json:"operator" mapstructure:"operator"` Column ComparisonTarget `json:"column" mapstructure:"column"` }
ExpressionUnaryComparisonOperator is an object which represents a unary operator expression
func (ExpressionUnaryComparisonOperator) Encode ¶
func (exp ExpressionUnaryComparisonOperator) Encode() Expression
Encode converts the instance to a raw Expression
type Field ¶
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) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type FieldEncoder ¶
type FieldEncoder interface {
Encode() Field
}
type FieldType ¶
type FieldType string
FieldType represents a field type
func ParseFieldType ¶
ParseFieldType parses a field type from string
func (*FieldType) UnmarshalJSON ¶
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 ¶
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.
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" mapstructure:"type"` // The name of the operation Name string `json:"name" mapstructure:"name"` // Any named procedure arguments Arguments json.RawMessage `json:"arguments" mapstructure:"arguments"` // The fields to return from the result, or null to return everything Fields NestedField `json:"fields,omitempty" mapstructure:"fields,omitempty"` }
MutationOperation represents a mutation operation
func (*MutationOperation) UnmarshalJSON ¶
func (j *MutationOperation) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type MutationOperationResults ¶
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 ¶
func (j MutationOperationResults) Interface() MutationOperationResultsEncoder
Interface tries to convert the instance to MutationOperationResultsEncoder interface
func (MutationOperationResults) InterfaceT ¶
func (j MutationOperationResults) InterfaceT() (MutationOperationResultsEncoder, error)
InterfaceT tries to convert the instance to MutationOperationResultsEncoder interface safely with explicit error
func (MutationOperationResults) Type ¶
func (j MutationOperationResults) Type() (MutationOperationType, error)
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" mapstructure:"type"` // The name can refer to a primitive type or a scalar type Name string `json:"name" mapstructure:"name"` }
NamedType represents a named type
func NewNamedType ¶
NewNamedType creates a new NamedType instance
type NestedArray ¶
type NestedArray struct { Type NestedFieldType `json:"type" mapstructure:"type"` Fields NestedField `json:"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 ¶
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) 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) UnmarshalJSON ¶
func (j *NestedFieldType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type NestedObject ¶
type NestedObject struct { Type NestedFieldType `json:"type" mapstructure:"type"` Fields map[string]Field `json:"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" mapstructure:"type"` // The type of the non-null inhabitants of this type UnderlyingType Type `json:"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 ¶
UnmarshalJSON implements json.Unmarshaler.
type OrderByColumn ¶
type OrderByColumn struct { Type OrderByTargetType `json:"type" mapstructure:"type"` // The name of the column Name string `json:"name" mapstructure:"name"` // Any relationships to traverse to reach this column Path []PathElement `json:"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" mapstructure:"type"` // The column to apply the aggregation function to Column string `json:"column" mapstructure:"column"` // Single column aggregate function name. Function string `json:"function" mapstructure:"function"` // Non-empty collection of relationships to traverse Path []PathElement `json:"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 ¶
func (ob OrderBySingleColumnAggregate) Encode() OrderByTarget
Encode converts the instance to raw OrderByTarget
type OrderByStarCountAggregate ¶
type OrderByStarCountAggregate struct { Type OrderByTargetType `json:"type" mapstructure:"type"` // Non-empty collection of relationships to traverse Path []PathElement `json:"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 ¶
func (ob OrderByStarCountAggregate) Encode() OrderByTarget
Encode converts the instance to raw OrderByTarget
type OrderByTarget ¶
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 ¶
func (j OrderByTarget) Type() (OrderByTargetType, error)
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) 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" mapstructure:"type"` // The name can refer to a primitive type or a scalar type ObjectTypeName string `json:"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.
type ProcedureInfoArguments ¶
type ProcedureInfoArguments map[string]ArgumentInfo
Any arguments that this collection requires
type ProcedureResult ¶
type ProcedureResult struct { Type MutationOperationType `json:"type" mapstructure:"type"` Result any `json:"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 ¶
func (pr ProcedureResult) Encode() MutationOperationResults
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 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 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 ¶
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 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" mapstructure:"type"` Name string `json:"name" mapstructure:"name"` Value any `json:"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) 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 ¶
A mapping between columns on the source collection to columns on the target collection
type RelationshipField ¶
type RelationshipField struct { Type FieldType `json:"type" mapstructure:"type"` // The relationship query Query Query `json:"query" mapstructure:"query"` // The name of the relationship to follow for the subquery Relationship string `json:"relationship" mapstructure:"relationship"` // Values to be provided to any collection arguments Arguments map[string]RelationshipArgument `json:"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"` }
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) UnmarshalJSON ¶
func (j *SchemaResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
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 ¶
Types track the valid representations of values as JSON
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) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type TypeEncoder ¶
type TypeEncoder interface {
Encode() Type
}
TypeEncoder abstracts the Type interface
type TypeEnum ¶
type TypeEnum string
func ParseTypeEnum ¶
ParseTypeEnum parses a type enum from string
func (*TypeEnum) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
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.