Documentation
¶
Index ¶
- Constants
- func BuildTable(schema, table string) string
- func ConvertNullableTextToBool(isNullableStr string) bool
- func DedupeSlice(input []string) []string
- func GetUniqueSchemaColMappings(schemas []*DatabaseSchemaRow) map[string]map[string]*ColumnInfo
- func Ptr[T any](val T) *T
- func SplitTableKey(key string) (schema, table string)
- type AlterTableStatement
- type BatchExecOpts
- type ColumnInfo
- type ConstraintType
- type DataType
- type DatabaseSchemaRow
- type ForeignConstraint
- type ForeignKey
- type ForeignKeyConstraintsRow
- type InitSchemaStatements
- type PrimaryKey
- type SchemaTable
- type SchemaTableDataTypeResponse
- type TableConstraints
- type TableInitStatement
- type TableTrigger
Constants ¶
View Source
const ( PostgresDriver = "pgx" MysqlDriver = "mysql" MssqlDriver = "sqlserver" )
View Source
const (
DisableForeignKeyChecks = "SET FOREIGN_KEY_CHECKS = 0;"
)
Variables ¶
This section is empty.
Functions ¶
func BuildTable ¶
func DedupeSlice ¶
Dedupes the input slice and ensures consistent ordering with the input. Returns a niew slice.
func GetUniqueSchemaColMappings ¶
func GetUniqueSchemaColMappings( schemas []*DatabaseSchemaRow, ) map[string]map[string]*ColumnInfo
func SplitTableKey ¶ added in v0.4.30
Types ¶
type AlterTableStatement ¶
type AlterTableStatement struct {
Statement string
ConstraintType ConstraintType
}
type BatchExecOpts ¶
type BatchExecOpts struct {
Prefix *string // this string will be added to the start of each statement
}
type ColumnInfo ¶
type ColumnInfo struct {
OrdinalPosition int // Specifies the sequence or order in which each column is defined within the table. Starts at 1 for the first column.
ColumnDefault string // Specifies the default value for a column, if any is set.
IsNullable bool // Specifies if the column is nullable or not.
DataType string // Specifies the data type of the column, i.e., bool, varchar, int, etc.
CharacterMaximumLength *int // Specifies the maximum allowable length of the column for character-based data types. For datatypes such as integers, boolean, dates etc. this is NULL.
NumericPrecision *int // Specifies the precision for numeric data types. It represents the TOTAL count of significant digits in the whole number, that is, the number of digits to BOTH sides of the decimal point. Null for non-numeric data types.
NumericScale *int // Specifies the scale of the column for numeric data types, specifically non-integers. It represents the number of digits to the RIGHT of the decimal point. Null for non-numeric data types and integers.
IdentityGeneration *string // Specifies the identity generation strategy for the column, if applicable.
}
type ConstraintType ¶
type ConstraintType int
const ( PrimaryConstraintType ConstraintType = iota ForeignConstraintType UniqueConstraintType CheckConstraintType )
func ToConstraintType ¶
func ToConstraintType(constraintType string) (ConstraintType, error)
type DatabaseSchemaRow ¶
type DatabaseSchemaRow struct {
TableSchema string
TableName string
ColumnName string
DataType string
ColumnDefault string
ColumnDefaultType *string
IsNullable string
CharacterMaximumLength int
NumericPrecision int
NumericScale int
OrdinalPosition int
GeneratedType *string
IdentityGeneration *string
}
type ForeignConstraint ¶
type ForeignConstraint struct {
Columns []string
NotNullable []bool
ForeignKey *ForeignKey
}
type ForeignKey ¶
type InitSchemaStatements ¶ added in v0.4.30
type PrimaryKey ¶
type SchemaTable ¶
func (SchemaTable) String ¶
func (s SchemaTable) String() string
type SchemaTableDataTypeResponse ¶
type SchemaTableDataTypeResponse struct {
// Custom Sequences not tied to the SERIAL data type
Sequences []*DataType
// SQL Functions
Functions []*DataType
// actual Data Types
Composites []*DataType
Enums []*DataType
Domains []*DataType
}
These are all items that live at the schema level, but are used by tables
func (*SchemaTableDataTypeResponse) GetStatements ¶
func (s *SchemaTableDataTypeResponse) GetStatements() []string
type TableConstraints ¶
type TableInitStatement ¶
type TableInitStatement struct {
CreateTableStatement string
AlterTableStatements []*AlterTableStatement
IndexStatements []string
}
Click to show internal directories.
Click to hide internal directories.