schema

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SliceContains = cyutil.SliceContains

Functions

func NewErrorQueryResult

func NewErrorQueryResult(err error) def.QueryResult

func NewFieldData

func NewFieldData(data any, idx int, refTable def.TableInfo) def.FieldData

func NewTableRowData

func NewTableRowData(TableInfo def.TableInfo, data []def.FieldData) def.RowData

func ToColumn

func ToColumn[T any](qr def.QueryResult, columnName string) ([]T, error)

ToColumn converts a column from QueryResult into a typed slice. Automatically converts each value in the column to the target type. Returns error if column not found or conversion fails.

Example:

result, err := db.QueryAsResult("SELECT age FROM users")
if err != nil {
	return err
}
ages, err := cydb.ToColumn[int](result, "age")
if err != nil {
	return err
}
fmt.Printf("Ages: %v\n", ages)  // []int{25, 30, 35}

func ToResult

func ToResult[T any](qr def.QueryResult, opts ...structmap.Option) (T, error)

ToResult converts the provided QueryResult into a typed result. It scans the first row into the result type.

Example:

result, err := db.FirstAsResult(...)
if err != nil {
	return err
}
user, err := cydb.ToResult[User](result)
if err != nil {
	return err
}
fmt.Printf("User: %+v\n", user)

func ToResultEx

func ToResultEx[T any](qr def.QueryResult, transform def.ItemTransformFunc, opts ...structmap.Option) (T, error)

ToResultEx converts the provided QueryResult into a typed result. It is an extended version of ToResult that accepts a callback to mutate the row item map before it is mapped into the destination struct.

func ToValue

func ToValue[T any](qr def.QueryResult, columnName string, rowIndex ...int) (T, error)

ToValue converts a single value from QueryResult into the specified type. If rowIndex is not provided, it defaults to 0 (first row). Automatically converts the value to the target type. If the value is a string or []byte and T is a struct or slice, attempts JSON decoding.

Example:

result, err := db.QueryRowAsResult("SELECT age FROM users WHERE id = ?", 1)
if err != nil {
	return err
}
age, err := cydb.ToValue[int](result, "age")
if err != nil {
	return err
}
fmt.Printf("Age: %d\n", age)  // Age: 25

// Get value from second row
age, err := cydb.ToValue[int](result, "age", 1)

// JSON decoding example for struct
type User struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}
result, err := db.QueryRowAsResult("SELECT data FROM users WHERE id = ?", 1)
user, err := cydb.ToValue[User](result, "data")  // Automatically decodes JSON

// JSON decoding example for slice
type Item struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}
result, err := db.QueryRowAsResult("SELECT items FROM orders WHERE id = ?", 1)
items, err := cydb.ToValue[[]Item](result, "items")  // Automatically decodes JSON array

Types

type ColumnSpec

type ColumnSpec = FieldInfo

ColumnSpec is the unified column definition (alias of FieldInfo for compatibility).

type CompositeForeignKey

type CompositeForeignKey struct {
	Name       string   // Foreign key constraint name
	Columns    []string // Local columns
	RefTable   string   // Referenced table name
	RefColumns []string // Referenced columns
	OnDelete   string   // DELETE action (CASCADE, RESTRICT, SET NULL, NO ACTION)
	OnUpdate   string   // UPDATE action (CASCADE, RESTRICT, SET NULL, NO ACTION)
}

CompositeForeignKey represents a composite foreign key constraint

func (*CompositeForeignKey) GetColumns

func (c *CompositeForeignKey) GetColumns() []string

GetColumns implements def.CompositeForeignKey.

func (*CompositeForeignKey) GetName

func (c *CompositeForeignKey) GetName() string

GetName implements def.CompositeForeignKey.

func (*CompositeForeignKey) GetOnDelete

func (c *CompositeForeignKey) GetOnDelete() def.ForeignKeyAction

GetOnDelete implements def.CompositeForeignKey.

func (*CompositeForeignKey) GetOnUpdate

func (c *CompositeForeignKey) GetOnUpdate() def.ForeignKeyAction

GetOnUpdate implements def.CompositeForeignKey.

func (*CompositeForeignKey) GetRefColumns

func (c *CompositeForeignKey) GetRefColumns() []string

GetRefColumns implements def.CompositeForeignKey.

func (*CompositeForeignKey) GetRefTable

func (c *CompositeForeignKey) GetRefTable() string

GetRefTable implements def.CompositeForeignKey.

type CompositeIndex

type CompositeIndex struct {
	Name    string   // Index name
	Columns []string // Column names in the index
	Unique  bool     // Whether it's a unique index
}

CompositeIndex represents a composite index

func (*CompositeIndex) GetColumns

func (c *CompositeIndex) GetColumns() []string

GetColumns implements def.CompositeIndex.

func (*CompositeIndex) GetName

func (c *CompositeIndex) GetName() string

GetName implements def.CompositeIndex.

func (*CompositeIndex) IsUnique

func (c *CompositeIndex) IsUnique() bool

IsUnique implements def.CompositeIndex.

type DBIndex

type DBIndex struct {
	Name    string
	Columns []string
}

type FieldData

type FieldData struct {
	Data any
	Idx  int
	// contains filtered or unexported fields
}

func (*FieldData) GetFieldName

func (f *FieldData) GetFieldName() string

GetFieldName implements def.FieldData.

func (*FieldData) GetFieldSize

func (f *FieldData) GetFieldSize() int

func (*FieldData) GetFieldType

func (f *FieldData) GetFieldType() def.StandardFieldType

GetFieldType implements def.FieldData.

func (*FieldData) GetIndex

func (f *FieldData) GetIndex() int

func (*FieldData) GetOrginalDataType

func (f *FieldData) GetOrginalDataType() string

GetOrginalDataType implements def.FieldData.

func (*FieldData) GetValue

func (f *FieldData) GetValue() any

GetValue implements def.FieldData.

func (*FieldData) IsPrimary

func (f *FieldData) IsPrimary() bool

IsPrimary implements def.FieldData.

type FieldInfo

type FieldInfo struct {
	Name               string
	Type               def.StandardFieldType
	OrginalDataType    string // raw type string from DB introspection
	PrimaryKey         bool
	Index              bool
	Unique             bool
	NotNull            bool
	Default            *string
	Size               int
	Precision          int
	Scale              int
	AutoIncrement      bool
	ForeignKey         *ForeignKeyInfo
	DefaultCurrentTime bool   // DEFAULT CURRENT_TIMESTAMP
	UpdateCurrentTime  bool   // DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
	Comment            string // column comment from DB introspection ("" when unsupported)
}

func (*FieldInfo) GetComment

func (f *FieldInfo) GetComment() string

GetComment implements def.ColumnInfo.

func (*FieldInfo) GetDefault

func (f *FieldInfo) GetDefault() *string

GetDefault implements def.ColumnInfo.

func (*FieldInfo) GetForeignKey

func (f *FieldInfo) GetForeignKey() def.ForeignKeyInfo

GetForeignKey implements def.ColumnInfo.

func (*FieldInfo) GetName

func (f *FieldInfo) GetName() string

GetName implements def.ColumnInfo.

func (*FieldInfo) GetOrginalDataType

func (f *FieldInfo) GetOrginalDataType() string

GetOrginalDataType implements def.ColumnInfo.

func (*FieldInfo) GetPrecision

func (f *FieldInfo) GetPrecision() int

GetPrecision implements def.ColumnInfo.

func (*FieldInfo) GetScale

func (f *FieldInfo) GetScale() int

GetScale implements def.ColumnInfo.

func (*FieldInfo) GetSize

func (f *FieldInfo) GetSize() int

func (*FieldInfo) GetType

func (f *FieldInfo) GetType() def.StandardFieldType

GetType implements def.ColumnInfo.

func (*FieldInfo) GetTypeAndSize

func (f *FieldInfo) GetTypeAndSize() (def.StandardFieldType, int)

GetTypeAndSize implements def.ColumnInfo.

func (*FieldInfo) IsAutoIncrement

func (f *FieldInfo) IsAutoIncrement() bool

IsAutoIncrement implements def.ColumnInfo.

func (*FieldInfo) IsDefaultCurrentTimeOnCreate

func (f *FieldInfo) IsDefaultCurrentTimeOnCreate() bool

IsDefaultCurrentTimeOnCreate implements def.ColumnInfo.

func (*FieldInfo) IsDefaultCurrentTimeOnUpdate

func (f *FieldInfo) IsDefaultCurrentTimeOnUpdate() bool

IsDefaultCurrentTimeOnUpdate implements def.ColumnInfo.

func (*FieldInfo) IsIndex

func (f *FieldInfo) IsIndex() bool

IsIndex implements def.ColumnInfo.

func (*FieldInfo) IsNotNull

func (f *FieldInfo) IsNotNull() bool

IsNotNull implements def.ColumnInfo.

func (*FieldInfo) IsPrimaryKey

func (f *FieldInfo) IsPrimaryKey() bool

IsPrimaryKey implements def.ColumnInfo.

func (*FieldInfo) IsUnique

func (f *FieldInfo) IsUnique() bool

IsUnique implements def.ColumnInfo.

type FieldMapping

type FieldMapping struct {
	OldColumnName string // The original column name in the database
	NewColumnName string // The new column name to migrate to
}

type ForeignKeyInfo

type ForeignKeyInfo struct {
	ReferencedTable  string
	ReferencedColumn string
	OnDelete         string
	OnUpdate         string
}

ForeignKeyInfo represents foreign key constraint information

func (*ForeignKeyInfo) GetOnDelete

func (f *ForeignKeyInfo) GetOnDelete() def.ForeignKeyAction

GetOnDelete implements def.ForeignKeyInfo.

func (*ForeignKeyInfo) GetOnUpdate

func (f *ForeignKeyInfo) GetOnUpdate() def.ForeignKeyAction

GetOnUpdate implements def.ForeignKeyInfo.

func (*ForeignKeyInfo) GetRefColumn

func (f *ForeignKeyInfo) GetRefColumn() string

GetRefColumn implements def.ForeignKeyInfo.

func (*ForeignKeyInfo) GetRefTable

func (f *ForeignKeyInfo) GetRefTable() string

GetRefTable implements def.ForeignKeyInfo.

type Kind

type Kind string
const (
	PrimaryKey Kind = "PRIMARY KEY"
	Unique     Kind = "UNIQUE"
	NotNull    Kind = "NOT NULL"
	Check      Kind = "CHECK"
	ForeignKey Kind = "FOREIGN KEY"
	Default    Kind = "DEFAULT"
)

type MigrationTableInfo

type MigrationTableInfo = TableSpec

Legacy aliases for compatibility

type PaginatedResult

type PaginatedResult[T any] struct {
	Items    []T   `json:"items"`    // Items in the current page
	Total    int64 `json:"total"`    // Total number of items across all pages
	Page     int   `json:"page"`     // Current page number (1-indexed)
	PageSize int   `json:"pageSize"` // Number of items per page
}

PaginatedResult represents a paginated query result with type-safe items. Used by ScanPagedResult to return typed paginated data.

func ToPagedResult

func ToPagedResult[T any](qr def.QueryResult, opts ...structmap.Option) (*PaginatedResult[T], error)

ToPagedResult converts the provided QueryResult into a typed PaginatedResult. It reuses ScanInto to populate the Items slice and falls back to sensible defaults when pagination metadata is missing.

Example:

result, err := db.ListWithPageAsResult(...)
if err != nil {
	return err
}
paged, err := cydb.ToPagedResult[User](result)
if err != nil {
	return err
}
fmt.Printf("Total: %d, Page: %d, Items: %d\n", paged.Total, paged.Page, len(paged.Items))

func ToPagedResultEx

func ToPagedResultEx[T any](qr def.QueryResult, transform def.ItemTransformFunc, opts ...structmap.Option) (*PaginatedResult[T], error)

ToPagedResultEx converts the provided QueryResult into a typed PaginatedResult. It is an extended version of ToPagedResult that accepts a callback to mutate each row (item) before it is mapped into the destination struct.

The callback is executed after the row is converted to map[column]value and before structmap mapping. Returning an error will abort the scan.

type QueryMetadata

type QueryMetadata = def.QueryMetadata

type QueryResult

type QueryResult struct {
	Data       [][]any       `json:"data"`
	Columns    []string      `json:"columns"`
	Row        []any         `json:"row,omitempty"`
	TotalCount int64         `json:"total_count,omitempty"`
	Page       int           `json:"page,omitempty"`
	PageSize   int           `json:"page_size,omitempty"`
	Metadata   QueryMetadata `json:"metadata,omitempty"`
	Error      error         `json:"error,omitempty"`
}

QueryResult wraps query results with metadata and efficient data access

func (*QueryResult) Bool

func (qr *QueryResult) Bool(columnName string) (bool, error)

Bool returns the first row's value for the specified column as bool.

Example:

active, err := result.Bool("is_active")

func (*QueryResult) Count

func (qr *QueryResult) Count() int

Count returns the number of rows in the result

func (*QueryResult) Err

func (qr *QueryResult) Err() error

Err returns the underlying error, implementing def.QueryResult contract.

func (*QueryResult) Float64

func (qr *QueryResult) Float64(columnName string) (float64, error)

Float64 returns the first row's value for the specified column as float64. Useful for AVG, SUM, and other aggregate queries.

Example:

avg, err := result.Float64("avg_price")

func (*QueryResult) GetColumn

func (qr *QueryResult) GetColumn(columnName string) ([]any, error)

GetColumn returns all values for the specified column name, or error if column not found. Returns a slice of values for the column across all rows.

Example:

ages, err := result.GetColumn("age")  // []any{25, 30, 35}

func (*QueryResult) GetColumns

func (qr *QueryResult) GetColumns(columnNames ...string) (map[string][]any, error)

GetColumns returns values for multiple columns at once. Returns a map of column names to their values (as slices). More efficient than calling GetColumn multiple times.

Example:

cols, err := result.GetColumns("id", "name", "age")
ids := cols["id"]    // []any
names := cols["name"] // []any

func (*QueryResult) GetFirstRow

func (qr *QueryResult) GetFirstRow() ([]any, []string, error)

GetFirstRow returns the first row, or error if no data

func (*QueryResult) GetMetaData

func (qr *QueryResult) GetMetaData() def.QueryMetadata

func (*QueryResult) GetPage

func (qr *QueryResult) GetPage() int

GetPage implements def.QueryResult.

func (*QueryResult) GetPageSize

func (qr *QueryResult) GetPageSize() int

GetPageSize implements def.QueryResult.

func (*QueryResult) GetRow

func (qr *QueryResult) GetRow(rowIndex int) ([]any, []string, error)

GetRow returns the row at the specified index, or error if out of bounds

func (*QueryResult) GetTotalCount

func (qr *QueryResult) GetTotalCount() int64

GetTotalCount implements def.QueryResult.

func (*QueryResult) GetValue

func (qr *QueryResult) GetValue(columnName string, rowIndex ...int) (any, error)

GetValue returns the value at the specified column name, or error if not found. If rowIndex is not provided, it defaults to 0 (first row). Returns error if column not found or row index out of bounds.

Example:

value, err := result.GetValue("name")        // Get first row
value, err := result.GetValue("name", 1)     // Get second row
value, err := result.GetValue("age", 2)      // Get third row

func (*QueryResult) HasError

func (qr *QueryResult) HasError() bool

HasError checks if the query result contains an error

func (*QueryResult) Int64

func (qr *QueryResult) Int64(columnName string) (int64, error)

Int64 returns the first row's value for the specified column as int64. Useful for COUNT, SUM, and other aggregate queries.

Example:

count, err := result.Int64("count")

func (*QueryResult) IsEmpty

func (qr *QueryResult) IsEmpty() bool

IsEmpty checks if the query result has no data

func (*QueryResult) RawData

func (qr *QueryResult) RawData() ([][]any, []string, error)

RawData returns the raw data and column names. Returns a tuple of (rows, columns) for direct access to underlying data.

Example:

data, columns := result.RawData()

func (*QueryResult) ScanInto

func (qr *QueryResult) ScanInto(dest any, opts ...structmap.Option) error

ScanInto scans the query result into the destination type. Supports scanning into a single struct or a slice of structs. Automatically handles type conversion with structmap options.

Example:

var user User
if err := result.ScanInto(&user); err != nil {
    return err
}

var users []User
if err := result.ScanInto(&users); err != nil {
    return err
}

func (*QueryResult) ScanIntoEx

func (qr *QueryResult) ScanIntoEx(dest any, transform def.ItemTransformFunc, opts ...structmap.Option) error

ScanIntoEx is an extended version of ScanInto. It accepts a callback to mutate each row (item) before it is mapped into the destination struct.

The callback is executed after converting each row into map[column]value and before structmap mapping. Returning an error will abort the scan.

func (*QueryResult) ScanValue

func (qr *QueryResult) ScanValue(dest any, columnName string, rowIndex ...int) error

ScanValue scans a single value from the specified column into the destination. If rowIndex is not provided, it defaults to 0 (first row). Automatically converts the value to the target type using structmap. The dest parameter should be a pointer to the target type.

Example:

var age int
if err := result.ScanValue(&age, "age"); err != nil {
    return err
}
fmt.Printf("Age: %d\n", age)  // Age: 25

// Get value from second row
var name string
if err := result.ScanValue(&name, "name", 1); err != nil {
    return err
}

// Struct example
type User struct {
    Name string `json:"name"`
    Age  int    `json:"age"`
}
var user User
if err := result.ScanValue(&user, "data"); err != nil {
    return err
}

func (*QueryResult) SetPage

func (qr *QueryResult) SetPage(page int)

SetPage sets pagination page number.

func (*QueryResult) SetPageSize

func (qr *QueryResult) SetPageSize(size int)

SetPageSize sets pagination page size.

func (*QueryResult) SetTotalCount

func (qr *QueryResult) SetTotalCount(total int64)

SetTotalCount sets pagination total.

func (*QueryResult) String

func (qr *QueryResult) String(columnName string) (string, error)

String returns the first row's value for the specified column as string.

Example:

name, err := result.String("name")

func (*QueryResult) ToMap

func (qr *QueryResult) ToMap() (map[string]any, error)

func (*QueryResult) ToMaps

func (qr *QueryResult) ToMaps() ([]map[string]any, error)

ToMaps converts the QueryResult into a slice of maps. Each map represents a row with column names as keys.

Example:

maps, err := result.ToMaps()
for _, m := range maps {
    fmt.Printf("Name: %s, Age: %d\n", m["name"], m["age"])
}

type RowData

type RowData struct {
	TableInfo def.TableInfo
	// contains filtered or unexported fields
}

func (*RowData) AsObject

func (r *RowData) AsObject() (map[string]any, error)

func (*RowData) ForEach

func (r *RowData) ForEach(fn func(i int, d def.FieldData) error) error

func (*RowData) GetDatabase

func (r *RowData) GetDatabase() string

GetDatabase implements def.RowData.

func (*RowData) GetFieldDatas

func (r *RowData) GetFieldDatas() ([]def.FieldData, error)

GetFieldDatas implements def.RowData.

func (*RowData) GetFields

func (r *RowData) GetFields() ([]string, error)

GetFieldsString implements BuildSql interface Returns a comma-separated string of field names

func (*RowData) GetFieldsSkipPk

func (r *RowData) GetFieldsSkipPk() ([]string, error)

func (*RowData) GetPkFields

func (r *RowData) GetPkFields() ([]string, error)

GetPkFieldsString implements BuildSql interface Returns a comma-separated string of primary key field names

func (*RowData) GetReplaceSql

func (r *RowData) GetReplaceSql() (string, error)

GetReplaceSql implements def.RowData.

func (*RowData) GetSchema

func (r *RowData) GetSchema() string

GetSchema implements def.RowData.

func (*RowData) GetTableName

func (r *RowData) GetTableName() string

GetTableName implements def.RowData.

func (*RowData) GetValues

func (r *RowData) GetValues() ([]any, []string, error)

GetValuesString implements BuildSql interface Returns a comma-separated string of values and the field names all parameter: if true, includes all fields; if false, excludes primary key fields

func (*RowData) GetValuesAsObj

func (r *RowData) GetValuesAsObj() map[string]any

func (*RowData) GetValuesSkipPK

func (r *RowData) GetValuesSkipPK() ([]any, []string, error)

func (*RowData) IsEmpty

func (r *RowData) IsEmpty() bool

type TableColumnInfo

type TableColumnInfo = FieldInfo

TableColumnInfo is kept as an alias to the unified FieldInfo for compatibility. For introspected columns, set ColumnName (preferred) or Name.

type TableConstraint

type TableConstraint struct {
	Name       string          // 约束名(可选,数据库会自动生成)
	Table      string          // 所属表
	Columns    []string        // 作用列(复合主键/联合唯一等场景)
	Kind       Kind            // 约束类型
	Expression string          // CHECK 表达式、DEFAULT 值等占位
	Ref        *TableReference // 外键专用
}

Constraint 一条完整的约束规则

func (*TableConstraint) GetColumns

func (t *TableConstraint) GetColumns() []string

GetColumns implements def.TableConstraint.

func (*TableConstraint) GetName

func (t *TableConstraint) GetName() string

GetName implements def.TableConstraint.

func (*TableConstraint) GetType

func (t *TableConstraint) GetType() def.Kind

GetType implements def.TableConstraint.

type TableConstraints

type TableConstraints struct {
	Constraints []TableConstraint
	// contains filtered or unexported fields
}

func (*TableConstraints) GetPrimaryKeys

func (c *TableConstraints) GetPrimaryKeys() []string

func (*TableConstraints) GetUniqueKeys

func (c *TableConstraints) GetUniqueKeys() []string

func (*TableConstraints) IsColumnNullable

func (c *TableConstraints) IsColumnNullable(key string) bool

func (*TableConstraints) IsColumnPrimary

func (c *TableConstraints) IsColumnPrimary(key string) bool

func (*TableConstraints) IsColumnUnique

func (c *TableConstraints) IsColumnUnique(key string) bool

type TableInfo

type TableInfo = TableSpec

type TableReference

type TableReference struct {
	Table  string
	Column string
}

TableReference 外键指向信息

type TableSpec

type TableSpec struct {
	DBType    string
	DBSubType string
	// Identifiers
	Database string
	Schema   string
	Name     string // Backward compatibility; if empty, fall back to Name

	// Columns: unified source of truth.
	// When built from structs (desired schema), these are populated from FieldInfo-equivalent data.
	// When introspected from DB (current schema), these come from database metadata.
	Columns []ColumnSpec

	// Constraints and indexes
	Constraints          TableConstraints
	Indexes              []DBIndex
	CompositeForeignKeys []CompositeForeignKey
	CompositeIndexes     []CompositeIndex
	FieldMappings        []FieldMapping // Column rename mappings
	Comment              string         // table comment from DB introspection ("" when unsupported)
	// contains filtered or unexported fields
}

TableSpec is the unified description of a table, used both for: 1) Desired schema (from code/structs) for migration. 2) Current schema (introspected from DB) for comparison.

func (*TableSpec) ColumnExist

func (t *TableSpec) ColumnExist(columnName string) bool

func (*TableSpec) FilterColumns

func (t *TableSpec) FilterColumns(columnNames []string, skipPK bool) []string

func (*TableSpec) GetColumn

func (t *TableSpec) GetColumn(idx int) def.ColumnInfo

GetColumn implements def.TableInfo.

func (*TableSpec) GetColumnIndex

func (t *TableSpec) GetColumnIndex(name string) int

GetColumnIndex returns the index of a column by name (case-insensitive), matching ColumnName first, then falling back to Name.

func (*TableSpec) GetColumnNameSet

func (t *TableSpec) GetColumnNameSet() map[string]struct{}

func (*TableSpec) GetColumnNameSetWithoutPK

func (t *TableSpec) GetColumnNameSetWithoutPK() map[string]struct{}

func (*TableSpec) GetColumns

func (t *TableSpec) GetColumns() []def.ColumnInfo

GetColumns implements def.TableInfo.

func (*TableSpec) GetComment

func (t *TableSpec) GetComment() string

GetComment implements def.TableInfo.

func (*TableSpec) GetCompositeForeignKeys

func (t *TableSpec) GetCompositeForeignKeys() []def.CompositeForeignKey

GetCompositeForeignKeys implements def.TableInfo.

func (*TableSpec) GetCompositeIndexes

func (t *TableSpec) GetCompositeIndexes() []def.CompositeIndex

GetCompositeIndexes implements def.TableInfo.

func (*TableSpec) GetConstraints

func (t *TableSpec) GetConstraints() []def.TableConstraint

GetConstraints implements def.TableInfo.

func (*TableSpec) GetDatabase

func (t *TableSpec) GetDatabase() string

GetDatabase returns the database name if set.

func (*TableSpec) GetName

func (t *TableSpec) GetName() string

GetName implements def.TableInfo.

func (*TableSpec) GetPrimaryKeys

func (t *TableSpec) GetPrimaryKeys() []string

func (*TableSpec) GetSchema

func (t *TableSpec) GetSchema() string

GetSchema returns the schema name if set.

func (*TableSpec) GetType

func (t *TableSpec) GetType() (string, string)

GetType implements def.TableInfo.

func (*TableSpec) GetUniqueKeys

func (t *TableSpec) GetUniqueKeys() []string

Jump to

Keyboard shortcuts

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