hasura

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, hasura *config.Hasura, cfg config.Database, views []string, models ...interface{}) error

Create - creates hasura models

Types

type API

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

API -

func New

func New(baseURL, secret string) *API

New -

func (*API) CreateRestEndpoint added in v0.1.13

func (api *API) CreateRestEndpoint(ctx context.Context, name, url, queryName, collectionName string) error

CreateRestEndpoint -

func (*API) CreateSelectPermissions added in v0.1.8

func (api *API) CreateSelectPermissions(ctx context.Context, table, role string, perm Permission) error

CreateSelectPermissions - A select permission is used to restrict access to only the specified columns and rows.

func (*API) DropSelectPermissions added in v0.1.9

func (api *API) DropSelectPermissions(ctx context.Context, table, role string) error

DropSelectPermissions -

func (*API) ExportMetadata

func (api *API) ExportMetadata(ctx context.Context, data *Metadata) (ExportMetadataResponse, error)

ExportMetadata -

func (*API) Health

func (api *API) Health(ctx context.Context) error

Health

func (*API) ReplaceMetadata

func (api *API) ReplaceMetadata(ctx context.Context, data *Metadata) error

ReplaceMetadata -

func (*API) TrackTable added in v0.1.6

func (api *API) TrackTable(ctx context.Context, schema, name string) error

TrackTable -

type APIError added in v0.1.14

type APIError struct {
	Path string `json:"path"`
	Text string `json:"error"`
	Code string `json:"code"`
}

APIError -

func (APIError) AlreadyExists added in v0.1.14

func (e APIError) AlreadyExists() bool

AlreadyExists -

func (APIError) Error added in v0.1.14

func (e APIError) Error() string

Error -

type Columns added in v0.1.13

type Columns []string

Columns -

func (Columns) MarshalJSON added in v0.1.13

func (columns Columns) MarshalJSON() ([]byte, error)

MarshalJSON -

func (*Columns) UnmarshalJSON added in v0.1.13

func (columns *Columns) UnmarshalJSON(data []byte) error

UnmarshalJSON -

type Definition added in v0.1.13

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

Definition -

type ExportMetadataResponse

type ExportMetadataResponse struct {
	Tables []Table `json:"tables"`
}

ExportMetadataResponse -

type Metadata added in v0.1.13

type Metadata struct {
	Version          int               `json:"version"`
	Tables           []Table           `json:"tables"`
	QueryCollections []QueryCollection `json:"query_collections,omitempty"`
}

Metadata -

func Generate

func Generate(hasura config.Hasura, cfg config.Database, models ...interface{}) (*Metadata, error)

Generate - creates hasura table structure in JSON from `models`. `models` should be pointer to your table models. `cfg` is DB config from YAML.

type Permission added in v0.1.8

type Permission struct {
	Columns   Columns     `json:"columns"`
	Limit     uint64      `json:"limit"`
	AllowAggs bool        `json:"allow_aggregations"`
	Filter    interface{} `json:"filter,omitempty"`
}

Permission -

type Query added in v0.1.13

type Query struct {
	Name           string `json:"name"`
	Query          string `json:"query,omitempty"`
	CollectionName string `json:"collection_name,omitempty"`
}

Query -

type QueryCollection added in v0.1.13

type QueryCollection struct {
	Definition Definition `json:"definition"`
	Name       string     `json:"name"`
}

QueryCollection -

type SelectPermission added in v0.1.13

type SelectPermission struct {
	Role       string     `json:"role"`
	Permission Permission `json:"permission"`
}

SelectPermission -

type Table added in v0.1.13

type Table struct {
	ObjectRelationships []interface{}      `json:"object_relationships"`
	ArrayRelationships  []interface{}      `json:"array_relationships"`
	SelectPermissions   []SelectPermission `json:"select_permissions"`
	Schema              TableSchema        `json:"table"`
}

Table -

type TableSchema added in v0.1.13

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

TableSchema -

Jump to

Keyboard shortcuts

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