schema

package
v0.0.0-...-ee79c15 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package schema contains the schema for the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Table           string
	Name            string // ColumnName
	OrdinalPosition int
	Default         string // ColumnDefault
	Nullable        string
	DataType        string
	ColumnType      string
	Key             string // ColumnKey
	Extra           string
	Comment         string // ColumnComment
	ForeignKey      *ForeignKey
}

func (*Column) IsAutoIncrement

func (c *Column) IsAutoIncrement() bool

func (*Column) IsForeignKey

func (c *Column) IsForeignKey() bool

func (*Column) IsNullable

func (c *Column) IsNullable() bool

func (*Column) IsPrimaryKey

func (c *Column) IsPrimaryKey() bool

func (*Column) IsUnsigned

func (c *Column) IsUnsigned() bool

type ForeignKey

type ForeignKey struct {
	ConstraintName string // FK constraint name
	Table          string // Source table (e.g., "posts")
	ColumnName     string // Column in source table (e.g., "user_id")
	RefTable       string // Referenced table (e.g., "users")
	RefColumn      string // Referenced column (e.g., "id")
}

type Scheme

type Scheme interface {
	io.Closer
	Load(ctx context.Context) ([]*Table, error)
}

func New

func New(cfg *config.DB) (Scheme, error)

func NewMySQL

func NewMySQL(cfg *config.DB) (Scheme, error)

func NewPostgres

func NewPostgres(cfg *config.DB) (Scheme, error)

type Table

type Table struct {
	Name               string
	Comment            string
	Columns            []*Column
	ForeignKeys        []ForeignKey
	ReverseForeignKeys []ForeignKey // Foreign keys from other tables referencing this table
}

Jump to

Keyboard shortcuts

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