Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct { // Unique column name within a table Name string // Generic data type definition Type DataType // Internal name of the data type (with lenght) InternalType string // Weather this column is a primary key of the table PrimaryKey bool // Weather this column references another table ForeignKey bool // Table to which this column has a reference to ForeignKeyColumn ForeignColumn // Weather this column can be null CanBeNull bool // A default value of the column DefaultValue sql.NullString // Comment of this column Comment string // Extras Extras Columner }
Column of a table. Every database system has a own column struct that embeds this type and extends it with database specific informations
type Columner ¶
type Columner interface { // GetExtraInfos returns a string with additional properties that is passed // to the struct tag "Db" when using the struct generator GetExtraInfos() string // GetSpecificInfos returns the underlaying GetSpecificInfos() any }
Columner returns additonal informations to a column that are specific for a SQL system
type DbSystem ¶
type DbSystem interface { // GetTable returns a single table identified by the schema and name GetTable(schema, name string) (*Table, error) // GeTables returns a list of tables that are present in the provided schema // or database GetTables(schema string) ([]*Table, error) }
DbSystem has to be implemented by every single database system that is supported by the module to fetch a list of tables and columns
func NewMariaDb ¶
NewMariaDb initializes a new database parser for a MariaDB database
type ForeignColumn ¶
type ForeignColumn struct { // Name of the referenced table Name string // Schema or database the table belongs to Schema string // Name of the column that is referenced Column string }
ForeignColumn contains information to which the column points to with an foreign key
type Location ¶
Location is a database type that stores a geographic point on the earth with a longitude and latitude. It can currently only used for Mariadb!
type Mariadb ¶
type Mariadb struct {
// contains filtered or unexported fields
}
Mariadb implements "DbSystem" for a MariaDB database
func (*Mariadb) GetDataType ¶
type MariadbColumn ¶
type MariadbColumn struct { *Column // Weather this column has the auto_increment flag AutoIncrement bool // The character lenght or numeric precision DataTypeLenght int // The internal column key like 'UNI' or 'PRI' KeyType MariadbKeyType }
func (*MariadbColumn) GetExtraInfos ¶
func (c *MariadbColumn) GetExtraInfos() string
func (*MariadbColumn) GetSpecificInfos ¶
func (c *MariadbColumn) GetSpecificInfos() any
type MariadbKeyType ¶
type MariadbKeyType string
const ( // Primary key MariadbKeyPrimary MariadbKeyType = "PRI" // Unique index MariadbKeyUnique MariadbKeyType = "UNI" // Nonunique index MariadbKeyMultipleIndex MariadbKeyType = "MUL" )
type OracleColumn ¶
type OracleColumn struct { *Column // Weather this column has the auto_increment flag AutoIncrement bool // Character lenght or numeric precision on the LEFT side // of the dot DataTypeLenght int // Decimal precision on the RIGHT side of the dot Scale int }
func (*OracleColumn) GetExtraInfos ¶
func (c *OracleColumn) GetExtraInfos() string
func (*OracleColumn) GetSpecificInfos ¶
func (c *OracleColumn) GetSpecificInfos() any
type OracleDb ¶
type OracleDb struct {
// contains filtered or unexported fields
}
OracleDb implements "DbSystem" for an oracle database
func NewOracleDb ¶
NewMariaDb initializes a new database parser for an oracle database
func (*OracleDb) GetDataType ¶
func (s *OracleDb) GetDataType(internalType string, col *OracleColumn) DataType
func (*OracleDb) GetTablesByType ¶
func (s *OracleDb) GetTablesByType(schema string, typ OracleTableType) ([]*Table, error)
type OracleTableType ¶
type OracleTableType string
const ( OracleTable OracleTableType = "TABLE" OracleView OracleTableType = "VIEW" )