Versions in this module Expand all Collapse all v0 v0.1.1 Oct 11, 2026 v0.1.0 Oct 11, 2026 Changes in this version + var ColumnPartValues = []ColumnPart + var ErrAddConstraint = errors.New("sqlb/ddl: this dialect cannot add a column with a key constraint") + var ErrAddNonConstantDefault = errors.New("sqlb/ddl: this dialect cannot add a column with an expression default") + var ErrAddNotNull = errors.New(...) + var ErrDefaultOnGenerated = errors.New("sqlb/ddl: a column with a generated value cannot also have a default") + var ErrDuplicateColumn = errors.New("sqlb/ddl: column defined twice") + var ErrEmptyOneOf = errors.New("sqlb/ddl: OneOf needs at least one value") + var ErrForeignColumn = errors.New("sqlb/ddl: column belongs to another table") + var ErrInvalidJSON = errors.New("sqlb/ddl: a JSON column's default is not valid JSON") + var ErrNoColumnTarget = errors.New("sqlb/ddl: a column clause must name its column") + var ErrNoDefault = errors.New("sqlb/ddl: clause needs the column to have a default") + var ErrNoDefaultType = errors.New("sqlb/ddl: the column's Go type has no default SQL type; give one with As") + var ErrNoNotNull = errors.New("sqlb/ddl: clause needs a NOT NULL to attach to") + var ErrNoTypeTable = errors.New("sqlb/ddl: the dialect has no spelling for this portable type; use RawType") + var ErrNotAColumn = errors.New("sqlb/ddl: a column definition needs a column made by Col") + var ErrUnknownColumn = errors.New("sqlb/ddl: clause names a column the table does not define") + var ErrUnknownPosition = errors.New("sqlb/ddl: clause asks for a position this statement does not render") + var ErrZeroValue = errors.New("sqlb/ddl: built from a zero value rather than its constructor") + var PositionValues = []Position + func RefTableName(schemaName, name string) string + func WriteAddColumn[D render.Dialect](b *strings.Builder, a *render.Args, spec ColumnSpec, clauses []ColumnClause[D]) + func WriteColumnWith[D render.Dialect](b *strings.Builder, a *render.Args, spec ColumnSpec, clauses []ColumnClause[D]) + type Action interface + ActionTable func() expr.Table + Standalone func() bool + WriteAction func(b *strings.Builder, a *render.Args) + func AddColumn(c ColumnSpec) Action + func DropColumn[T any](c expr.Expr[T]) Action + func RenameColumn[T any](from, to expr.Expr[T]) Action + type AlterClause interface + AlterClauseOf func(D) + Standalone func() bool + WriteSQL func(b *strings.Builder, a *render.Args) + func NewAlterClause[D render.Dialect](render func(a *render.Args) string) AlterClause[D] + func NewStandaloneAlterClause[D render.Dialect](render func(a *render.Args) string) AlterClause[D] + type AlterTable struct + func NewAlterTable[D render.Dialect](d D, t expr.Table) *AlterTable[D] + func (s *AlterTable[D]) Action(first Action, more ...Action) *AlterTableReady[D] + func (s *AlterTable[D]) Clause(first AlterClause[D], more ...AlterClause[D]) *AlterTableReady[D] + type AlterTableReady struct + func (s *AlterTableReady[D]) Action(as ...Action) *AlterTableReady[D] + func (s *AlterTableReady[D]) Build() (Script, error) + func (s *AlterTableReady[D]) Clause(cs ...AlterClause[D]) *AlterTableReady[D] + type ColumnClause interface + Part func() ColumnPart + Target func() ColumnRef + func NewColumnClause[D render.Dialect](target ColumnRef, part ColumnPart, render func(a *render.Args) string) ColumnClause[D] + func NewRankedColumnClause[D render.Dialect](rank OptionRank, target ColumnRef, part ColumnPart, ...) ColumnClause[D] + type ColumnDef struct + func Column[T any](c expr.Expr[T]) ColumnDef[T] + func (c ColumnDef[T]) As(t SQLType[T]) ColumnDef[T] + func (c ColumnDef[T]) ColumnFacts() ColumnFacts + func (c ColumnDef[T]) ColumnName() string + func (c ColumnDef[T]) ColumnTable() expr.Table + func (c ColumnDef[T]) Default(v T) ColumnDef[T] + func (c ColumnDef[T]) DefaultExpr(e expr.Expr[T]) ColumnDef[T] + func (c ColumnDef[T]) DescribeColumn(d render.Dialect) (schema.Column, error) + func (c ColumnDef[T]) NotNull() ColumnDef[T] + func (c ColumnDef[T]) Nullable() ColumnDef[T] + func (c ColumnDef[T]) WriteColumn(b *strings.Builder, a *render.Args, x ColumnExtras) + type ColumnDescriber interface + DescribeColumn func(d render.Dialect) (schema.Column, error) + type ColumnExtras struct + AfterNotNull []string + AfterType []string + Computed bool + Constraints []string + RequiresDefault bool + ValueSource bool + type ColumnFacts struct + Default DefaultKind + NotNull bool + type ColumnNamer interface + NamedColumns func() []ColumnRef + type ColumnPart int + const PartAfterNotNull + const PartAfterType + const PartComputed + const PartConstraint + const PartValueSource + type ColumnRef interface + Name func() string + Table func() expr.Table + type ColumnSpec interface + ColumnName func() string + ColumnTable func() expr.Table + WriteColumn func(b *strings.Builder, a *render.Args, x ColumnExtras) + type Constraint interface + WriteConstraint func(b *strings.Builder, a *render.Args) + func Check(c TableConstraint, p expr.Predicate) Constraint + func OneOf[T any](c TableConstraint, col expr.Expr[T], values ...T) Constraint + type CreateTable struct + func NewCreateTable[D render.Dialect](d D, t expr.Table) *CreateTable[D] + func (c *CreateTable[D]) Clause(cs ...TableClause[D]) *CreateTable[D] + func (c *CreateTable[D]) Column(first ColumnSpec, more ...ColumnSpec) *CreateTableReady[D] + func (c *CreateTable[D]) Constraint(cs ...Constraint) *CreateTable[D] + func (c *CreateTable[D]) IfNotExists() *CreateTable[D] + type CreateTableReady struct + func (c *CreateTableReady[D]) Build() (Script, error) + func (c *CreateTableReady[D]) Clause(cs ...TableClause[D]) *CreateTableReady[D] + func (c *CreateTableReady[D]) Column(cols ...ColumnSpec) *CreateTableReady[D] + func (c *CreateTableReady[D]) Constraint(cs ...Constraint) *CreateTableReady[D] + func (c *CreateTableReady[D]) Describe() (schema.Table, error) + func (c *CreateTableReady[D]) IfNotExists() *CreateTableReady[D] + func (c *CreateTableReady[D]) Table() expr.Table + type DefaultKind int + const DefaultExpression + const DefaultLiteral + const DefaultNone + type DefaultRequirer interface + RequiresDefault func() bool + type Describer interface + DescribeInto func(t *schema.Table) + type DropClause interface + DropClauseOf func(D) + WriteSQL func(b *strings.Builder, a *render.Args) + func NewDropClause[D render.Dialect](render func(a *render.Args) string) DropClause[D] + type DropTable struct + func NewDropTable[D render.Dialect](d D, first expr.Table, more ...expr.Table) *DropTable[D] + func (s *DropTable[D]) Build() (Script, error) + func (s *DropTable[D]) Clause(cs ...DropClause[D]) *DropTable[D] + func (s *DropTable[D]) IfExists() *DropTable[D] + type FactsReporter interface + ColumnFacts func() ColumnFacts + type JSONStorer interface + StoresJSON func() bool + type ListedOption interface + ListedOption func() + type OptionRank int + type OptionRanker interface + OptionRank func() OptionRank + type Position int + const PositionColumn + const PositionElement + const PositionModifier + const PositionOption + type SQLType interface + Spelling func(d render.Dialect) (string, error) + TypeOf func(T) + func Portable[T any](t schema.Type) SQLType[T] + func RawJSONType[T any](spelling string) SQLType[T] + func RawType[T any](spelling string) SQLType[T] + type Script []Statement + func (s Script) SQL() []string + func (s Script) Transactional() bool + type Statement struct + MustReturnNoRows bool + OutsideTransaction bool + SQL string + SkipIf string + Transactional bool + type TableChecker interface + CheckTable func(t schema.Table) error + type TableClause interface + Position func() Position + TableClauseOf func(D) + WriteSQL func(b *strings.Builder, a *render.Args) + func NewOptionClauseOn[D render.Dialect](rank OptionRank, cols []ColumnRef, render func(a *render.Args) string) TableClause[D] + func NewOptionClause[D render.Dialect](rank OptionRank, render func(a *render.Args) string) TableClause[D] + func NewTableClauseOn[D render.Dialect](pos Position, cols []ColumnRef, render func(a *render.Args) string) TableClause[D] + func NewTableClause[D render.Dialect](pos Position, render func(a *render.Args) string) TableClause[D] + type TableConstraint struct + Name string + Table expr.Table + func (c TableConstraint) ClauseTable() expr.Table + func (c TableConstraint) Valid() bool + type TableNamer interface + ClauseTable func() expr.Table