schema

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TypeID string = "ID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

type Schema struct {
	SchemaDoc schemaType
	// contains filtered or unexported fields
}

Schema data stucture for schema package

func Init

func Init(crud *crud.Module, removeProjectScope bool) *Schema

Init creates a new instance of the schema object

func (*Schema) CheckIfEventingIsPossible added in v0.15.3

func (s *Schema) CheckIfEventingIsPossible(dbAlias, col string, obj map[string]interface{}, isFind bool) (findForUpdate map[string]interface{}, present bool)

func (*Schema) GetCollectionSchema

func (s *Schema) GetCollectionSchema(ctx context.Context, project, dbType string) (map[string]*config.TableRule, error)

GetCollectionSchema returns schemas of collection aka tables for specified project & database

func (*Schema) GetSchema added in v0.14.0

func (s *Schema) GetSchema(dbType, col string) (SchemaFields, bool)

func (*Schema) Inspector

func (s *Schema) Inspector(ctx context.Context, dbType, project, col string) (schemaCollection, error)

Inspector generates schema

func (*Schema) SchemaCreation

func (s *Schema) SchemaCreation(ctx context.Context, dbAlias, tableName, project string, parsedSchema schemaType) error

SchemaCreation creates or alters tables of sql

func (*Schema) SchemaInspection

func (s *Schema) SchemaInspection(ctx context.Context, dbAlias, project, col string) (string, error)

SchemaInspection returns the schema in schema definition language (SDL)

func (*Schema) SchemaModifyAll

func (s *Schema) SchemaModifyAll(ctx context.Context, dbAlias, project string, tables map[string]*config.TableRule) error

SchemaModifyAll modifies all the tables provided

func (*Schema) SetConfig

func (s *Schema) SetConfig(conf config.Crud, project string) error

SetConfig modifies the tables according to the schema on save

func (*Schema) ValidateCreateOperation

func (s *Schema) ValidateCreateOperation(dbType, col string, req *model.CreateRequest) error

ValidateCreateOperation validates schema on create operation

func (*Schema) ValidateUpdateOperation

func (s *Schema) ValidateUpdateOperation(dbType, col, op string, updateDoc, find map[string]interface{}) error

ValidateUpdateOperation validates the types of schema during a update request

type SchemaFieldType added in v0.14.0

type SchemaFieldType struct {
	FieldName           string
	IsFieldTypeRequired bool
	IsList              bool
	Kind                string

	// For directives
	IsPrimary   bool
	IsIndex     bool
	IsUnique    bool
	IsCreatedAt bool
	IsUpdatedAt bool
	IsLinked    bool
	IsForeign   bool
	IsDefault   bool
	IndexInfo   *TableProperties
	LinkedTable *TableProperties
	JointTable  *TableProperties
	Default     interface{}
	// contains filtered or unexported fields
}

type SchemaFields added in v0.14.0

type SchemaFields map[string]*SchemaFieldType // key is field name

type TableProperties added in v0.14.0

type TableProperties struct {
	From, To     string
	Table, Field string
	DBType       string
	Group, Sort  string
	Order        int
}

Jump to

Keyboard shortcuts

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