schema

package
v0.0.0-...-fe13e1c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Table schema description format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TableColumn

type TableColumn struct {
	Name     string
	Type     Type
	Default  interface{}
	Nullable bool
}

func (TableColumn) String

func (t TableColumn) String() string

func (TableColumn) ToSqlColumn

func (t TableColumn) ToSqlColumn(tab string) *sql.Column

type TableMasterMetadata

type TableMasterMetadata struct {
	Name    string
	Schema  TableSchema
	PKey    []string
	Index   [][]string
	Unique  [][]string
	Options string
}

func ParseTableMasterMetadata

func ParseTableMasterMetadata(s *sqlparser.DDL) (md *TableMasterMetadata, err error)

func (*TableMasterMetadata) CompatibleWith

func (t *TableMasterMetadata) CompatibleWith(sch *TableMetadata) (compatible bool)

func (*TableMasterMetadata) String

func (t *TableMasterMetadata) String() string

type TableMetadata

type TableMetadata struct {
	Name   string
	Schema TableSchema

	From string
}

func ParseTableMetadata

func ParseTableMetadata(s *sqlparser.DDL) (md *TableMetadata, err error)

func (*TableMetadata) SqlSchema

func (t *TableMetadata) SqlSchema() sql.Schema

func (*TableMetadata) String

func (t *TableMetadata) String() string

type TableSchema

type TableSchema []TableColumn

func FromTablespec

func FromTablespec(sp *sqlparser.TableSpec) (ts TableSchema, err error)

func (TableSchema) Find

func (t TableSchema) Find(col string) (TableColumn, bool)

func (TableSchema) FindIndex

func (t TableSchema) FindIndex(col string) (int, bool)

func (TableSchema) Has

func (t TableSchema) Has(col string) bool

func (TableSchema) String

func (t TableSchema) String() string

func (TableSchema) ToSqlSchema

func (t TableSchema) ToSqlSchema(tab string) sql.Schema

type Type

type Type uint
const (
	Null Type = iota
	Int8
	Uint8
	Int16
	Uint16
	Int32
	Int64
	Uint32
	Uint64
	Float32
	Float64

	Timestamp
	Date
	Text
	Boolean
	JSON
	Blob
)

func FromMysqlType

func FromMysqlType(sql query.Type) (Type, bool)

func FromSqlType

func FromSqlType(st sql.Type) (Type, bool)

func (Type) Compatible

func (t Type) Compatible(v Type) bool

func (Type) SqlType

func (t Type) SqlType() sql.Type

func (Type) String

func (t Type) String() string

func (Type) Type

func (t Type) Type() query.Type

func (Type) Valid

func (t Type) Valid() bool

Jump to

Keyboard shortcuts

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