schema

package
v0.16.11 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

TODO: Normalize implicit things in input first, and then compare

This package has SQL parser, its abstraction and SQL generator. Never touch database.

Index

Constants

View Source
const (
	AscScr  = "asc"
	DescScr = "desc"
)

IndexColumn.direction

View Source
const (
	ValueTypeStr = ValueType(iota)
	ValueTypeInt
	ValueTypeFloat
	ValueTypeHexNum
	ValueTypeHex
	ValueTypeValArg
	ValueTypeBit
	ValueTypeBool
)
View Source
const (
	ColumnKeyNone = ColumnKeyOption(iota)
	ColumnKeyPrimary
	ColumnKeySpatialKey
	ColumnKeyUnique
	ColumnKeyUniqueKey
	ColumnKey
)
View Source
const (
	GeneratedTypeVirtual = GeneratedType(iota)
	GeneratedTypeStored
)
View Source
const (
	GeneratorModeMysql = GeneratorMode(iota)
	GeneratorModePostgres
	GeneratorModeSQLite3
	GeneratorModeMssql
)

Variables

This section is empty.

Functions

func GenerateIdempotentDDLs

func GenerateIdempotentDDLs(mode GeneratorMode, sqlParser database.Parser, desiredSQL string, currentSQL string, config database.GeneratorConfig, defaultSchema string) ([]string, error)

Parse argument DDLs and call `generateDDLs()`

Types

type AddForeignKey added in v0.4.0

type AddForeignKey struct {
	// contains filtered or unexported fields
}

func (*AddForeignKey) Statement added in v0.4.0

func (a *AddForeignKey) Statement() string

type AddIndex

type AddIndex struct {
	// contains filtered or unexported fields
}

func (*AddIndex) Statement

func (a *AddIndex) Statement() string

type AddPolicy added in v0.8.2

type AddPolicy struct {
	// contains filtered or unexported fields
}

func (*AddPolicy) Statement added in v0.8.2

func (a *AddPolicy) Statement() string

type AddPrimaryKey added in v0.3.3

type AddPrimaryKey struct {
	// contains filtered or unexported fields
}

func (*AddPrimaryKey) Statement added in v0.3.3

func (a *AddPrimaryKey) Statement() string

type CheckDefinition added in v0.10.9

type CheckDefinition struct {
	// contains filtered or unexported fields
}

type Column

type Column struct {
	// contains filtered or unexported fields
}

type ColumnKeyOption

type ColumnKeyOption int

type Comment added in v0.13.2

type Comment struct {
	// contains filtered or unexported fields
}

func (*Comment) Statement added in v0.13.2

func (t *Comment) Statement() string

type ConstraintOptions added in v0.11.24

type ConstraintOptions struct {
	// contains filtered or unexported fields
}

type CreateIndex added in v0.2.0

type CreateIndex struct {
	// contains filtered or unexported fields
}

func (*CreateIndex) Statement added in v0.2.0

func (c *CreateIndex) Statement() string

type CreateTable

type CreateTable struct {
	// contains filtered or unexported fields
}

func (*CreateTable) Statement

func (c *CreateTable) Statement() string

type DDL

type DDL interface {
	Statement() string
}

func FilterTables added in v0.12.0

func FilterTables(ddls []DDL, config database.GeneratorConfig) []DDL

func ParseDDLs added in v0.11.37

func ParseDDLs(mode GeneratorMode, sqlParser database.Parser, sql string, defaultSchema string) ([]DDL, error)

Parse `ddls`, which is expected to `;`-concatenated DDLs and not to include destructive DDL.

type DefaultDefinition added in v0.10.4

type DefaultDefinition struct {
	// contains filtered or unexported fields
}

type Extension added in v0.13.12

type Extension struct {
	// contains filtered or unexported fields
}

func (*Extension) Statement added in v0.13.12

func (t *Extension) Statement() string

type ForeignKey added in v0.4.0

type ForeignKey struct {
	// contains filtered or unexported fields
}

type Generated added in v0.15.10

type Generated struct {
	// contains filtered or unexported fields
}

type GeneratedType added in v0.15.10

type GeneratedType int

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

This struct holds simulated schema states during GenerateIdempotentDDLs().

type GeneratorMode added in v0.2.0

type GeneratorMode int

type Identity added in v0.10.14

type Identity struct {
	// contains filtered or unexported fields
}

type Index

type Index struct {
	// contains filtered or unexported fields
}

type IndexColumn

type IndexColumn struct {
	// contains filtered or unexported fields
}

type IndexOption added in v0.10.6

type IndexOption struct {
	// contains filtered or unexported fields
}

type IndexPartition added in v0.10.12

type IndexPartition struct {
	// contains filtered or unexported fields
}

type Policy added in v0.8.2

type Policy struct {
	// contains filtered or unexported fields
}

type Sequence added in v0.9.2

type Sequence struct {
	Name        string
	IfNotExists bool
	Type        string
	IncrementBy *int
	MinValue    *int
	NoMinValue  bool
	MaxValue    *int
	NoMaxValue  bool
	StartWith   *int
	Cache       *int
	Cycle       bool
	NoCycle     bool
	OwnedBy     string
}

type SridDefinition added in v0.14.2

type SridDefinition struct {
	// contains filtered or unexported fields
}

type Table

type Table struct {
	// contains filtered or unexported fields
}

func (*Table) PrimaryKey added in v0.4.9

func (t *Table) PrimaryKey() *Index

type Trigger added in v0.10.16

type Trigger struct {
	// contains filtered or unexported fields
}

func (*Trigger) Statement added in v0.10.16

func (t *Trigger) Statement() string

type Type added in v0.11.14

type Type struct {
	// contains filtered or unexported fields
}

TODO: include type information

func (*Type) Statement added in v0.11.14

func (t *Type) Statement() string

type Value

type Value struct {
	// contains filtered or unexported fields
}

type ValueType

type ValueType int

type View added in v0.8.0

type View struct {
	// contains filtered or unexported fields
}

func (*View) Statement added in v0.8.0

func (v *View) Statement() string

Jump to

Keyboard shortcuts

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