sqlspec

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddColumn added in v0.1.0

type AddColumn struct {
	Change
	Column *Column `spec:"column"`
}

AddColumn is a specification for a schema.AddColumn.

type Change added in v0.1.0

type Change interface {
	// contains filtered or unexported methods
}

Change is the interface implemented by change specifications. Change instances are supposed to be mappable to schema.Change instances.

type Check added in v0.3.0

type Check struct {
	Name string `spec:",name"`
	Expr string `spec:"expr"`
	schemaspec.DefaultExtension
}

Check holds a specification for a check constraint on a table.

type Column

type Column struct {
	Name    string           `spec:",name"`
	Null    bool             `spec:"null"`
	Type    *schemaspec.Type `spec:"type"`
	Default schemaspec.Value `spec:"default"`
	schemaspec.DefaultExtension
}

Column holds a specification for a column in an SQL table.

type ForeignKey

type ForeignKey struct {
	Symbol     string                 `spec:",name"`
	Columns    []*schemaspec.Ref      `spec:"columns"`
	RefColumns []*schemaspec.Ref      `spec:"ref_columns"`
	OnUpdate   schema.ReferenceOption `spec:"on_update"`
	OnDelete   schema.ReferenceOption `spec:"on_delete"`
	schemaspec.DefaultExtension
}

ForeignKey holds a specification for the Foreign key of a table.

type Index

type Index struct {
	Name    string            `spec:",name"`
	Unique  bool              `spec:"unique,omitempty"`
	Parts   []*IndexPart      `spec:"on"`
	Columns []*schemaspec.Ref `spec:"columns"`
	schemaspec.DefaultExtension
}

Index holds a specification for the index key of a table.

type IndexPart added in v0.3.2

type IndexPart struct {
	Desc   bool            `spec:"desc,omitempty"`
	Column *schemaspec.Ref `spec:"column"`
	Expr   string          `spec:"expr,omitempty"`
	schemaspec.DefaultExtension
}

IndexPart holds a specification for the index key part.

type ModifyTable added in v0.1.0

type ModifyTable struct {
	Change
	Table   string   `spec:"table"`
	Changes []Change `spec:""`
}

ModifyTable is a specification for a schema.ModifyTable.

type PrimaryKey

type PrimaryKey struct {
	Columns []*schemaspec.Ref `spec:"columns"`
	schemaspec.DefaultExtension
}

PrimaryKey holds a specification for the primary key of a table.

type Schema

type Schema struct {
	Name string `spec:",name"`
	schemaspec.DefaultExtension
}

Schema holds a specification for a Schema.

type Table

type Table struct {
	Name        string          `spec:",name"`
	Schema      *schemaspec.Ref `spec:"schema"`
	Columns     []*Column       `spec:"column"`
	PrimaryKey  *PrimaryKey     `spec:"primary_key"`
	ForeignKeys []*ForeignKey   `spec:"foreign_key"`
	Indexes     []*Index        `spec:"index"`
	Checks      []*Check        `spec:"check"`
	schemaspec.DefaultExtension
}

Table holds a specification for an SQL table.

type Type

type Type string

Type represents a database agnostic column type.

Jump to

Keyboard shortcuts

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