models

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeEnum represents a MySQL enum type. This is because ENUMS are not a real type in MySQL, they are just a list of strings.
	TypeEnum = "enum"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name             string
	Type             string
	TypeSize         int
	TypePrecision    int
	Default          any
	HasDefault       bool
	Nullable         bool
	AutoIncrementing bool
	ZeroFilled       bool
	Binary           bool
	Unsigned         bool
	InPrimaryKey     bool
	InUniqueKey      bool
	Comment          string
	Elements         []string
}

Column represents a MySQL column definition

type Constraint

type Constraint struct {
	Name           string
	ReferenceTable string
	References     map[string]string
	Comment        string
}

Constraint represents a MySQL foreign key constraint

type FunctionCall

type FunctionCall string

FunctionCall represents a MySQL function call

type Key

type Key struct {
	Name    string
	Type    string
	Columns []*Column
	Comment string
}

Key represents a MySQL key (primary, unique, index, etc)

type Table

type Table struct {
	Name    string
	Columns []*Column

	PrimaryKey  *Key
	Keys        []Key
	Constraints []Constraint
	Comment     string
	// contains filtered or unexported fields
}

Table represents a MySQL table definition

func NewTable

func NewTable(ct *ast.CreateTableStmt) (*Table, error)

NewTable returns a Table struct representing the result of a MySQL CREATE TABLE statement

Jump to

Keyboard shortcuts

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