projectmetadata

package
v2.25.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetadataObjectsWithDir

func GetMetadataObjectsWithDir(ec *cli.ExecutionContext, dir ...string) metadataobject.Objects

Types

type Handler

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

Handler will be responsible for interaction between a hasura instance and Objects

func NewHandler

func NewHandler(objects metadataobject.Objects, v1MetadataOps hasura.CommonMetadataOperations, v2MetadataOps hasura.V2CommonMetadataOperations, logger *logrus.Logger) *Handler

func NewHandlerFromEC

func NewHandlerFromEC(ec *cli.ExecutionContext) *Handler

func (*Handler) BuildJSONMetadata added in v2.5.1

func (h *Handler) BuildJSONMetadata() ([]byte, error)

func (*Handler) BuildYAMLMetadata added in v2.5.1

func (h *Handler) BuildYAMLMetadata() ([]byte, error)

func (*Handler) DropInconsistentMetadata

func (h *Handler) DropInconsistentMetadata() error

func (*Handler) ExportMetadata

func (h *Handler) ExportMetadata() (map[string][]byte, error)

func (*Handler) GetInconsistentMetadata

func (h *Handler) GetInconsistentMetadata() (bool, []InconsistentMetadataObject, error)

func (*Handler) ReloadMetadata

func (h *Handler) ReloadMetadata() (io.Reader, error)

ReloadMetadata - Reload Hasura GraphQL Engine metadata on the database

func (*Handler) ResetMetadata

func (h *Handler) ResetMetadata() error

func (*Handler) SetMetadataObjects

func (h *Handler) SetMetadataObjects(objects metadataobject.Objects)

func (*Handler) V1ApplyMetadata

func (h *Handler) V1ApplyMetadata() (io.Reader, error)

func (*Handler) V2ApplyMetadata

func (h *Handler) V2ApplyMetadata(disallowInconsistentMetadata bool) (*hasura.V2ReplaceMetadataResponse, error)

func (*Handler) WriteMetadata

func (h *Handler) WriteMetadata(files map[string][]byte) error

WriteMetadata writes the files in the metadata folder

type InconsistentMetadataObject

type InconsistentMetadataObject struct {
	Definition interface{} `json:"definition" mapstructure:"definition"`
	Reason     interface{} `json:"reason" mapstructure:"reason"`
	Type       interface{} `json:"type" mapstructure:"type"`
}

func (InconsistentMetadataObject) GetDescription

func (obj InconsistentMetadataObject) GetDescription() string

func (InconsistentMetadataObject) GetName

func (obj InconsistentMetadataObject) GetName() string

func (InconsistentMetadataObject) GetReason

func (obj InconsistentMetadataObject) GetReason() string

func (InconsistentMetadataObject) GetType

func (obj InconsistentMetadataObject) GetType() string

type Metadata added in v2.5.1

type Metadata struct {
	Version          interface{} `yaml:"version" mapstructure:"version"`
	Sources          interface{} `yaml:"sources,omitempty" mapstructure:"sources,omitempty"`
	Tables           interface{} `yaml:"tables,omitempty" mapstructure:"tables,omitempty"`
	Functions        interface{} `yaml:"functions,omitempty" mapstructure:"functions,omitempty"`
	Actions          interface{} `yaml:"actions,omitempty" mapstructure:"actions,omitempty"`
	CustomTypes      interface{} `yaml:"custom_types,omitempty" mapstructure:"custom_types,omitempty"`
	RemoteSchemas    interface{} `yaml:"remote_schemas,omitempty" mapstructure:"remote_schemas,omitempty"`
	QueryCollections interface{} `yaml:"query_collections,omitempty" mapstructure:"query_collections,omitempty"`
	AllowList        interface{} `yaml:"allowlist,omitempty" mapstructure:"allowlist,omitempty"`
	CronTriggers     interface{} `yaml:"cron_triggers,omitempty" mapstructure:"cron_triggers,omitempty"`
	Network          interface{} `yaml:"network,omitempty" mapstructure:"network,omitempty"`
	APILimits        interface{} `yaml:"api_limits,omitempty" mapstructure:"api_limits,omitempty"`
	RestEndpoints    interface{} `yaml:"rest_endpoints,omitempty" mapstructure:"rest_endpoints,omitempty"`
	InheritedRoles   interface{} `yaml:"inherited_roles,omitempty" mapstructure:"inherited_roles,omitempty"`
	Opentelemetry    interface{} `yaml:"opentelemetry,omitempty" mapstructure:"opentelemetry,omitempty"`
	BackendConfig    interface{} `yaml:"backend_configs,omitempty" mapstructure:"backend_configs,omitempty"`

	// HGE Pro
	GraphQLSchemaIntrospection interface{} `yaml:"graphql_schema_introspection,omitempty" mapstructure:"graphql_schema_introspection,omitempty"`
	MetricsConfig              interface{} `yaml:"metrics_config,omitempty" mapstructure:"metrics_config,omitempty"`
}

Metadata does not strictly mirror the actual structure of server metadata this is evident in the struct below, because V3 metadata does not contain "tables" / "functions" key

this is rather a utility / helper struct which allow us to unmarshal / marshal metadata bytes in a specific order.

func GenMetadataFromMap added in v2.5.1

func GenMetadataFromMap(metadata map[string]interface{}) (*Metadata, error)

func (Metadata) JSON added in v2.5.1

func (m Metadata) JSON() ([]byte, error)

JSON is a helper function which returns JSON representation of Metadata This exists because we cannot directly do a json.Marshal on Metadata because the underlying type of struct fields might be yaml.Node which might give unintended result

func (Metadata) YAML added in v2.5.1

func (m Metadata) YAML() ([]byte, error)

type PrintContextRichDiffBetweenProjectDirectoriesOpts

type PrintContextRichDiffBetweenProjectDirectoriesOpts struct {
	EC                         *cli.ExecutionContext
	MetadataHandler            *Handler
	FromDirectory, ToDirectory string
	Writer                     io.Writer
	DisableColor               bool
}

Jump to

Keyboard shortcuts

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