ddl

package
v2.0.0-...-d0a62a6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEngine    = "INNODB"
	DefaultCharset   = "utf8mb4"
	DefaultCollation = "utf8mb4_unicode_ci"
)
View Source
var Engine = "mysql"
View Source
var EngineDataTypes = map[string]map[string]string{
	"mariadb": {"json": "longtext"},
}
View Source
var InternalFunctions = [][]string{
	{"CURRENT_TIMESTAMP", "CURRENT_TIMESTAMP()", "current_timestamp()", "current_timestamp", "NOW()", "now()", "CURRENT_DATE", "CURRENT_DATE()", "current_date", "current_date()"},
	{"NULL", "null"},
}

Functions

func GetCharset

func GetCharset(statement *gorm.Statement) string

func GetCollate

func GetCollate(statement *gorm.Statement) string

func GetEngine

func GetEngine(statement *gorm.Statement) string

Types

type Column

type Column struct {
	Name       string
	Nullable   bool
	PrimaryKey bool
	//Size          int
	Scale         int
	Precision     int
	Type          string
	Default       string
	AutoIncrement bool
	Unique        bool
	Comment       string
	Charset       string
	OnUpdate      string
	Collate       string
	ForeignKey    string
	After         string
}

type Columns

type Columns []Column

func (Columns) Find

func (list Columns) Find(name string) *Column

func (Columns) Keys

func (list Columns) Keys() []string

type Index

type Index struct {
	Name    string
	Unique  bool
	Columns Columns
}

type Indexes

type Indexes []Index

func (Indexes) Find

func (list Indexes) Find(name string) *Index

type Table

type Table struct {
	Columns     Columns
	PrimaryKey  Columns
	Index       Indexes
	Constraints []string
	Engine      string
	Name        string
	Charset     string
	Collate     string
}

func FromStatement

func FromStatement(stmt *gorm.Statement) Table

func (Table) Constrains

func (local Table) Constrains(constraints []table.Constraint, is table.Tables) []string

func (Table) GetCreateQuery

func (table Table) GetCreateQuery() []string

func (Table) GetDiff

func (local Table) GetDiff(remote table.Table) []string

Jump to

Keyboard shortcuts

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