Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentDatabaseName ¶
GetCurrentDatabaseName returns currrent database schema name as string
func Register ¶
func Register(pluginName string, pluginInterface SubstanceProviderInterface)
Register registers a sbustance plugin which implements the Substance interface
Types ¶
type ColumnConstraint ¶
ColumnConstraint Struct to store column constraint types
func DescribeTableConstraints ¶
func DescribeTableConstraints(dbType string, db *sql.DB, tableName string) ([]*ColumnConstraint, error)
DescribeTableConstraints returns all column constraints in a database table
type ColumnDescription ¶
type ColumnDescription struct { DatabaseName string TableName string PropertyName string PropertyType string KeyType string DefaultValue string Nullable bool }
ColumnDescription Structure to store properties of each column in a table
func DescribeDatabase ¶
func DescribeDatabase(dbType string, db *sql.DB) ([]*ColumnDescription, error)
DescribeDatabase returns tables in database
func DescribeTable ¶
DescribeTable returns columns of a table
type ColumnRelationship ¶
type ColumnRelationship struct { TableName string ColumnName string ReferenceTableName string ReferenceColumnName string }
ColumnRelationship Structure to store relationships between tables
func DescribeTableRelationship ¶
func DescribeTableRelationship(dbType string, db *sql.DB, tableName string) ([]*ColumnRelationship, error)
DescribeTableRelationship returns all foreign column references in database table
type QueryResult ¶
type QueryResult struct { Rows *sql.Rows Columns []string Values []interface{} ScanArgs []interface{} Err error }
QueryResult Struct to store results from ExecuteQuery
func ExecuteQuery ¶
ExecuteQuery executes a sql query with one or no tableName, specific to mysqlsubstnace and pgsqlsubstance
type SubstanceProviderInterface ¶
type SubstanceProviderInterface interface { DatabaseName(dbType string, db *sql.DB) (string, error) DescribeDatabase(dbType string, db *sql.DB) ([]*ColumnDescription, error) DescribeTable(dbType string, db *sql.DB, tableName string) ([]*ColumnDescription, error) TableRelationships(dbType string, db *sql.DB, tableName string) ([]*ColumnRelationship, error) TableConstraints(dbType string, db *sql.DB, tableName string) ([]*ColumnConstraint, error) ToGoDataType(sqlType string) (string, error) }
SubstanceProviderInterface