hasura

package
v0.8.23 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Binary

func Binary(customBinary string) (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 Client

type Client struct {
	Endpoint               string
	AdminSecret            string
	Client                 HttpDoer
	CLI                    string
	CommonOptions          []string
	CommonOptionsWithoutDB []string
	// contains filtered or unexported fields
}

func InitClient added in v0.7.1

func InitClient(endpoint, adminSecret, customBinary string, httpClient HttpDoer) (*Client, error)

func (*Client) ApplyMetadata added in v0.7.1

func (c *Client) ApplyMetadata(ctx context.Context, debug bool) error

func (*Client) ApplyMigrations added in v0.7.1

func (c *Client) ApplyMigrations(ctx context.Context, debug bool) error

func (*Client) ApplySeed added in v0.7.1

func (c *Client) ApplySeed(ctx context.Context, debug bool) error

func (*Client) ApplySeeds

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

func (*Client) ClearMigration

func (c *Client) ClearMigration(source string) error

func (*Client) ExportMetadata added in v0.7.1

func (c *Client) ExportMetadata(ctx context.Context, debug bool) error

func (*Client) GetExtensions

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

func (*Client) GetInconsistentMetadata added in v0.6.5

func (c *Client) GetInconsistentMetadata() (InconsistentMetadataResponse, error)

func (*Client) GetMetadata

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

func (*Client) GetSchemas

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

func (*Client) Init

func (c *Client) Init(endpoint, adminSecret, customBinary string, client HttpDoer) 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) ReloadMetadata added in v0.8.22

func (c *Client) ReloadMetadata(ctx context.Context, debug bool) error

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) StartConsole added in v0.7.1

func (c *Client) StartConsole(ctx context.Context, consolePort, consoleAPIPort uint32, debug bool) error

func (*Client) StopConsole added in v0.7.1

func (c *Client) StopConsole() error

func (*Client) Track

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

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() (*InconsistentMetadataResponse, error)
	GetInconsistentMetadataReader() (io.Reader, error)
}

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

type HttpDoer added in v0.7.1

type HttpDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

type InconsistentMetadataResponse added in v0.6.5

type InconsistentMetadataResponse struct {
	IsConsistent        bool `json:"is_consistent"`
	InconsistentObjects []struct {
		Type       string `json:"type"`
		Name       string `json:"name"`
		Reason     string `json:"reason"`
		Definition struct {
			Name   string `json:"name"`
			Schema string `json:"schema"`
		} `json:"definition"`
		Table struct {
			Name   string `json:"name"`
			Schema string `json:"schema"`
		} `json:"table"`
	} `json:"inconsistent_objects"`
}

type MetadataV3 added in v0.6.6

type MetadataV3 struct {
	Sources []Source `json:"sources"`
}

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(source string) Migration

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 QualifiedTable

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

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 Source added in v0.5.9

type Source struct {
	Name   string       `json:"name"`
	Tables []TableEntry `json:"tables"`
}

type TableEntry

type TableEntry struct {
	IsEnum *bool          `json:"is_enum,omitempty"`
	Table  QualifiedTable `json:"table"`
}

func GetTablesFromLocalMetadata

func GetTablesFromLocalMetadata() ([]TableEntry, 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"`
}

Jump to

Keyboard shortcuts

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