Documentation ¶
Index ¶
- func Create(ctx context.Context, args GenerateArgs) error
- func TestExpectedMetadataWithActual(t *testing.T, configPath string, expectedMetadataPath string)
- func ToSnakeCase(str string) string
- type API
- func (api *API) AddSource(ctx context.Context, hasura *config.Hasura, cfg config.Database) error
- func (api *API) CreateRestEndpoint(ctx context.Context, name, url, queryName, collectionName string) error
- func (api *API) CreateSelectPermissions(ctx context.Context, table, source string, role string, perm Permission) error
- func (api *API) CustomConfiguration(ctx context.Context, conf interface{}) error
- func (api *API) DropSelectPermissions(ctx context.Context, table, source string, role string) error
- func (api *API) ExportMetadata(ctx context.Context) (Metadata, error)
- func (api *API) Health(ctx context.Context) error
- func (api *API) ReplaceMetadata(ctx context.Context, data *Metadata) error
- func (api *API) TrackTable(ctx context.Context, name string, source string) error
- type APIError
- type Columns
- type Configuration
- type ConnectionInfo
- type DatabaseUrl
- type DatabaseUrlFromEnv
- type Definition
- type ExpectedMetadata
- type ExpectedTable
- type FKRelationship
- type GenerateArgs
- type ManualRelationship
- type Metadata
- type PGTable
- type Permission
- type Query
- type QueryCollection
- type Relationship
- type RelationshipUsing
- type Request
- type SelectPermission
- type Source
- type Table
- type TableConfiguration
- type TableSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(ctx context.Context, args GenerateArgs) error
Create - creates hasura models
func TestExpectedMetadataWithActual ¶ added in v0.2.31
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API -
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, source string, role string, perm Permission) error
CreateSelectPermissions - A select permission is used to restrict access to only the specified columns and rows.
func (*API) CustomConfiguration ¶ added in v0.2.8
CustomConfiguration
func (*API) DropSelectPermissions ¶ added in v0.1.9
DropSelectPermissions -
func (*API) ExportMetadata ¶
ExportMetadata -
func (*API) ReplaceMetadata ¶
ReplaceMetadata -
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
AlreadyExists -
func (APIError) PermissionDenied ¶ added in v0.2.36
PermissionDenied -
type Columns ¶ added in v0.1.13
type Columns []string
Columns -
func (Columns) MarshalJSON ¶ added in v0.1.13
MarshalJSON -
func (*Columns) UnmarshalJSON ¶ added in v0.1.13
UnmarshalJSON -
type Configuration ¶ added in v0.2.8
type Configuration struct {
ConnectionInfo ConnectionInfo `json:"connection_info"`
}
Configuration -
type ConnectionInfo ¶ added in v0.2.8
type ConnectionInfo struct { UsePreparedStatements bool `json:"use_prepared_statements"` IsolationLevel string `json:"isolation_level"` DatabaseUrl DatabaseUrl `json:"database_url"` }
ConnectionInfo -
type DatabaseUrl ¶ added in v0.2.8
type DatabaseUrl string
DatabaseUrl -
func (*DatabaseUrl) UnmarshalJSON ¶ added in v0.2.8
func (d *DatabaseUrl) UnmarshalJSON(data []byte) error
UnmarshalJSON -
type DatabaseUrlFromEnv ¶ added in v0.2.8
type DatabaseUrlFromEnv struct {
FromEnv string `json:"from_env"`
}
DatabaseUrlFromEnv -
type Definition ¶ added in v0.1.13
type Definition struct {
Queries []Query `json:"queries"`
}
Definition -
type ExpectedMetadata ¶ added in v0.2.31
type ExpectedMetadata struct {
Tables []ExpectedTable `yaml:"tables" validate:"required"`
}
type ExpectedTable ¶ added in v0.2.31
type FKRelationship ¶ added in v0.2.32
FKRelationship -
type GenerateArgs ¶ added in v0.2.10
type GenerateArgs struct { Config *config.Hasura `validate:"required"` DatabaseConfig config.Database `validate:"required"` Views []string `validate:"omitempty"` CustomConfigurations []Request `validate:"omitempty"` Models []any `validate:"omitempty"` }
GenerateArgs -
type ManualRelationship ¶ added in v0.2.32
type ManualRelationship struct { RemoteTable PGTable `json:"remote_table"` ColumnMapping map[string]string `json:"column_mapping"` }
ManualRelationship -
type Metadata ¶ added in v0.1.13
type Metadata struct { Version int `json:"version"` Sources []Source `json:"sources"` QueryCollections []QueryCollection `json:"query_collections,omitempty"` RestEndpoints []interface{} `json:"rest_endpoints,omitempty"` }
Metadata -
type PGTable ¶ added in v0.2.32
PGTable -
func (*PGTable) MarshalJSON ¶ added in v0.2.32
MarshalJSON -
func (*PGTable) UnmarshalJSON ¶ added in v0.2.32
UnmarshalJSON -
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 Relationship ¶ added in v0.2.32
type Relationship struct { Table PGTable `json:"table"` Name string `json:"name"` Comment string `json:"comment,omitempty"` Using RelationshipUsing `json:"using"` }
Relationship -
type RelationshipUsing ¶ added in v0.2.32
type RelationshipUsing struct { Manual *ManualRelationship `json:"manual_configuration,omitempty"` FK *FKRelationship `json:"foreign_key_constraint_on,omitempty"` }
RelationshipUsing -
type Request ¶ added in v0.2.8
type Request struct { Type string `json:"type"` Args interface{} `json:"args"` }
type SelectPermission ¶ added in v0.1.13
type SelectPermission struct { Role string `json:"role"` Permission Permission `json:"permission"` }
SelectPermission -
type Source ¶ added in v0.2.8
type Source struct { Name string `json:"name"` Kind string `json:"kind"` Tables []Table `json:"tables"` Configuration Configuration `json:"configuration"` }
Source -
type Table ¶ added in v0.1.13
type Table struct { ObjectRelationships []Relationship `json:"object_relationships"` ArrayRelationships []Relationship `json:"array_relationships"` SelectPermissions []SelectPermission `json:"select_permissions"` Configuration TableConfiguration `json:"configuration"` Schema TableSchema `json:"table"` }
Table -
type TableConfiguration ¶ added in v0.2.8
type TableConfiguration struct { Comment *string `json:"comment"` CustomRootFields map[string]string `json:"custom_root_fields"` CustomColumnNames map[string]string `json:"custom_column_names"` }
TableConfiguration -
type TableSchema ¶ added in v0.1.13
TableSchema -