schema

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name          string
	Type          Type
	PrimaryKey    bool
	AutoIncrement bool
	Nullable      bool
}

Column represents table column with parameters.

func (Column) BuildSQL

func (c Column) BuildSQL(d gosql.Dialect) (string, error)

BuildSQL returns SQL in specified dialect.

type CreateIndex

type CreateIndex struct {
	Table      string
	Expression string
	Columns    []string
	Unique     bool
	Strict     bool
}

func (CreateIndex) BuildApply

func (q CreateIndex) BuildApply(d gosql.Dialect) (string, error)

BuildApply returns create SQL query in specified dialect.

func (CreateIndex) BuildUnapply

func (q CreateIndex) BuildUnapply(d gosql.Dialect) (string, error)

type CreateTable

type CreateTable struct {
	Name        string
	Columns     []Column
	ForeignKeys []ForeignKey
	Strict      bool
}

CreateTable represents create table query.

func (CreateTable) BuildApply

func (q CreateTable) BuildApply(d gosql.Dialect) (string, error)

BuildApply returns create SQL query in specified dialect.

func (CreateTable) BuildUnapply

func (q CreateTable) BuildUnapply(d gosql.Dialect) (string, error)

type ForeignKey

type ForeignKey struct {
	Column       string
	ParentTable  string
	ParentColumn string
}

type Operation

type Operation interface {
	BuildApply(gosql.Dialect) (string, error)
	BuildUnapply(gosql.Dialect) (string, error)
}

type Type

type Type int

Type represents type of column.

const (
	// Int64 represents golang int64 type in SQL.
	Int64 Type = 1 + iota
	// String represents golang string type in SQL.
	String
	// JSON represents models.JSON type in SQL.
	JSON
)

Jump to

Keyboard shortcuts

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