specutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Column

func Column(spec *sqlspec.Column, conv ConvertTypeFunc) (*schema.Column, error)

Column converts a sqlspec.Column into a schema.Column.

func FromForeignKey

func FromForeignKey(s *schema.ForeignKey) (*sqlspec.ForeignKey, error)

FromForeignKey converts schema.ForeignKey to sqlspec.ForeignKey

func FromIndex

func FromIndex(idx *schema.Index) (*sqlspec.Index, error)

FromIndex converts schema.Index to sqlspec.Index

func FromPrimaryKey

func FromPrimaryKey(s *schema.Index) (*sqlspec.PrimaryKey, error)

FromPrimaryKey converts schema.Index to a sqlspec.PrimaryKey.

func FromSchema

func FromSchema(s *schema.Schema, fn TableSpecFunc) (*sqlspec.Schema, []*sqlspec.Table, error)

FromSchema converts a schema.Schema into sqlspec.Schema and []sqlspec.Table.

func FromTable

FromTable converts a schema.Table to a sqlspec.Table.

func Index

func Index(spec *sqlspec.Index, parent *schema.Table) (*schema.Index, error)

Index converts a sqlspec.Index to a schema.Index.

func ListAttr

func ListAttr(k string, litValues ...string) *schemaspec.Attr

ListAttr is a helper method for constructing *schemaspec.Attr instances that contain list values.

func LitAttr

func LitAttr(k, v string) *schemaspec.Attr

LitAttr is a helper method for constructing *schemaspec.Attr instances that contain literal values.

func NewCol

func NewCol(name, coltype string, attrs ...*schemaspec.Attr) *sqlspec.Column

NewCol is a helper method for constructing *sqlspec.Column instances.

func PrimaryKey

func PrimaryKey(spec *sqlspec.PrimaryKey, parent *schema.Table) (*schema.Index, error)

PrimaryKey converts a sqlspec.PrimaryKey to a schema.Index.

func Schema

func Schema(spec *sqlspec.Schema, tables []*sqlspec.Table, convertTable ConvertTableFunc) (*schema.Schema, error)

Schema converts a sqlspec.Schema with its relevant []sqlspec.Tables into a schema.Schema.

func Table

func Table(spec *sqlspec.Table, parent *schema.Schema, convertColumn ConvertColumnFunc,
	convertPk ConvertPrimaryKeyFunc, convertIndex ConvertIndexFunc) (*schema.Table, error)

Table converts a sqlspec.Table to a schema.Table. Table conversion is done without converting ForeignKeySpecs into ForeignKeys, as the target tables do not necessarily exist in the schema at this point. Instead, the linking is done by the Schema function.

Types

type ColumnSpecFunc

type ColumnSpecFunc func(*schema.Column) (*sqlspec.Column, error)

List of convert function types.

type ConvertColumnFunc

type ConvertColumnFunc func(*sqlspec.Column, *schema.Table) (*schema.Column, error)

List of convert function types.

type ConvertIndexFunc

type ConvertIndexFunc func(*sqlspec.Index, *schema.Table) (*schema.Index, error)

List of convert function types.

type ConvertPrimaryKeyFunc

type ConvertPrimaryKeyFunc func(*sqlspec.PrimaryKey, *schema.Table) (*schema.Index, error)

List of convert function types.

type ConvertTableFunc

type ConvertTableFunc func(*sqlspec.Table, *schema.Schema) (*schema.Table, error)

List of convert function types.

type ConvertTypeFunc

type ConvertTypeFunc func(*sqlspec.Column) (schema.Type, error)

List of convert function types.

type ForeignKeySpecFunc

type ForeignKeySpecFunc func(fk *schema.ForeignKey) (*sqlspec.ForeignKey, error)

List of convert function types.

type IndexSpecFunc

type IndexSpecFunc func(index *schema.Index) (*sqlspec.Index, error)

List of convert function types.

type PrimaryKeySpecFunc

type PrimaryKeySpecFunc func(index *schema.Index) (*sqlspec.PrimaryKey, error)

List of convert function types.

type TableSpecFunc

type TableSpecFunc func(*schema.Table) (*sqlspec.Table, error)

List of convert function types.

Jump to

Keyboard shortcuts

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