Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnInfo ¶ added in v0.0.2
ColumnInfo describes a single column returned by SchemaInspector.
type Compiler ¶ added in v0.0.2
Compiler is implemented by dialect adapters (sqlt, postgres). It renders a DDL Stmt to engine SQL. It is the DDL counterpart of storage.Compiler (which stays DML-only).
type DB ¶ added in v0.0.2
type DB struct {
// contains filtered or unexported fields
}
DB applies schema changes through a storage.Conn: Exec for the compiled DDL, and Compile (the DML half storage.Conn already carries) for Sync's safe-drop SELECT probe. No separate DML compiler argument is needed — storage.Conn already unifies Executor+Compiler.
func (*DB) CreateDatabase ¶ added in v0.0.2
CreateDatabase creates a new database. No model.Model needed — OpCreateDatabase only carries the database name.
func (*DB) CreateTable ¶ added in v0.0.2
CreateTable creates a new table for the given model.
type Op ¶ added in v0.0.2
type Op int
Op is a DDL operation (schema), distinct from storage's DML Action.
type RenameProvider ¶ added in v0.0.2
RenameProvider is implemented by generated models when db:"old_name=X" tags are present.
type SchemaInspector ¶ added in v0.0.2
type SchemaInspector interface {
Tables() ([]string, error)
Columns(table string) ([]ColumnInfo, error)
}
SchemaInspector is optionally implemented by storage.Conn to expose broader schema introspection. If the adapter does not implement it, the db_schema MCP tool is not registered.
type Stmt ¶ added in v0.0.2
type Stmt struct {
Op Op
Table string
Database string
Column *model.Field // for AddColumn/RenameColumn — full field metadata needed to render the type
OldName string // for RenameColumn
// ColumnName carries a bare column name for operations that don't need type info —
// currently only OpDropColumn (you can't "add" or "rename to" a column without knowing
// its type, but dropping only needs the name). Deliberately separate from Column: giving
// DropColumn a *model.Field would force callers to fabricate a fake Field just to carry a
// string, which is worse than a second field that's simply unused by the other Ops.
ColumnName string
}
Stmt is one DDL statement to run through a storage.Conn.
type TableIntrospector ¶ added in v0.0.2
TableIntrospector is optionally implemented by the injected storage.Conn to retrieve column names.