metadata

package
v0.0.0-...-f64704c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTables

func CreateTables() (result bool, err error)

CreateTables Create the Metadata table

func DeleteAllTableMetadata

func DeleteAllTableMetadata(name string) (err error)

DeleteAllTableMetadata Delete all of a Table's metadata.

func DeleteAllTargetDBMetadata

func DeleteAllTargetDBMetadata() (err error)

DeleteAllTargetDBMetadata Delete all of a Table's metadata. Intended for sandbox use.

func MarkNonExistAllTableMetadata

func MarkNonExistAllTableMetadata(name string) (err error)

MarkNonExistAllTableMetadata Delete all of a Table's metadata.

func SetTableExists

func SetTableExists(name string) (err error)

SetTableExists Set all fields on the table to exist

func Setup

func Setup(db *gorp.DbMap, targetDatabaseID int)

Setup Setup the Metadata table in the management DB

func TableRegistered

func TableRegistered(name string) (reg bool, err error)

TableRegistered Returns a boolean indicating that the Table named 'name' is registered in the Metadata table

func UpdateCache

func UpdateCache() error

UpdateCache Build a localstore of the Metadata Management DB for the target DB

func UseCache

func UseCache(state bool) (err error)

UseCache Toggle Select statements to use localcache, and update the localcache

Types

type Metadata

type Metadata struct {
	MDID       int64  `db:"mdid, autoincrement, primarykey" json:"mdid"`
	DB         int    `db:"db" json:"db"`
	PropertyID string `db:"property_id" json:"property_id"`
	ParentID   string `db:"parent_id" json:"parent_id"`
	Type       string `db:"type" json:"type"`
	Name       string `db:"name" json:"name"`
	Exists     bool   `db:"exists" json:"exists"`
}

Metadata This struct stores the identification information for each table and table field in the target database. This data is used to match the schema of the target database to the YAML schema

func GetByName

func GetByName(name string, parentID string) (md Metadata, err error)

GetByName Get a metadata object from the database with name

func GetTableByName

func GetTableByName(name string) (md Metadata, err error)

GetTableByName Get a Table metadata object from the database by name

func Load

func Load(mdid int64) (m *Metadata, err error)

Load Uses the valud of MDID to load from the Management DB

func LoadAllTableMetadata

func LoadAllTableMetadata(name string) (md []Metadata, err error)

LoadAllTableMetadata Load all of the Metadata rows for a table with the matching Property and Database IDs

func (*Metadata) Delete

func (m *Metadata) Delete() (err error)

Delete Remove the Metadata from the database

func (*Metadata) Insert

func (m *Metadata) Insert() error

Insert Insert the Metadata into the Management DB

func (*Metadata) IsTable

func (m *Metadata) IsTable() bool

IsTable Returns if there is a value for ParentID. If empty the property is a table.

func (*Metadata) OnCreate

func (m *Metadata) OnCreate() error

OnCreate Check if the Metadata is known to the database yet. Depends on MDID being set != 0

func (Metadata) ToDBRow

func (m Metadata) ToDBRow() test.DBRow

ToDBRow Used to convert the Metadata into a unit test DBRow

func (*Metadata) Update

func (m *Metadata) Update() (err error)

Update Update the Metadata in the Management DB

Jump to

Keyboard shortcuts

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