Documentation ¶
Index ¶
- Constants
- Variables
- type Database
- func (d *Database) DumpAll()
- func (d *Database) GetConfigString(key string) (string, error)
- func (d *Database) GetTable(name string) (Table, error)
- func (d *Database) GetTableDataDir(table Table) string
- func (d *Database) GetTables() map[string]Table
- func (d *Database) Insert(table Table, record map[string]interface{}) error
- func (d *Database) LoadConfig() error
- func (d *Database) MarshalJSON() ([]byte, error)
- func (d *Database) ReferentialIntegrity() error
- func (d *Database) RegisterTables(cueString string) error
- type Model
- type ModelV1Metadata
- type SchemaV1Metadata
- type Table
- func (t *Table) CueDataPath() cue.Path
- func (t *Table) CuePath() cue.Path
- func (t *Table) Directory() string
- func (t *Table) GetDefPath() cue.Path
- func (t *Table) GetSupportedExtensions() []string
- func (t *Table) ID() string
- func (t *Table) InlinePath() string
- func (t *Table) IsSupportedExtension(ext string) bool
Constants ¶
const ModelV1MetadataCue = `
{
_model: {
plural: string
supportedExtensions: [...string]
}
}
`
const SchemaV1MetadataCue = `
{
_schema: {
namespace: string
name: string
}
}
`
SchemaV1MetadataCue is the cue representation of SchemaV1Metadata
Variables ¶
var BaseConfig string
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is the "world" struct. We can "insert" records into it and know immediately if they're valid or not.
func NewDatabase ¶
NewDatabase creates a "world" struct to store records
func (*Database) GetTableDataDir ¶
func (*Database) LoadConfig ¶
func (*Database) MarshalJSON ¶
MarshalJSON returns the database encoded in JSON format
func (*Database) ReferentialIntegrity ¶
ReferentialIntegrity checks the relationships between the records in the content database
func (*Database) RegisterTables ¶
RegisterTables ensures that the cueString schema is a valid schema and parses the Cue to find Models within. Each Model is registered as a Table, provided the name is available.
type ModelV1Metadata ¶
V1_MODEL is the cue representation of Model metadata
func GetV1Model ¶
func GetV1Model(schema cue.Value) (ModelV1Metadata, error)
GetV1Model returns the V1_MODEL information from a cue.Value
type SchemaV1Metadata ¶
SchemaV1Metadata stores information about the schema that is shared
func GetSchemaV1Metadata ¶
func GetSchemaV1Metadata(schema cue.Value) (SchemaV1Metadata, error)
GetSchemaV1Metadata returns the metadata for a cue.Value
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a schema record