model

package
v0.0.0-...-6712ec0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package model contains the metadata structure used for generating data dictionaries along the the functions for initializing the metadata structure and loading (from go-db-mata), transforming, and retrieving that metadata

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckConstraint

type CheckConstraint struct {
	DBName      string
	SchemaName  string
	TableName   string
	Name        string
	CheckClause string
	Status      string
	Comment     string
}

CheckConstraint contains the metadata for a check constraint

type Column

type Column struct {
	DBName          string
	SchemaName      string
	TableName       string
	Name            string
	OrdinalPosition int32
	IsNullable      string
	DataType        string
	Default         string
	DomainDBName    string
	DomainSchema    string
	DomainName      string
	Comment         string
}

Column contains the metadata for a table/view column

type Dependency

type Dependency struct {
	DBName          string
	ObjectSchema    string
	ObjectName      string
	ObjectOwner     string
	ObjectType      string
	IsLinkable      bool
	DepDBName       string
	DepObjectSchema string
	DepObjectName   string
	DepObjectOwner  string
	DepObjectType   string
	DepIsLinkable   bool
}

Dependency contains the metadata for a database object dependency

type Domain

type Domain struct {
	DBName     string
	SchemaName string
	Name       string
	Owner      string
	DataType   string
	Default    string
	Comment    string
}

Domain contains the metadata for a user defined domain

type ForeignKey

type ForeignKey struct {
	DBName            string
	SchemaName        string
	TableName         string
	TableColumns      string
	Name              string
	RefDBName         string
	RefSchemaName     string
	RefTableName      string
	RefTableColumns   string
	RefConstraintName string
	MatchOption       string
	UpdateRule        string
	DeleteRule        string
	IsEnforced        string
	IsIndexed         string
	Comment           string
}

ForeignKey contains the metadata for a foreign key constraint

type Index

type Index struct {
	DBName       string
	SchemaName   string
	Name         string
	IndexType    string
	IndexColumns string
	TableSchema  string
	TableName    string
	IsUnique     string
	Comment      string
}

Index contains the metadata for an index

type MetaData

type MetaData struct {
	TmspGenerated     string
	DBEngine          string
	CommentsFormat    string
	OutputDir         string
	File              string
	Version           string
	CharacterSet      string
	Name              string
	Alias             string
	Owner             string
	Comment           string
	Cfg               config.Config
	Schemas           []Schema
	Tables            []Table
	Columns           []Column
	Domains           []Domain
	Indexes           []Index
	CheckConstraints  []CheckConstraint
	UniqueConstraints []UniqueConstraint
	ForeignKeys       []ForeignKey
	PrimaryKeys       []PrimaryKey
	Dependencies      []Dependency
	Dependents        []Dependency
	UserTypes         []UserType
}

MetaData is the metadata structure used for generating a data dictionary

func Init

func Init(cfg config.Config) *MetaData

Init initializes, and returns, a dictionary metadata structure

func (*MetaData) FindCheckConstraints

func (md *MetaData) FindCheckConstraints(schemaName string, tableName string) (d []CheckConstraint)

FindCheckConstraints returns the check contraint metadata that matches the specified schema/table name. If no schema is specified then all check constraints are returned. If only the schema is specified then all check constraints for that schema are returned.

func (*MetaData) FindChildKeys

func (md *MetaData) FindChildKeys(schemaName string, tableName string) (d []ForeignKey)

FindChildKeys returns the foreign key contraint metadata for all child tables of the specified schema/table name. If no schema is specified then all foreign key constraints are returned. If only the schema is specified then all foreign keys for the child tables for that schema are returned.

func (*MetaData) FindColumns

func (md *MetaData) FindColumns(schemaName string, tableName string) (d []Column)

FindColumns returns the column metadata that matches the specified schema/table name. If no schema is specified then all columns are returned. If only the schema is specified then all columns for that schema are returned.

func (*MetaData) FindDependencies

func (md *MetaData) FindDependencies(schemaName string, objectName string) (d []Dependency)

FindDependencies returns the object metadata that the specified schema/object is dependent on. If no schema is specified then all dependencies are returned. If only the schema is specified then all dependencies for objects in that schema are returned.

func (*MetaData) FindDependents

func (md *MetaData) FindDependents(schemaName string, objectName string) (d []Dependency)

FindDependents returns the object metadata for the database objects that depend on the specified schema/object. If no schema is specified then all dependencies are returned. If only the schema is specified then all objects that depend on objects in that schema are returned.

func (*MetaData) FindDomains

func (md *MetaData) FindDomains(schemaName string) (d []Domain)

FindDomains returns the user-defined domain metadata that matches the specified schema. If no schema is specified then all user-defined domains are returned.

func (*MetaData) FindIndexes

func (md *MetaData) FindIndexes(schemaName string, tableName string) (d []Index)

FindIndexes returns the index metadata that matches the specified schema/table name. If no schema is specified then all indices are returned. If only the schema is specified then all indices for that schema are returned.

func (*MetaData) FindParentKeys

func (md *MetaData) FindParentKeys(schemaName string, tableName string) (d []ForeignKey)

FindParentKeys returns the foreign key contraint metadata for all parent keys that match the specified schema/table name. If no schema is specified then all foreign key are returned. If only the schema is specified then all foreign key constraints for that parent tables for that schema are returned.

func (*MetaData) FindPrimaryKeys

func (md *MetaData) FindPrimaryKeys(schemaName string, tableName string) (d []PrimaryKey)

FindPrimaryKeys returns the primary key contraint metadata that matches the specified schema/table name. If no schema is specified then all primary key constraints are returned. If only the schema is specified then all primary key constraints for that schema are returned.

func (*MetaData) FindTables

func (md *MetaData) FindTables(schemaName string) (d []Table)

FindTables returns the table metadata that matches the specified schema. If no schema is specified then all tables are returned.

func (*MetaData) FindUniqueConstraints

func (md *MetaData) FindUniqueConstraints(schemaName string, tableName string) (d []UniqueConstraint)

FindUniqueConstraints returns the unique contraint metadata that matches the specified schema/table name. If no schema is specified then all unique constraints are returned. If only the schema is specified then all unique constraints for that schema are returned.

func (*MetaData) FindUserTypes

func (md *MetaData) FindUserTypes(schemaName string) (d []UserType)

FindUserTypes returns the user-defined datatype metadata that matches the specified schema. If no schema is specified then all user-defined datatypes are returned.

func (*MetaData) LoadCatalog

func (md *MetaData) LoadCatalog(x *m.Catalog)

LoadCatalog loads the catalog information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadCheckConstraints

func (md *MetaData) LoadCheckConstraints(x *[]m.CheckConstraint)

LoadCheckConstraints loads the check constraint information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadColumns

func (md *MetaData) LoadColumns(x *[]m.Column)

LoadColumns loads the column information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadDependencies

func (md *MetaData) LoadDependencies(x *[]m.Dependency)

LoadDependencies loads the object dependency information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadDomains

func (md *MetaData) LoadDomains(x *[]m.Domain)

LoadDomains loads the user defined domain information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadForeignKeys

func (md *MetaData) LoadForeignKeys(x *[]m.ReferentialConstraint)

LoadForeignKeys loads the foreign key relationship information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadIndexes

func (md *MetaData) LoadIndexes(x *[]m.Index)

LoadIndexes loads the index information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadPrimaryKeys

func (md *MetaData) LoadPrimaryKeys(x *[]m.PrimaryKey)

LoadPrimaryKeys loads the primary key information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadSchemas

func (md *MetaData) LoadSchemas(x *[]m.Schema)

LoadSchemas loads the schema information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadTables

func (md *MetaData) LoadTables(x *[]m.Table)

LoadTables loads the table information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadUniqueConstraints

func (md *MetaData) LoadUniqueConstraints(x *[]m.UniqueConstraint)

LoadUniqueConstraints loads the unique constraint information from go-db-meta into the dictionary metadata structure

func (*MetaData) LoadUserTypes

func (md *MetaData) LoadUserTypes(x *[]m.Type)

LoadUserTypes loads the user defined datatype information from go-db-meta into the dictionary metadata structure

func (*MetaData) SortCheckConstraints

func (md *MetaData) SortCheckConstraints(x []CheckConstraint)

SortCheckConstraints sets the default sort order for a list of check constraints

func (*MetaData) SortColumns

func (md *MetaData) SortColumns(x []Column)

SortColumns sets the default sort order for a list of columns

func (*MetaData) SortDependencies

func (md *MetaData) SortDependencies(x []Dependency)

SortDependencies sets the default sort order for a list of object dependencies

func (*MetaData) SortDomains

func (md *MetaData) SortDomains(x []Domain)

SortDomains sets the default sort order for a list of domains

func (*MetaData) SortForeignKeys

func (md *MetaData) SortForeignKeys(x []ForeignKey)

SortForeignKeys sets the default sort order for a list of foreign key constraints

func (*MetaData) SortIndexes

func (md *MetaData) SortIndexes(x []Index)

SortIndexes sets the default sort order for a list of indices

func (*MetaData) SortSchemas

func (md *MetaData) SortSchemas(x []Schema)

SortSchemas sets the default sort order for a list of schemas

func (*MetaData) SortTables

func (md *MetaData) SortTables(x []Table)

SortTables sets the default sort order for a list of tables

func (*MetaData) SortUniqueConstraints

func (md *MetaData) SortUniqueConstraints(x []UniqueConstraint)

SortUniqueConstraints sets the default sort order for a list of unique constraints

type PrimaryKey

type PrimaryKey struct {
	DBName     string
	SchemaName string
	TableName  string
	Name       string
	Columns    string
	Status     string
	Comment    string
}

PrimaryKey contains the metadata for a primary key

type Schema

type Schema struct {
	DBName       string
	Name         string
	Owner        string
	CharacterSet string
	Comment      string
}

Schema contains the (high level) metadata for a schema

type Table

type Table struct {
	DBName     string
	SchemaName string
	Name       string
	Owner      string
	TableType  string
	RowCount   int64
	Comment    string
	Query      string
}

Table contains the (hight level) metadata for a table/view/materialized view. Other attributes (i.e. columns, indices, etc.) will have their own metadata structures.

type UniqueConstraint

type UniqueConstraint struct {
	DBName     string
	SchemaName string
	TableName  string
	Name       string
	Columns    string
	Status     string
	Comment    string
}

UniqueConstraint contains the metadata for a unique constraint

type UserType

type UserType struct {
	DBName     string
	SchemaName string
	Name       string
	Owner      string
	//DataType    string
	Comment string
}

UserType contains the metadata for a user defined datatype

Jump to

Keyboard shortcuts

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