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
- type AlterTableStatement
- type BatchExecOpts
- type ColumnInfo
- type ConstraintType
- type DataType
- type DatabaseSchemaRow
- type ForeignConstraint
- type ForeignKey
- type ForeignKeyConstraintsRow
- type PrimaryKey
- type SchemaTable
- type SchemaTableDataTypeResponse
- type TableConstraints
- type TableInitStatement
- type TableTrigger
Constants ¶
View Source
const ( PostgresDriver = "postgres" MysqlDriver = "mysql" )
View Source
const (
DisableForeignKeyChecks = "SET FOREIGN_KEY_CHECKS = 0;"
)
Variables ¶
This section is empty.
Functions ¶
func BuildTable ¶
func DedupeSlice ¶
func GetUniqueSchemaColMappings ¶
func GetUniqueSchemaColMappings( schemas []*DatabaseSchemaRow, ) map[string]map[string]*ColumnInfo
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 int32 // 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 *int32 // 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 *int32 // 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 *int32 // 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. }
type ConstraintType ¶
type ConstraintType int
const ( PrimaryConstraintType ConstraintType = iota ForeignConstraintType UniqueConstraintType CheckConstraintType )
func ToConstraintType ¶
func ToConstraintType(constraintType string) (ConstraintType, error)
type DatabaseSchemaRow ¶
type ForeignConstraint ¶
type ForeignConstraint struct { Columns []string NotNullable []bool ForeignKey *ForeignKey }
type ForeignKey ¶
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.