model

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColumnFields = []string{"COLUMN_NAME", "COLUMN_TYPE", "COLUMN_KEY", "COLUMN_COMMENT", "DATA_TYPE"}

ColumnFields lists the database columns queried from Column (mysql, omits SIZE).

View Source
var TableFields = []string{"TABLE_NAME", "TABLE_COMMENT"}

TableFields lists the database columns queried from Table.

Functions

func Ignore

func Ignore(t *Table) bool

Ignore returns true if the table comment indicates it should be ignored.

func Title

func Title(input string) string

Title converts snake_case to Title Case with spaces.

Types

type Column

type Column struct {
	Name     string   `db:"COLUMN_NAME" json:"name" yaml:"name"`
	Type     string   `db:"COLUMN_TYPE" json:"type,omitempty" yaml:"type,omitempty"`
	Key      string   `db:"COLUMN_KEY" json:"key,omitempty" yaml:"key,omitempty"`
	Comment  string   `db:"COLUMN_COMMENT" json:"comment,omitempty" yaml:"comment,omitempty"`
	DataType string   `db:"DATA_TYPE" json:"datatype,omitempty" yaml:"datatype,omitempty"`
	Size     int      `db:"SIZE" json:"size,omitempty" yaml:"size,omitempty"`
	Values   []string `json:"values,omitempty" yaml:"values,omitempty"`
}

Column represents a database column with its metadata. SIZE is filled from sql query on postgres.

func (*Column) Title

func (c *Column) Title() string

Title returns a human-readable title for the column.

type Index added in v0.0.2

type Index struct {
	Name    string   `json:"name,omitempty" yaml:"name,omitempty"`
	Columns []string `json:"columns" yaml:"columns"`
	Primary bool     `json:"primary,omitempty" yaml:"primary,omitempty"`
	Unique  bool     `json:"unique,omitempty" yaml:"unique,omitempty"`
}

Index represents a database index on a table.

type Table

type Table struct {
	Name    string `db:"TABLE_NAME" json:"name" yaml:"name"`
	Comment string `db:"TABLE_COMMENT" json:"comment,omitempty" yaml:"comment,omitempty"`

	Columns []*Column `json:"columns" yaml:"columns"`
	Indexes []*Index  `json:"indexes,omitempty" yaml:"indexes,omitempty"`
}

Table represents a database table with its columns and indexes.

func (*Table) Ignore

func (t *Table) Ignore() bool

Ignore returns true if the table comment indicates it should be ignored.

func (*Table) Map

func (t *Table) Map() map[string]string

Map returns a typed map of the Table fields. Comment may be empty.

func (*Table) Title

func (t *Table) Title() string

Title returns a human-readable title for the table.

Jump to

Keyboard shortcuts

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