model

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DomainToSQL added in v0.12.0

func DomainToSQL(d *Domain) string

func DomainsToSQL added in v0.12.0

func DomainsToSQL(domains *orderedmap.Map[string, *Domain]) string

func EnumToSQL added in v0.9.0

func EnumToSQL(e *Enum) string

func EnumsToSQL added in v0.9.0

func EnumsToSQL(enums *orderedmap.Map[string, *Enum]) string

func Ident

func Ident(names ...string) string

func QuoteLiteral

func QuoteLiteral(s string) string

func TableToSQL added in v0.3.0

func TableToSQL(t *Table) string

func TablesToSQL

func TablesToSQL(tables *orderedmap.Map[string, *Table]) string

func ViewToSQL added in v0.3.0

func ViewToSQL(v *View) string

func ViewsToSQL

func ViewsToSQL(views *orderedmap.Map[string, *View]) string

Types

type Column

type Column struct {
	Name        string
	RenameFrom  *string
	TypeName    string
	NotNull     bool
	NotNullName *string
	Default     *string
	Identity    ColumnIdentity
	Generated   ColumnGenerated
	Collation   *string
	StorageType string
	Comment     *string
}

func (*Column) String

func (col *Column) String() string

type ColumnGenerated

type ColumnGenerated byte

func (ColumnGenerated) IsGeneratedColumn

func (b ColumnGenerated) IsGeneratedColumn() bool

func (ColumnGenerated) IsStoredGeneratedColumn

func (b ColumnGenerated) IsStoredGeneratedColumn() bool

func (ColumnGenerated) IsVirtualGeneratedColumn

func (b ColumnGenerated) IsVirtualGeneratedColumn() bool

type ColumnIdentity

type ColumnIdentity byte

func (ColumnIdentity) IsGeneratedAlways

func (b ColumnIdentity) IsGeneratedAlways() bool

func (ColumnIdentity) IsGeneratedByDefault

func (b ColumnIdentity) IsGeneratedByDefault() bool

func (ColumnIdentity) IsIdentityColumn

func (b ColumnIdentity) IsIdentityColumn() bool

type Constraint

type Constraint struct {
	OID        uint32
	Name       string
	RenameFrom *string
	Type       ConstraintType
	Definition string
	Columns    []string
	Deferrable bool
	Deferred   bool
	Validated  bool
}

func (*Constraint) String

func (con *Constraint) String() string

type ConstraintType

type ConstraintType byte

func (ConstraintType) IsCheckConstraint

func (b ConstraintType) IsCheckConstraint() bool

func (ConstraintType) IsConstraintTrigger

func (b ConstraintType) IsConstraintTrigger() bool

func (ConstraintType) IsExclusionConstraint

func (b ConstraintType) IsExclusionConstraint() bool

func (ConstraintType) IsForeignKeyConstraint

func (b ConstraintType) IsForeignKeyConstraint() bool

func (ConstraintType) IsNotNullConstraint

func (b ConstraintType) IsNotNullConstraint() bool

func (ConstraintType) IsPrimaryKeyConstraint

func (b ConstraintType) IsPrimaryKeyConstraint() bool

func (ConstraintType) IsUniqueConstraint

func (b ConstraintType) IsUniqueConstraint() bool

type Domain added in v0.12.0

type Domain struct {
	OID         uint32
	Schema      string
	Name        string
	RenameFrom  *string
	BaseType    string
	NotNull     bool
	Default     *string
	Collation   *string
	Constraints []*DomainConstraint
	Comment     *string
}

func (Domain) CommentSQL added in v0.12.0

func (d Domain) CommentSQL() string

func (Domain) FQDN added in v0.12.0

func (d Domain) FQDN() string

func (Domain) SQL added in v0.12.0

func (d Domain) SQL() string

type DomainConstraint added in v0.12.0

type DomainConstraint struct {
	Name       string
	Definition string
}

type Enum added in v0.9.0

type Enum struct {
	OID        uint32
	Schema     string
	Name       string
	RenameFrom *string
	Values     []string
	Comment    *string
}

func (Enum) CommentSQL added in v0.9.0

func (e Enum) CommentSQL() string

func (Enum) FQEN added in v0.9.0

func (e Enum) FQEN() string

func (Enum) SQL added in v0.9.0

func (e Enum) SQL() string

type ForeignKey

type ForeignKey struct {
	Constraint
	Schema    string
	Table     string
	RefSchema *string
	RefTable  *string
}

func (ForeignKey) SQL

func (fk ForeignKey) SQL() string

func (*ForeignKey) String

func (fk *ForeignKey) String() string

type Index

type Index struct {
	OID          uint32
	Schema       string
	Name         string
	RenameFrom   *string
	Table        string
	Definition   string
	TableSpace   *string
	Concurrently bool
}

func (Index) FQTN

func (idx Index) FQTN() string

func (Index) SQL

func (idx Index) SQL() string

type Policy added in v1.3.0

type Policy struct {
	Name       string
	RenameFrom *string
	Schema     string
	Table      string
	Permissive bool
	Command    PolicyCommand
	Roles      []string
	Using      *string
	WithCheck  *string
}

func (Policy) SQL added in v1.3.0

func (p Policy) SQL() string

SQL renders a CREATE POLICY statement.

func (*Policy) String added in v1.3.0

func (p *Policy) String() string

type PolicyCommand added in v1.3.0

type PolicyCommand byte

PolicyCommand mirrors pg_policy.polcmd:

'*' ALL, 'r' SELECT, 'a' INSERT, 'w' UPDATE, 'd' DELETE

func (PolicyCommand) IsAll added in v1.3.0

func (c PolicyCommand) IsAll() bool

func (PolicyCommand) String added in v1.3.0

func (c PolicyCommand) String() string

type Sequence

type Sequence struct {
	OID         uint32
	Schema      string
	Name        string
	DataType    string
	Start       int64
	Min         int64
	Max         int64
	Increment   int64
	Cache       int64
	Cycle       bool
	OwnerTable  *string
	OwnerColumn *string
}

Sequence holds metadata for a PostgreSQL sequence. It is currently populated only by catalog.Catalog.Sequences and not yet consumed by the diff/apply pipeline; it is intentionally kept for future sequence-aware schema management and should not be deleted as dead code.

func (*Sequence) String

func (seq *Sequence) String() string

String returns a debug-friendly representation. Kept alongside Sequence as part of the future sequence-aware schema management foundation.

type Table

type Table struct {
	OID              uint32
	Schema           string
	Name             string
	RenameFrom       *string
	BulkAlter        bool
	TableSpace       *string
	Unlogged         bool
	Partitioned      bool
	PartitionDef     *string
	PartitionOf      *string
	PartitionBound   *string
	RowSecurity      bool
	ForceRowSecurity bool
	Columns          *orderedmap.Map[string, *Column]
	Constraints      *orderedmap.Map[string, *Constraint]
	ForeignKeys      *orderedmap.Map[string, *ForeignKey]
	Indexes          *orderedmap.Map[string, *Index]
	Policies         *orderedmap.Map[string, *Policy]
	Comment          *string
}

func (Table) CommentSQL

func (t Table) CommentSQL() string

func (Table) FQTN

func (t Table) FQTN() string

func (Table) FkSQL

func (t Table) FkSQL() string

func (Table) IdxSQL

func (t Table) IdxSQL() string

func (Table) RLSSQL added in v1.3.0

func (t Table) RLSSQL() string

func (Table) SQL

func (t Table) SQL() string

type View

type View struct {
	OID          uint32
	Schema       string
	Name         string
	RenameFrom   *string
	Definition   string
	Materialized bool
	Indexes      *orderedmap.Map[string, *Index]
	Comment      *string
}

func (View) CommentSQL

func (v View) CommentSQL() string

func (View) FQVN

func (v View) FQVN() string

func (View) SQL

func (v View) SQL() string

Jump to

Keyboard shortcuts

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