Documentation ¶
Overview ¶
Package schema is the main package of the schema definition It is responsible for creating a structure over the data, and pretends to perform validations before having to communicate
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct { Name integrity.ColumnName `json:"name,omitempty"` Validator integrity.Validator Type integrity.ValueType `json:"type,omitempty"` }
A Column is the representation of SQL column which defines the structure of the fields that is contains.
type GoldenColumns ¶
type GoldenColumns struct { Foo *Column `json:"foo,omitempty"` Bar *Column `json:"bar,omitempty"` Zero *Column `json:"zero,omitempty"` }
GoldenColumns is the golden file decoder for the columns. Exposed to serve to git integration tests
type GoldenSchemas ¶
type GoldenSchemas struct { Foo *Schema `json:"foo,omitempty"` Bar *Schema `json:"bar,omitempty"` FooBar *Schema `json:"foo_bar,omitempty"` Zero *Schema `json:"zero,omitempty"` }
GoldenSchemas is the golden file decoder for the schemas. Exposed to serve to git integration tests
type GoldenTables ¶
type GoldenTables struct { Foo *Table `json:"foo,omitempty"` Bar *Table `json:"bar,omitempty"` FooBar *Table `json:"foo_bar,omitempty"` Zero *Table `json:"zero,omitempty"` }
GoldenTables is the golden file decoder for the tables. Exposed to serve to git integration tests
type Planisphere ¶
type Planisphere []*Schema
A Planisphere describes the scope in which the gSchemas will be searched in
func (Planisphere) GetSchemaFromName ¶
func (psph Planisphere) GetSchemaFromName(schemaName integrity.SchemaName) (*Schema, error)
GetSchemaFromName retrieves the schema assigned to the name and checks if it exists and is of the desired kind
type Schema ¶
type Schema struct { Id int64 `json:"id,omitempty"` Name integrity.SchemaName `json:"name,omitempty"` Blueprint []*Table `json:"blueprint,omitempty"` }
The Schema is the representation of a Database instructive. It uses concepts of SQL. It provides the validation and construction structure.
func FromFilename ¶
FromFilename retrieves a schema with the decoded data of the given filename Notice that the filename can be a remote url
func (*Schema) ValidateCtx ¶
func (sch *Schema) ValidateCtx( tableName integrity.TableName, colName integrity.ColumnName, optionKeys []integrity.OptionKey, val interface{}, helperScope *Planisphere, wg *sync.WaitGroup, errCh chan<- error, )
ValidateCtx checks if the context of the given tableName and colName is valid Notice that, as well as the wrapper validations should provoke a chained of undesired (and maybe more confusing than clear) errs, the errCh should be buffered w/sz=1
func (*Schema) ValidateSelf ¶
ValidateSelf performs a deep self-validation to check data integrity It wraps internal method validateSelf
type Table ¶
type Table struct { Name integrity.TableName `json:"name,omitempty"` Columns []*Column `json:"columns,omitempty"` OptionKeys []integrity.OptionKey `json:"option_keys,omitempty"` }
A Table is the representation of SQL table (or Mongo/CQL Collections) which acts as a collection of entities.