Documentation ¶
Index ¶
- func Column(spec *sqlspec.Column, conv ConvertTypeFunc) (*schema.Column, error)
- func FromForeignKey(s *schema.ForeignKey) (*sqlspec.ForeignKey, error)
- func FromIndex(idx *schema.Index) (*sqlspec.Index, error)
- func FromPrimaryKey(s *schema.Index) (*sqlspec.PrimaryKey, error)
- func FromSchema(s *schema.Schema, fn TableSpecFunc) (*sqlspec.Schema, []*sqlspec.Table, error)
- func FromTable(t *schema.Table, colFn ColumnSpecFunc, pkFn PrimaryKeySpecFunc, ...) (*sqlspec.Table, error)
- func Index(spec *sqlspec.Index, parent *schema.Table) (*schema.Index, error)
- func ListAttr(k string, litValues ...string) *schemaspec.Attr
- func LitAttr(k, v string) *schemaspec.Attr
- func NewCol(name, coltype string, attrs ...*schemaspec.Attr) *sqlspec.Column
- func PrimaryKey(spec *sqlspec.PrimaryKey, parent *schema.Table) (*schema.Index, error)
- func Schema(spec *sqlspec.Schema, tables []*sqlspec.Table, convertTable ConvertTableFunc) (*schema.Schema, error)
- func Table(spec *sqlspec.Table, parent *schema.Schema, convertColumn ConvertColumnFunc, ...) (*schema.Table, error)
- type ColumnSpecFunc
- type ConvertColumnFunc
- type ConvertIndexFunc
- type ConvertPrimaryKeyFunc
- type ConvertTableFunc
- type ConvertTypeFunc
- type ForeignKeySpecFunc
- type IndexSpecFunc
- type PrimaryKeySpecFunc
- type TableSpecFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromForeignKey ¶
func FromForeignKey(s *schema.ForeignKey) (*sqlspec.ForeignKey, error)
FromForeignKey converts schema.ForeignKey to sqlspec.ForeignKey
func FromPrimaryKey ¶
func FromPrimaryKey(s *schema.Index) (*sqlspec.PrimaryKey, error)
FromPrimaryKey converts schema.Index to a sqlspec.PrimaryKey.
func FromSchema ¶
FromSchema converts a schema.Schema into sqlspec.Schema and []sqlspec.Table.
func FromTable ¶
func FromTable(t *schema.Table, colFn ColumnSpecFunc, pkFn PrimaryKeySpecFunc, idxFn IndexSpecFunc, fkFn ForeignKeySpecFunc) (*sqlspec.Table, error)
FromTable converts a schema.Table to a sqlspec.Table.
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 ¶
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 ¶
List of convert function types.
type ConvertColumnFunc ¶
List of convert function types.
type ConvertIndexFunc ¶
List of convert function types.
type ConvertPrimaryKeyFunc ¶
List of convert function types.
type ConvertTableFunc ¶
List of convert function types.
type ConvertTypeFunc ¶
List of convert function types.
type ForeignKeySpecFunc ¶
type ForeignKeySpecFunc func(fk *schema.ForeignKey) (*sqlspec.ForeignKey, error)
List of convert function types.
type IndexSpecFunc ¶
List of convert function types.
type PrimaryKeySpecFunc ¶
type PrimaryKeySpecFunc func(index *schema.Index) (*sqlspec.PrimaryKey, error)
List of convert function types.