hasura

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Binary

func Binary() (string, error)

if the required binary exists in $HOME/.nhost this function returns it's exact path and if the binary doesn't exist, it downloads it from specifically supplied URL based on user's OS and ARCH

Types

type Action

type Action struct {
	Comment     *string          `json:"comment,omitempty"`     //  Comment
	Definition  ActionDefinition `json:"definition"`            //  Definition of the action
	Name        string           `json:"name"`                  //  Name of the action
	Permissions *Permissions     `json:"permissions,omitempty"` //  Permissions of the action
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax

func UnmarshalAction

func UnmarshalAction(data []byte) (Action, error)

func (*Action) Marshal

func (r *Action) Marshal() ([]byte, error)

type ActionDefinition

type ActionDefinition struct {
	Arguments            []InputArgument       `json:"arguments"`
	ForwardClientHeaders *bool                 `json:"forward_client_headers,omitempty"`
	Handler              string                `json:"handler"` //  A String value which supports templating environment variables enclosed in {{ and }}.; Template example: https://{{ACTION_API_DOMAIN}}/create-user
	Headers              []Header              `json:"headers"`
	Kind                 *string               `json:"kind,omitempty"`
	OutputType           *string               `json:"output_type,omitempty"`
	Type                 *ActionDefinitionType `json:"type,omitempty"`
}

Definition of the action

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition

func UnmarshalActionDefinition

func UnmarshalActionDefinition(data []byte) (ActionDefinition, error)

func (*ActionDefinition) Marshal

func (r *ActionDefinition) Marshal() ([]byte, error)

type ActionDefinitionType

type ActionDefinitionType string
const (
	Mutation ActionDefinitionType = "mutation"
	Query    ActionDefinitionType = "query"
)

type ActionName

type ActionName string

func UnmarshalActionName

func UnmarshalActionName(data []byte) (ActionName, error)

func (*ActionName) Marshal

func (r *ActionName) Marshal() ([]byte, error)

type AllowList

type AllowList struct {
	Collection string `json:"collection"` //  Name of a query collection to be added to the allow-list
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax

func UnmarshalAllowList

func UnmarshalAllowList(data []byte) (AllowList, error)

func (*AllowList) Marshal

func (r *AllowList) Marshal() ([]byte, error)

type ArrRelUsing

type ArrRelUsing struct {
	ForeignKeyConstraintOn *ArrRelUsingFKeyOn        `json:"foreign_key_constraint_on,omitempty"` //  The column with foreign key constraint
	ManualConfiguration    *ArrRelUsingManualMapping `json:"manual_configuration,omitempty"`      //  Manual mapping of table and columns
}

Use one of the available ways to define an array relationship

Use one of the available ways to define an object relationship

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing

func UnmarshalArrRelUsing

func UnmarshalArrRelUsing(data []byte) (ArrRelUsing, error)

func (*ArrRelUsing) Marshal

func (r *ArrRelUsing) Marshal() ([]byte, error)

type ArrRelUsingFKeyOn

type ArrRelUsingFKeyOn struct {
	Column string     `json:"column"`
	Table  *TableName `json:"table"`
}

The column with foreign key constraint

The column with foreign key constraint

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon

func UnmarshalArrRelUsingFKeyOn

func UnmarshalArrRelUsingFKeyOn(data []byte) (ArrRelUsingFKeyOn, error)

func (*ArrRelUsingFKeyOn) Marshal

func (r *ArrRelUsingFKeyOn) Marshal() ([]byte, error)

type ArrRelUsingManualMapping

type ArrRelUsingManualMapping struct {
	ColumnMapping map[string]string `json:"column_mapping"` //  Mapping of columns from current table to remote table
	RemoteTable   *TableName        `json:"remote_table"`   //  The table to which the relationship has to be established
}

Manual mapping of table and columns

Manual mapping of table and columns

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping

func UnmarshalArrRelUsingManualMapping

func UnmarshalArrRelUsingManualMapping(data []byte) (ArrRelUsingManualMapping, error)

func (*ArrRelUsingManualMapping) Marshal

func (r *ArrRelUsingManualMapping) Marshal() ([]byte, error)

type ArrayRelationship

type ArrayRelationship struct {
	Comment *string     `json:"comment,omitempty"` //  Comment
	Name    string      `json:"name"`              //  Name of the new relationship
	Using   ArrRelUsing `json:"using"`             //  Use one of the available ways to define an array relationship
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax

func UnmarshalArrayRelationship

func UnmarshalArrayRelationship(data []byte) (ArrayRelationship, error)

func (*ArrayRelationship) Marshal

func (r *ArrayRelationship) Marshal() ([]byte, error)

type Client

type Client struct {
	Endpoint    string
	AdminSecret string
	Client      *http.Client
	CLI         string
}

func (*Client) ApplySeeds

func (c *Client) ApplySeeds(tables []TableEntry) ([]byte, error)

func (*Client) ClearMigration

func (c *Client) ClearMigration() error

func (*Client) GetExtensions

func (c *Client) GetExtensions() ([]string, error)

func (*Client) GetMetadata

func (c *Client) GetMetadata() (HasuraMetadataV2, error)

func (*Client) GetSchemas

func (c *Client) GetSchemas() ([]string, error)

func (*Client) Init

func (c *Client) Init(endpoint, adminSecret string, client *http.Client) error

Initialize the client with supplied Hasura endpoint, admin secret and a custom HTTP client.

func (*Client) Migration

func (c *Client) Migration(options []string) ([]byte, error)

func (*Client) PGDump

func (c *Client) PGDump(options []string) ([]byte, error)

fetches migrations from remote Hasura server to be applied manually

func (*Client) Request

func (c *Client) Request(body []byte, path string) (*http.Response, error)

func (*Client) Seed

func (c *Client) Seed(payload string) error

func (*Client) Track

func (c *Client) Track(table TableEntry) error

type CollectionName

type CollectionName string

func UnmarshalCollectionName

func UnmarshalCollectionName(data []byte) (CollectionName, error)

func (*CollectionName) Marshal

func (r *CollectionName) Marshal() ([]byte, error)

type ColumnPresetsExpression

type ColumnPresetsExpression map[string]string

func UnmarshalColumnPresetsExpression

func UnmarshalColumnPresetsExpression(data []byte) (ColumnPresetsExpression, error)

func (*ColumnPresetsExpression) Marshal

func (r *ColumnPresetsExpression) Marshal() ([]byte, error)

type Columns

type Columns string
const (
	Empty Columns = "*"
)

type CommonMetadataOperations

type CommonMetadataOperations interface {
	ExportMetadata() (metadata io.Reader, err error)
	ClearMetadata() (io.Reader, error)
	ReloadMetadata() (io.Reader, error)
	DropInconsistentMetadata() (io.Reader, error)
	ReplaceMetadata(metadata io.Reader) (io.Reader, error)
	GetInconsistentMetadata() (*GetInconsistentMetadataResponse, error)
	GetInconsistentMetadataReader() (io.Reader, error)
}

general hasura metadata API requests these are not dependent on the connected source type

type ComputedField

type ComputedField struct {
	Comment    *string                 `json:"comment,omitempty"` //  Comment
	Definition ComputedFieldDefinition `json:"definition"`        //  The computed field definition
	Name       string                  `json:"name"`              //  Name of the new computed field
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax

func UnmarshalComputedField

func UnmarshalComputedField(data []byte) (ComputedField, error)

func (*ComputedField) Marshal

func (r *ComputedField) Marshal() ([]byte, error)

type ComputedFieldDefinition

type ComputedFieldDefinition struct {
	Function        *FunctionName `json:"function"`                   //  The SQL function
	SessionArgument *string       `json:"session_argument,omitempty"` //  Name of the argument which accepts the Hasura session object as a JSON/JSONB value. If; omitted, the Hasura session object is not passed to the function
	TableArgument   *string       `json:"table_argument,omitempty"`   //  Name of the argument which accepts a table row type. If omitted, the first argument is; considered a table argument
}

The computed field definition

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition

func UnmarshalComputedFieldDefinition

func UnmarshalComputedFieldDefinition(data []byte) (ComputedFieldDefinition, error)

func (*ComputedFieldDefinition) Marshal

func (r *ComputedFieldDefinition) Marshal() ([]byte, error)

type ComputedFieldName

type ComputedFieldName string

func UnmarshalComputedFieldName

func UnmarshalComputedFieldName(data []byte) (ComputedFieldName, error)

func (*ComputedFieldName) Marshal

func (r *ComputedFieldName) Marshal() ([]byte, error)

type CronTrigger

type CronTrigger struct {
	Comment           *string                `json:"comment,omitempty"`    //  Custom comment.
	Headers           []Header               `json:"headers"`              //  List of headers to be sent with the webhook
	IncludeInMetadata bool                   `json:"include_in_metadata"`  //  Flag to indicate whether a trigger should be included in the metadata. When a cron; trigger is included in the metadata, the user will be able to export it when the metadata; of the graphql-engine is exported.
	Name              string                 `json:"name"`                 //  Name of the cron trigger
	Payload           map[string]interface{} `json:"payload,omitempty"`    //  Any JSON payload which will be sent when the webhook is invoked.
	RetryConf         *RetryConfST           `json:"retry_conf,omitempty"` //  Retry configuration if scheduled invocation delivery fails
	Schedule          string                 `json:"schedule"`             //  Cron expression at which the trigger should be invoked.
	Webhook           string                 `json:"webhook"`              //  URL of the webhook
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger

func UnmarshalCronTrigger

func UnmarshalCronTrigger(data []byte) (CronTrigger, error)

func (*CronTrigger) Marshal

func (r *CronTrigger) Marshal() ([]byte, error)

type CustomColumnNames

type CustomColumnNames map[string]string

func UnmarshalCustomColumnNames

func UnmarshalCustomColumnNames(data []byte) (CustomColumnNames, error)

func (*CustomColumnNames) Marshal

func (r *CustomColumnNames) Marshal() ([]byte, error)

type CustomFunction

type CustomFunction struct {
	Configuration *FunctionConfiguration `json:"configuration,omitempty"` //  Configuration for the SQL function
	Function      *FunctionName          `json:"function"`                //  Name of the SQL function
}

A custom SQL function to add to the GraphQL schema with configuration.

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax

func UnmarshalCustomFunction

func UnmarshalCustomFunction(data []byte) (CustomFunction, error)

func (*CustomFunction) Marshal

func (r *CustomFunction) Marshal() ([]byte, error)

type CustomRootFields

type CustomRootFields struct {
	Delete          *string `json:"delete,omitempty"`           //  Customise the `delete_<table-name>` root field
	DeleteByPk      *string `json:"delete_by_pk,omitempty"`     //  Customise the `delete_<table-name>_by_pk` root field
	Insert          *string `json:"insert,omitempty"`           //  Customise the `insert_<table-name>` root field
	InsertOne       *string `json:"insert_one,omitempty"`       //  Customise the `insert_<table-name>_one` root field
	Select          *string `json:"select,omitempty"`           //  Customise the `<table-name>` root field
	SelectAggregate *string `json:"select_aggregate,omitempty"` //  Customise the `<table-name>_aggregate` root field
	SelectByPk      *string `json:"select_by_pk,omitempty"`     //  Customise the `<table-name>_by_pk` root field
	Update          *string `json:"update,omitempty"`           //  Customise the `update_<table-name>` root field
	UpdateByPk      *string `json:"update_by_pk,omitempty"`     //  Customise the `update_<table-name>_by_pk` root field
}

Customise the root fields

Customise the root fields

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields

func UnmarshalCustomRootFields

func UnmarshalCustomRootFields(data []byte) (CustomRootFields, error)

func (*CustomRootFields) Marshal

func (r *CustomRootFields) Marshal() ([]byte, error)

type CustomTypeObjectRelationship

type CustomTypeObjectRelationship struct {
	FieldMapping map[string]string                `json:"field_mapping"` //  Mapping of fields of object type to columns of remote table
	Name         string                           `json:"name"`          //  Name of the relationship, shouldn’t conflict with existing field names
	RemoteTable  *TableName                       `json:"remote_table"`  //  The table to which relationship is defined
	Type         CustomTypeObjectRelationshipType `json:"type"`          //  Type of the relationship
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship

func UnmarshalCustomTypeObjectRelationship

func UnmarshalCustomTypeObjectRelationship(data []byte) (CustomTypeObjectRelationship, error)

func (*CustomTypeObjectRelationship) Marshal

func (r *CustomTypeObjectRelationship) Marshal() ([]byte, error)

type CustomTypeObjectRelationshipType

type CustomTypeObjectRelationshipType string

Type of the relationship

const (
	Array  CustomTypeObjectRelationshipType = "array"
	Object CustomTypeObjectRelationshipType = "object"
)

type CustomTypes

type CustomTypes struct {
	Enums        []EnumType        `json:"enums"`
	InputObjects []InputObjectType `json:"input_objects"`
	Objects      []ObjectType      `json:"objects"`
	Scalars      []ScalarType      `json:"scalars"`
}

func UnmarshalCustomTypes

func UnmarshalCustomTypes(data []byte) (CustomTypes, error)

func (*CustomTypes) Marshal

func (r *CustomTypes) Marshal() ([]byte, error)

type Definition

type Definition struct {
	Queries []QueryCollection `json:"queries"`
}

List of queries

type DeletePermission

type DeletePermission struct {
	Filter map[string]*Filter `json:"filter,omitempty"` //  Only the rows where this precondition holds true are updatable
}

The permission definition

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission

func UnmarshalDeletePermission

func UnmarshalDeletePermission(data []byte) (DeletePermission, error)

func (*DeletePermission) Marshal

func (r *DeletePermission) Marshal() ([]byte, error)

type DeletePermissionEntry

type DeletePermissionEntry struct {
	Comment    *string          `json:"comment,omitempty"` //  Comment
	Permission DeletePermission `json:"permission"`        //  The permission definition
	Role       string           `json:"role"`              //  Role
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax

func UnmarshalDeletePermissionEntry

func UnmarshalDeletePermissionEntry(data []byte) (DeletePermissionEntry, error)

func (*DeletePermissionEntry) Marshal

func (r *DeletePermissionEntry) Marshal() ([]byte, error)

type EnumType

type EnumType struct {
	Description *string     `json:"description,omitempty"` //  Description of the Enum type
	Name        string      `json:"name"`                  //  Name of the Enum type
	Values      []EnumValue `json:"values"`                //  Values of the Enum type
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype

func UnmarshalEnumType

func UnmarshalEnumType(data []byte) (EnumType, error)

func (*EnumType) Marshal

func (r *EnumType) Marshal() ([]byte, error)

type EnumValue

type EnumValue struct {
	Description  *string `json:"description,omitempty"`   //  Description of the Enum value
	IsDeprecated *bool   `json:"is_deprecated,omitempty"` //  If set to true, the enum value is marked as deprecated
	Value        string  `json:"value"`                   //  Value of the Enum type
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue

func UnmarshalEnumValue

func UnmarshalEnumValue(data []byte) (EnumValue, error)

func (*EnumValue) Marshal

func (r *EnumValue) Marshal() ([]byte, error)

type EventTrigger

type EventTrigger struct {
	Definition     EventTriggerDefinition `json:"definition"`        //  The SQL function
	Headers        []Header               `json:"headers"`           //  The SQL function
	Name           string                 `json:"name"`              //  Name of the event trigger
	RetryConf      RetryConf              `json:"retry_conf"`        //  The SQL function
	Webhook        *string                `json:"webhook,omitempty"` //  The SQL function
	WebhookFromEnv *string                `json:"webhook_from_env,omitempty"`
}

NOTE: The metadata type doesn't QUITE match the 'create' arguments here

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger

func UnmarshalEventTrigger

func UnmarshalEventTrigger(data []byte) (EventTrigger, error)

func (*EventTrigger) Marshal

func (r *EventTrigger) Marshal() ([]byte, error)

type EventTriggerColumns

type EventTriggerColumns struct {
	Enum        *Columns
	StringArray []string
}

func UnmarshalEventTriggerColumns

func UnmarshalEventTriggerColumns(data []byte) (EventTriggerColumns, error)

func (*EventTriggerColumns) Marshal

func (r *EventTriggerColumns) Marshal() ([]byte, error)

func (*EventTriggerColumns) MarshalJSON

func (x *EventTriggerColumns) MarshalJSON() ([]byte, error)

func (*EventTriggerColumns) UnmarshalJSON

func (x *EventTriggerColumns) UnmarshalJSON(data []byte) error

type EventTriggerDefinition

The SQL function

func UnmarshalEventTriggerDefinition

func UnmarshalEventTriggerDefinition(data []byte) (EventTriggerDefinition, error)

func (*EventTriggerDefinition) Marshal

func (r *EventTriggerDefinition) Marshal() ([]byte, error)

type Filter

type Filter struct {
	AnythingMap map[string]interface{}
	Double      *float64
	String      *string
}

func (*Filter) MarshalJSON

func (x *Filter) MarshalJSON() ([]byte, error)

func (*Filter) UnmarshalJSON

func (x *Filter) UnmarshalJSON(data []byte) error

type FunctionConfiguration

type FunctionConfiguration struct {
	SessionArgument *string `json:"session_argument,omitempty"` //  Function argument which accepts session info JSON; Currently, only functions which satisfy the following constraints can be exposed over the; GraphQL API (terminology from Postgres docs):; - Function behaviour: ONLY `STABLE` or `IMMUTABLE`; - Return type: MUST be `SETOF <table-name>`; - Argument modes: ONLY `IN`
}

Configuration for the SQL function

Configuration for a CustomFunction

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration

func UnmarshalFunctionConfiguration

func UnmarshalFunctionConfiguration(data []byte) (FunctionConfiguration, error)

func (*FunctionConfiguration) Marshal

func (r *FunctionConfiguration) Marshal() ([]byte, error)

type FunctionName

type FunctionName struct {
	QualifiedFunction *QualifiedFunction
	String            *string
}

func UnmarshalFunctionName

func UnmarshalFunctionName(data []byte) (FunctionName, error)

func (*FunctionName) Marshal

func (r *FunctionName) Marshal() ([]byte, error)

func (*FunctionName) MarshalJSON

func (x *FunctionName) MarshalJSON() ([]byte, error)

func (*FunctionName) UnmarshalJSON

func (x *FunctionName) UnmarshalJSON(data []byte) error

type GetInconsistentMetadataResponse

type GetInconsistentMetadataResponse struct {
	IsConsistent        bool          `json:"is_consistent"`
	InconsistentObjects []interface{} `json:"inconsistent_objects"`
}

type GraphQLName

type GraphQLName string

func UnmarshalGraphQLName

func UnmarshalGraphQLName(data []byte) (GraphQLName, error)

func (*GraphQLName) Marshal

func (r *GraphQLName) Marshal() ([]byte, error)

type GraphQLType

type GraphQLType string

func UnmarshalGraphQLType

func UnmarshalGraphQLType(data []byte) (GraphQLType, error)

func (*GraphQLType) Marshal

func (r *GraphQLType) Marshal() ([]byte, error)

type HasuraMetadataV2

type HasuraMetadataV2 struct {
	Actions          []Action               `json:"actions"`
	Allowlist        []AllowList            `json:"allowlist"`
	CronTriggers     []CronTrigger          `json:"cron_triggers"`
	CustomTypes      *CustomTypes           `json:"custom_types,omitempty"`
	Functions        []CustomFunction       `json:"functions"`
	QueryCollections []QueryCollectionEntry `json:"query_collections"`
	RemoteSchemas    []RemoteSchema         `json:"remote_schemas"`
	Tables           []TableEntry           `json:"tables"`
	Version          float64                `json:"version"`
}

Type used in exported 'metadata.json' and replace metadata endpoint

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata

func UnmarshalHasuraMetadataV2

func UnmarshalHasuraMetadataV2(data []byte) (HasuraMetadataV2, error)

func (*HasuraMetadataV2) Marshal

func (r *HasuraMetadataV2) Marshal() ([]byte, error)

type HasuraMetadataV3

type HasuraMetadataV3 struct {
	ActionsGraphQL []Action `json:"actions.graphql"`
	ActionsYAML    []Action `json:"actions.yaml"`

	Allowlist    []AllowList
	CronTriggers []CronTrigger
	//  CustomTypes      *CustomTypes           `json:"custom_types,omitempty"`
	Functions        []CustomFunction       `json:"functions"`
	QueryCollections []QueryCollectionEntry `json:"query_collections"`
	RemoteSchemas    []RemoteSchema         `json:"remote_schemas"`
	Tables           []TableEntry           `json:"tables"`
	Version          float64                `json:"version"`
}
type Header struct {
	Name         string  `json:"name"`                     //  Name of the header
	Value        *string `json:"value,omitempty"`          //  Value of the header
	ValueFromEnv *string `json:"value_from_env,omitempty"` //  Name of the environment variable which holds the value of the header
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv

type HeaderFromEnv

type HeaderFromEnv struct {
	Name         string `json:"name"`           //  Name of the header
	ValueFromEnv string `json:"value_from_env"` //  Name of the environment variable which holds the value of the header
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv

func UnmarshalHeaderFromEnv

func UnmarshalHeaderFromEnv(data []byte) (HeaderFromEnv, error)

func (*HeaderFromEnv) Marshal

func (r *HeaderFromEnv) Marshal() ([]byte, error)

type HeaderFromValue

type HeaderFromValue struct {
	Name  string `json:"name"`  //  Name of the header
	Value string `json:"value"` //  Value of the header
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue

func UnmarshalHeaderFromValue

func UnmarshalHeaderFromValue(data []byte) (HeaderFromValue, error)

func (*HeaderFromValue) Marshal

func (r *HeaderFromValue) Marshal() ([]byte, error)

type InputArgument

type InputArgument struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument

func UnmarshalInputArgument

func UnmarshalInputArgument(data []byte) (InputArgument, error)

func (*InputArgument) Marshal

func (r *InputArgument) Marshal() ([]byte, error)

type InputArguments

type InputArguments map[string]string

func UnmarshalInputArguments

func UnmarshalInputArguments(data []byte) (InputArguments, error)

func (*InputArguments) Marshal

func (r *InputArguments) Marshal() ([]byte, error)

type InputObjectField

type InputObjectField struct {
	Description *string `json:"description,omitempty"` //  Description of the Input object type
	Name        string  `json:"name"`                  //  Name of the Input object type
	Type        string  `json:"type"`                  //  GraphQL type of the Input object type
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield

func UnmarshalInputObjectField

func UnmarshalInputObjectField(data []byte) (InputObjectField, error)

func (*InputObjectField) Marshal

func (r *InputObjectField) Marshal() ([]byte, error)

type InputObjectType

type InputObjectType struct {
	Description *string            `json:"description,omitempty"` //  Description of the Input object type
	Fields      []InputObjectField `json:"fields"`                //  Fields of the Input object type
	Name        string             `json:"name"`                  //  Name of the Input object type
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype

func UnmarshalInputObjectType

func UnmarshalInputObjectType(data []byte) (InputObjectType, error)

func (*InputObjectType) Marshal

func (r *InputObjectType) Marshal() ([]byte, error)

type InsertPermission

type InsertPermission struct {
	BackendOnly *bool                `json:"backend_only,omitempty"` //  When set to true the mutation is accessible only if x-hasura-use-backend-only-permissions; session variable exists; and is set to true and request is made with x-hasura-admin-secret set if any auth is; configured
	Check       map[string]*Filter   `json:"check,omitempty"`        //  This expression has to hold true for every new row that is inserted
	Columns     *EventTriggerColumns `json:"columns"`                //  Can insert into only these columns (or all when '*' is specified)
	Set         map[string]string    `json:"set,omitempty"`          //  Preset values for columns that can be sourced from session variables or static values
}

The permission definition

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission

func UnmarshalInsertPermission

func UnmarshalInsertPermission(data []byte) (InsertPermission, error)

func (*InsertPermission) Marshal

func (r *InsertPermission) Marshal() ([]byte, error)

type InsertPermissionEntry

type InsertPermissionEntry struct {
	Comment    *string          `json:"comment,omitempty"` //  Comment
	Permission InsertPermission `json:"permission"`        //  The permission definition
	Role       string           `json:"role"`              //  Role
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax

func UnmarshalInsertPermissionEntry

func UnmarshalInsertPermissionEntry(data []byte) (InsertPermissionEntry, error)

func (*InsertPermissionEntry) Marshal

func (r *InsertPermissionEntry) Marshal() ([]byte, error)

type Migration

type Migration struct {
	Name      string
	Version   int64
	SQLFile   string
	SQLServer bool
	Location  string
	Data      []byte
}

func (*Migration) AddExtensions

func (m *Migration) AddExtensions(extensions []string) []byte

func (*Migration) Format

func (m *Migration) Format(data string) string

func (*Migration) Init

func (m *Migration) Init() Migration

type ObjRelUsing

type ObjRelUsing struct {
	ForeignKeyConstraintOn *string                   `json:"foreign_key_constraint_on,omitempty"` //  The column with foreign key constraint
	ManualConfiguration    *ObjRelUsingManualMapping `json:"manual_configuration,omitempty"`      //  Manual mapping of table and columns
}

Use one of the available ways to define an object relationship

Use one of the available ways to define an object relationship

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusing

func UnmarshalObjRelUsing

func UnmarshalObjRelUsing(data []byte) (ObjRelUsing, error)

func (*ObjRelUsing) Marshal

func (r *ObjRelUsing) Marshal() ([]byte, error)

type ObjRelUsingManualMapping

type ObjRelUsingManualMapping struct {
	ColumnMapping map[string]string `json:"column_mapping"` //  Mapping of columns from current table to remote table
	RemoteTable   *TableName        `json:"remote_table"`   //  The table to which the relationship has to be established
}

Manual mapping of table and columns

Manual mapping of table and columns

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusingmanualmapping

func UnmarshalObjRelUsingManualMapping

func UnmarshalObjRelUsingManualMapping(data []byte) (ObjRelUsingManualMapping, error)

func (*ObjRelUsingManualMapping) Marshal

func (r *ObjRelUsingManualMapping) Marshal() ([]byte, error)

type ObjectField

type ObjectField struct {
	Description *string `json:"description,omitempty"` //  Description of the Input object type
	Name        string  `json:"name"`                  //  Name of the Input object type
	Type        string  `json:"type"`                  //  GraphQL type of the Input object type
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield

func UnmarshalObjectField

func UnmarshalObjectField(data []byte) (ObjectField, error)

func (*ObjectField) Marshal

func (r *ObjectField) Marshal() ([]byte, error)

type ObjectRelationship

type ObjectRelationship struct {
	Comment *string     `json:"comment,omitempty"` //  Comment
	Name    string      `json:"name"`              //  Name of the new relationship
	Using   ObjRelUsing `json:"using"`             //  Use one of the available ways to define an object relationship
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax

func UnmarshalObjectRelationship

func UnmarshalObjectRelationship(data []byte) (ObjectRelationship, error)

func (*ObjectRelationship) Marshal

func (r *ObjectRelationship) Marshal() ([]byte, error)

type ObjectType

type ObjectType struct {
	Description   *string                        `json:"description,omitempty"` //  Description of the Input object type
	Fields        []InputObjectField             `json:"fields"`                //  Fields of the Input object type
	Name          string                         `json:"name"`                  //  Name of the Input object type
	Relationships []CustomTypeObjectRelationship `json:"relationships"`         //  Relationships of the Object type to tables
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype

func UnmarshalObjectType

func UnmarshalObjectType(data []byte) (ObjectType, error)

func (*ObjectType) Marshal

func (r *ObjectType) Marshal() ([]byte, error)

type PGColumn

type PGColumn string

func UnmarshalPGColumn

func UnmarshalPGColumn(data []byte) (PGColumn, error)

func (*PGColumn) Marshal

func (r *PGColumn) Marshal() ([]byte, error)

type PGDumpRequest

type PGDumpRequest struct {
	Opts        []string `json:"opts"`
	CleanOutput bool     `json:"clean_output"`
	SourceName  string   `json:"source,omitempty"`
}

func (*PGDumpRequest) Marshal

func (r *PGDumpRequest) Marshal() ([]byte, error)

type Permissions

type Permissions struct {
	Role string `json:"role"`
}

Permissions of the action

type QualifiedFunction

type QualifiedFunction struct {
	Name   string `json:"name"`
	Schema string `json:"schema"`
}

func UnmarshalQualifiedFunction

func UnmarshalQualifiedFunction(data []byte) (QualifiedFunction, error)

func (*QualifiedFunction) Marshal

func (r *QualifiedFunction) Marshal() ([]byte, error)

type QualifiedTable

type QualifiedTable struct {
	Name   string `json:"name"`
	Schema string `json:"schema"`
}

func UnmarshalQualifiedTable

func UnmarshalQualifiedTable(data []byte) (QualifiedTable, error)

func (*QualifiedTable) Marshal

func (r *QualifiedTable) Marshal() ([]byte, error)

type QueryCollection

type QueryCollection struct {
	Name  string `json:"name"`
	Query string `json:"query"`
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery

func UnmarshalQueryCollection

func UnmarshalQueryCollection(data []byte) (QueryCollection, error)

func (*QueryCollection) Marshal

func (r *QueryCollection) Marshal() ([]byte, error)

type QueryCollectionEntry

type QueryCollectionEntry struct {
	Comment    *string    `json:"comment,omitempty"` //  Comment
	Definition Definition `json:"definition"`        //  List of queries
	Name       string     `json:"name"`              //  Name of the query collection
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax

func UnmarshalQueryCollectionEntry

func UnmarshalQueryCollectionEntry(data []byte) (QueryCollectionEntry, error)

func (*QueryCollectionEntry) Marshal

func (r *QueryCollectionEntry) Marshal() ([]byte, error)

type RelationshipName

type RelationshipName string

func UnmarshalRelationshipName

func UnmarshalRelationshipName(data []byte) (RelationshipName, error)

func (*RelationshipName) Marshal

func (r *RelationshipName) Marshal() ([]byte, error)

type RemoteField

type RemoteField map[string]RemoteFieldValue

func UnmarshalRemoteField

func UnmarshalRemoteField(data []byte) (RemoteField, error)

func (*RemoteField) Marshal

func (r *RemoteField) Marshal() ([]byte, error)

type RemoteFieldValue

type RemoteFieldValue struct {
	Arguments map[string]string           `json:"arguments"`
	Field     map[string]RemoteFieldValue `json:"field,omitempty"` //  A recursive tree structure that points to the field in the remote schema that needs to be; joined with.; It is recursive because the remote field maybe nested deeply in the remote schema.; ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield
}

type RemoteRelationship

type RemoteRelationship struct {
	Definition RemoteRelationshipDef `json:"definition"` //  Definition object
	Name       string                `json:"name"`       //  Name of the remote relationship
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#args-syntax

func UnmarshalRemoteRelationship

func UnmarshalRemoteRelationship(data []byte) (RemoteRelationship, error)

func (*RemoteRelationship) Marshal

func (r *RemoteRelationship) Marshal() ([]byte, error)

type RemoteRelationshipDef

type RemoteRelationshipDef struct {
	HasuraFields []string                    `json:"hasura_fields"` //  Column(s) in the table that is used for joining with remote schema field.; All join keys in remote_field must appear here.
	RemoteField  map[string]RemoteFieldValue `json:"remote_field"`  //  The schema tree ending at the field in remote schema which needs to be joined with.
	RemoteSchema string                      `json:"remote_schema"` //  Name of the remote schema to join with
}

Definition object

func UnmarshalRemoteRelationshipDef

func UnmarshalRemoteRelationshipDef(data []byte) (RemoteRelationshipDef, error)

func (*RemoteRelationshipDef) Marshal

func (r *RemoteRelationshipDef) Marshal() ([]byte, error)

type RemoteRelationshipName

type RemoteRelationshipName string

func UnmarshalRemoteRelationshipName

func UnmarshalRemoteRelationshipName(data []byte) (RemoteRelationshipName, error)

func (*RemoteRelationshipName) Marshal

func (r *RemoteRelationshipName) Marshal() ([]byte, error)

type RemoteSchema

type RemoteSchema struct {
	Comment    *string         `json:"comment,omitempty"` //  Comment
	Definition RemoteSchemaDef `json:"definition"`        //  Name of the remote schema
	Name       string          `json:"name"`              //  Name of the remote schema
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema

func UnmarshalRemoteSchema

func UnmarshalRemoteSchema(data []byte) (RemoteSchema, error)

func (*RemoteSchema) Marshal

func (r *RemoteSchema) Marshal() ([]byte, error)

type RemoteSchemaDef

type RemoteSchemaDef struct {
	ForwardClientHeaders *bool    `json:"forward_client_headers,omitempty"`
	Headers              []Header `json:"headers"`
	TimeoutSeconds       *float64 `json:"timeout_seconds,omitempty"`
	URL                  *string  `json:"url,omitempty"`
	URLFromEnv           *string  `json:"url_from_env,omitempty"`
}

Name of the remote schema

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef

func UnmarshalRemoteSchemaDef

func UnmarshalRemoteSchemaDef(data []byte) (RemoteSchemaDef, error)

func (*RemoteSchemaDef) Marshal

func (r *RemoteSchemaDef) Marshal() ([]byte, error)

type RemoteSchemaName

type RemoteSchemaName string

func UnmarshalRemoteSchemaName

func UnmarshalRemoteSchemaName(data []byte) (RemoteSchemaName, error)

func (*RemoteSchemaName) Marshal

func (r *RemoteSchemaName) Marshal() ([]byte, error)

type RequestBody

type RequestBody struct {
	Type    string      `json:"type"`
	Version uint        `json:"version,omitempty"`
	Args    interface{} `json:"args"`
}

func (*RequestBody) Marshal

func (r *RequestBody) Marshal() ([]byte, error)

type Response

type Response struct {
	Path  string `json:"path"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

Hasura response

type RetryConf

type RetryConf struct {
	IntervalSEC *int64 `json:"interval_sec,omitempty"` //  Number of seconds to wait between each retry.; Default: 10
	NumRetries  *int64 `json:"num_retries,omitempty"`  //  Number of times to retry delivery.; Default: 0
	TimeoutSEC  *int64 `json:"timeout_sec,omitempty"`  //  Number of seconds to wait for response before timing out.; Default: 60
}

The SQL function

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf

func UnmarshalRetryConf

func UnmarshalRetryConf(data []byte) (RetryConf, error)

func (*RetryConf) Marshal

func (r *RetryConf) Marshal() ([]byte, error)

type RetryConfST

type RetryConfST struct {
	NumRetries           *int64 `json:"num_retries,omitempty"`            //  Number of times to retry delivery.; Default: 0
	RetryIntervalSeconds *int64 `json:"retry_interval_seconds,omitempty"` //  Number of seconds to wait between each retry.; Default: 10
	TimeoutSeconds       *int64 `json:"timeout_seconds,omitempty"`        //  Number of seconds to wait for response before timing out.; Default: 60
	ToleranceSeconds     *int64 `json:"tolerance_seconds,omitempty"`      //  Number of seconds between scheduled time and actual delivery time that is acceptable. If; the time difference is more than this, then the event is dropped.; Default: 21600 (6 hours)
}

Retry configuration if scheduled invocation delivery fails

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst

func UnmarshalRetryConfST

func UnmarshalRetryConfST(data []byte) (RetryConfST, error)

func (*RetryConfST) Marshal

func (r *RetryConfST) Marshal() ([]byte, error)

type RoleName

type RoleName string

func UnmarshalRoleName

func UnmarshalRoleName(data []byte) (RoleName, error)

func (*RoleName) Marshal

func (r *RoleName) Marshal() ([]byte, error)

type ScalarType

type ScalarType struct {
	Description *string `json:"description,omitempty"` //  Description of the Scalar type
	Name        string  `json:"name"`                  //  Name of the Scalar type
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype

func UnmarshalScalarType

func UnmarshalScalarType(data []byte) (ScalarType, error)

func (*ScalarType) Marshal

func (r *ScalarType) Marshal() ([]byte, error)

type SelectPermission

type SelectPermission struct {
	AllowAggregations *bool                `json:"allow_aggregations,omitempty"` //  Toggle allowing aggregate queries
	Columns           *EventTriggerColumns `json:"columns"`                      //  Only these columns are selectable (or all when '*' is specified)
	ComputedFields    []string             `json:"computed_fields"`              //  Only these computed fields are selectable
	Filter            map[string]*Filter   `json:"filter,omitempty"`             //  Only the rows where this precondition holds true are selectable
	Limit             *int64               `json:"limit,omitempty"`              //  The maximum number of rows that can be returned
}

The permission definition

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#selectpermission

func UnmarshalSelectPermission

func UnmarshalSelectPermission(data []byte) (SelectPermission, error)

func (*SelectPermission) Marshal

func (r *SelectPermission) Marshal() ([]byte, error)

type SelectPermissionEntry

type SelectPermissionEntry struct {
	Comment    *string          `json:"comment,omitempty"` //  Comment
	Permission SelectPermission `json:"permission"`        //  The permission definition
	Role       string           `json:"role"`              //  Role
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-select-permission-syntax

func UnmarshalSelectPermissionEntry

func UnmarshalSelectPermissionEntry(data []byte) (SelectPermissionEntry, error)

func (*SelectPermissionEntry) Marshal

func (r *SelectPermissionEntry) Marshal() ([]byte, error)

type TableConfig

type TableConfig struct {
	CustomColumnNames map[string]string `json:"custom_column_names,omitempty"` //  Customise the column names
	CustomRootFields  *CustomRootFields `json:"custom_root_fields,omitempty"`  //  Customise the root fields
}

Configuration for the table/view

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config

func UnmarshalTableConfig

func UnmarshalTableConfig(data []byte) (TableConfig, error)

func (*TableConfig) Marshal

func (r *TableConfig) Marshal() ([]byte, error)

type TableEntry

type TableEntry struct {
	ArrayRelationships  []ArrayRelationship     `json:"array_relationships"`
	ComputedFields      []ComputedField         `json:"computed_fields"`
	Configuration       *TableConfig            `json:"configuration,omitempty"` //  Configuration for the table/view; ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config
	DeletePermissions   []DeletePermissionEntry `json:"delete_permissions"`
	EventTriggers       []EventTrigger          `json:"event_triggers"`
	InsertPermissions   []InsertPermissionEntry `json:"insert_permissions"`
	IsEnum              *bool                   `json:"is_enum,omitempty"`
	ObjectRelationships []ObjectRelationship    `json:"object_relationships"`
	RemoteRelationships []RemoteRelationship    `json:"remote_relationships"`
	SelectPermissions   []SelectPermissionEntry `json:"select_permissions"`
	Table               QualifiedTable          `json:"table"`
	UpdatePermissions   []UpdatePermissionEntry `json:"update_permissions"`
}

Representation of a table in metadata, 'tables.yaml' and 'metadata.json'

func GetTablesFromLocalMetadata

func GetTablesFromLocalMetadata() ([]TableEntry, error)

func UnmarshalTableEntry

func UnmarshalTableEntry(data []byte) (TableEntry, error)

func (*TableEntry) Marshal

func (r *TableEntry) Marshal() ([]byte, error)

type TableName

type TableName struct {
	QualifiedTable *QualifiedTable
	String         *string
}

func UnmarshalTableName

func UnmarshalTableName(data []byte) (TableName, error)

func (*TableName) Marshal

func (r *TableName) Marshal() ([]byte, error)

func (*TableName) MarshalJSON

func (x *TableName) MarshalJSON() ([]byte, error)

func (*TableName) UnmarshalJSON

func (x *TableName) UnmarshalJSON(data []byte) error

type TriggerName

type TriggerName string

func UnmarshalTriggerName

func UnmarshalTriggerName(data []byte) (TriggerName, error)

func (*TriggerName) Marshal

func (r *TriggerName) Marshal() ([]byte, error)

type UpdatePermission

type UpdatePermission struct {
	Check   map[string]*Filter   `json:"check,omitempty"`  //  Postcondition which must be satisfied by rows which have been updated
	Columns *EventTriggerColumns `json:"columns"`          //  Only these columns are selectable (or all when '*' is specified)
	Filter  map[string]*Filter   `json:"filter,omitempty"` //  Only the rows where this precondition holds true are updatable
	Set     map[string]string    `json:"set,omitempty"`    //  Preset values for columns that can be sourced from session variables or static values
}

The permission definition

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#updatepermission

func UnmarshalUpdatePermission

func UnmarshalUpdatePermission(data []byte) (UpdatePermission, error)

func (*UpdatePermission) Marshal

func (r *UpdatePermission) Marshal() ([]byte, error)

type UpdatePermissionEntry

type UpdatePermissionEntry struct {
	Comment    *string          `json:"comment,omitempty"` //  Comment
	Permission UpdatePermission `json:"permission"`        //  The permission definition
	Role       string           `json:"role"`              //  Role
}

https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-update-permission-syntax

func UnmarshalUpdatePermissionEntry

func UnmarshalUpdatePermissionEntry(data []byte) (UpdatePermissionEntry, error)

func (*UpdatePermissionEntry) Marshal

func (r *UpdatePermissionEntry) Marshal() ([]byte, error)

type V2ReplaceMetadataArgs

type V2ReplaceMetadataArgs struct {
	AllowInconsistentMetadata bool        `json:"allow_inconsistent_metadata"`
	Metadata                  interface{} `json:"metadata"`
}

type V2ReplaceMetadataResponse

type V2ReplaceMetadataResponse struct {
	IsConsistent        bool        `json:"is_consistent"`
	InconsistentObjects interface{} `json:"inconsistent_objects"`
}

type WebhookURL

type WebhookURL string

func UnmarshalWebhookURL

func UnmarshalWebhookURL(data []byte) (WebhookURL, error)

func (*WebhookURL) Marshal

func (r *WebhookURL) Marshal() ([]byte, error)

Jump to

Keyboard shortcuts

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