Documentation
¶
Index ¶
- type BloatInfo
- type EmbeddingRow
- type ExtensionInfo
- type IndexBloatInfo
- type MongoDBProvider
- func (m *MongoDBProvider) AlterTableAdd(context.Context, string, db.ColumnDef) error
- func (m *MongoDBProvider) AlterTableDrop(context.Context, string, string) error
- func (m *MongoDBProvider) AlterTableRename(context.Context, string, string, string) error
- func (m *MongoDBProvider) Client() *mongo.Client
- func (m *MongoDBProvider) Close() error
- func (m *MongoDBProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error
- func (m *MongoDBProvider) CreateTable(ctx context.Context, name string, _ []db.ColumnDef, _ bool) error
- func (m *MongoDBProvider) CreateView(ctx context.Context, view db.ViewDef) error
- func (m *MongoDBProvider) DBName() string
- func (m *MongoDBProvider) Database() *mongo.Database
- func (m *MongoDBProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)
- func (m *MongoDBProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
- func (m *MongoDBProvider) DropIndex(ctx context.Context, table, indexName string) error
- func (m *MongoDBProvider) DropTable(ctx context.Context, name string, _ bool) error
- func (m *MongoDBProvider) DropView(ctx context.Context, name string) error
- func (m *MongoDBProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (m *MongoDBProvider) Kind() db.ProviderKind
- func (m *MongoDBProvider) ListConstraints(context.Context, string) ([]db.ConstraintInfo, error)
- func (m *MongoDBProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)
- func (m *MongoDBProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)
- func (m *MongoDBProvider) ListViews(ctx context.Context, _ string) ([]db.ViewInfo, error)
- func (m *MongoDBProvider) Ping(ctx context.Context) error
- func (m *MongoDBProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
- func (m *MongoDBProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
- type MySQLProvider
- func (m *MySQLProvider) AlterTableAdd(ctx context.Context, table string, column db.ColumnDef) error
- func (m *MySQLProvider) AlterTableDrop(ctx context.Context, table string, columnName string) error
- func (m *MySQLProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error
- func (m *MySQLProvider) Close() error
- func (m *MySQLProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error
- func (m *MySQLProvider) CreateTable(ctx context.Context, name string, columns []db.ColumnDef, ifNotExists bool) error
- func (m *MySQLProvider) CreateView(ctx context.Context, view db.ViewDef) error
- func (m *MySQLProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)
- func (m *MySQLProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
- func (m *MySQLProvider) DropIndex(ctx context.Context, table, indexName string) error
- func (m *MySQLProvider) DropTable(ctx context.Context, name string, ifExists bool) error
- func (m *MySQLProvider) DropView(ctx context.Context, name string) error
- func (m *MySQLProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (m *MySQLProvider) Kind() db.ProviderKind
- func (m *MySQLProvider) ListConstraints(ctx context.Context, table string) ([]db.ConstraintInfo, error)
- func (m *MySQLProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)
- func (m *MySQLProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)
- func (m *MySQLProvider) ListViews(ctx context.Context, _ string) ([]db.ViewInfo, error)
- func (m *MySQLProvider) Ping(ctx context.Context) error
- func (m *MySQLProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
- func (m *MySQLProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
- type PartitionInfo
- type PolicyDef
- type PolicyInfo
- type PostgresProvider
- func (p *PostgresProvider) AddTsvectorColumn(ctx context.Context, table, column, language string, sourceColumns []string) error
- func (p *PostgresProvider) AddVectorColumn(ctx context.Context, table, column string, dimensions int) error
- func (p *PostgresProvider) AlterTableAdd(ctx context.Context, table string, column db.ColumnDef) error
- func (p *PostgresProvider) AlterTableDrop(ctx context.Context, table string, columnName string) error
- func (p *PostgresProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error
- func (p *PostgresProvider) Analyze(ctx context.Context, table string, verbose bool) error
- func (p *PostgresProvider) BulkUpsertEmbeddings(ctx context.Context, table, idColumn, column string, rows []EmbeddingRow) error
- func (p *PostgresProvider) Close() error
- func (p *PostgresProvider) Cluster(ctx context.Context, table, index string) error
- func (p *PostgresProvider) CreateGINIndex(ctx context.Context, table, column, indexName string) error
- func (p *PostgresProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error
- func (p *PostgresProvider) CreateMaterializedView(ctx context.Context, name, query string, withData bool) error
- func (p *PostgresProvider) CreatePartition(ctx context.Context, parent, name, bound string) error
- func (p *PostgresProvider) CreatePartitionedTable(ctx context.Context, name string, columns []db.ColumnDef, ...) error
- func (p *PostgresProvider) CreatePolicy(ctx context.Context, pol PolicyDef) error
- func (p *PostgresProvider) CreateRole(ctx context.Context, name, password string, login, createdb, superuser bool) error
- func (p *PostgresProvider) CreateSchema(ctx context.Context, name, authorization string) error
- func (p *PostgresProvider) CreateTable(ctx context.Context, name string, columns []db.ColumnDef, ifNotExists bool) error
- func (p *PostgresProvider) CreateTrigger(ctx context.Context, table, name, timing string, events []string, ...) error
- func (p *PostgresProvider) CreateTriggerFunction(ctx context.Context, name, body, language string, replace bool) error
- func (p *PostgresProvider) CreateVectorIndex(ctx context.Context, table, column, method, distance string, ...) error
- func (p *PostgresProvider) CreateView(ctx context.Context, view db.ViewDef) error
- func (p *PostgresProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)
- func (p *PostgresProvider) DeleteEmbeddings(ctx context.Context, table, idColumn string, ids []string, where string) (int64, error)
- func (p *PostgresProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
- func (p *PostgresProvider) DetachPartition(ctx context.Context, parent, partition string, concurrent bool) error
- func (p *PostgresProvider) DisableRLS(ctx context.Context, table string) error
- func (p *PostgresProvider) DropIndex(ctx context.Context, _ string, indexName string) error
- func (p *PostgresProvider) DropSchema(ctx context.Context, name string, cascade bool) error
- func (p *PostgresProvider) DropTable(ctx context.Context, name string, ifExists bool) error
- func (p *PostgresProvider) DropTrigger(ctx context.Context, table, name string, cascade bool) error
- func (p *PostgresProvider) DropView(ctx context.Context, name string) error
- func (p *PostgresProvider) EnableExtension(ctx context.Context, name, schema string) error
- func (p *PostgresProvider) EnableRLS(ctx context.Context, table string, force bool) error
- func (p *PostgresProvider) EnableVectors(ctx context.Context) error
- func (p *PostgresProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (p *PostgresProvider) FTSSearch(ctx context.Context, table, column, query, language string, limit int) ([]map[string]any, error)
- func (p *PostgresProvider) GetSearchPath(ctx context.Context) (string, error)
- func (p *PostgresProvider) GetVectorStats(ctx context.Context, table, column string) (*VectorStats, error)
- func (p *PostgresProvider) Grant(ctx context.Context, privileges, on, to string) error
- func (p *PostgresProvider) IndexBloat(ctx context.Context, minBloatPct float64) ([]IndexBloatInfo, error)
- func (p *PostgresProvider) Kind() db.ProviderKind
- func (p *PostgresProvider) ListChannels(ctx context.Context) ([]string, error)
- func (p *PostgresProvider) ListConstraints(ctx context.Context, table string) ([]db.ConstraintInfo, error)
- func (p *PostgresProvider) ListExtensions(ctx context.Context, available bool) ([]ExtensionInfo, error)
- func (p *PostgresProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)
- func (p *PostgresProvider) ListPartitions(ctx context.Context, table string) ([]PartitionInfo, error)
- func (p *PostgresProvider) ListPolicies(ctx context.Context, table string) ([]PolicyInfo, error)
- func (p *PostgresProvider) ListPublications(ctx context.Context) ([]PublicationInfo, error)
- func (p *PostgresProvider) ListReplicationSlots(ctx context.Context) ([]ReplicationSlot, error)
- func (p *PostgresProvider) ListRoles(ctx context.Context) ([]RoleInfo, error)
- func (p *PostgresProvider) ListSchemas(ctx context.Context) ([]SchemaInfo, error)
- func (p *PostgresProvider) ListTables(ctx context.Context, schema string) ([]db.TableInfo, error)
- func (p *PostgresProvider) ListTriggers(ctx context.Context, table string) ([]TriggerInfo, error)
- func (p *PostgresProvider) ListViews(ctx context.Context, schema string) ([]db.ViewInfo, error)
- func (p *PostgresProvider) Listen(ctx context.Context, channel string) error
- func (p *PostgresProvider) Notify(ctx context.Context, channel, payload string) error
- func (p *PostgresProvider) Ping(ctx context.Context) error
- func (p *PostgresProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
- func (p *PostgresProvider) RefreshMaterializedView(ctx context.Context, name string, concurrently bool) error
- func (p *PostgresProvider) Reindex(ctx context.Context, target, name string, concurrent bool) error
- func (p *PostgresProvider) ReplicationStatus(ctx context.Context) ([]ReplicationStat, error)
- func (p *PostgresProvider) Revoke(ctx context.Context, privileges, on, from string) error
- func (p *PostgresProvider) SetSearchPath(ctx context.Context, schemas []string) error
- func (p *PostgresProvider) TableBloat(ctx context.Context, table string) ([]BloatInfo, error)
- func (p *PostgresProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
- func (p *PostgresProvider) UpsertEmbedding(ctx context.Context, table, idColumn, idValue, column string, vector []float64, ...) error
- func (p *PostgresProvider) Vacuum(ctx context.Context, table string, analyze, full bool) error
- func (p *PostgresProvider) VectorSearch(ctx context.Context, table, column string, queryVector []float64, ...) ([]map[string]any, error)
- type PublicationInfo
- type RedisProvider
- func (r *RedisProvider) AlterTableAdd(context.Context, string, db.ColumnDef) error
- func (r *RedisProvider) AlterTableDrop(context.Context, string, string) error
- func (r *RedisProvider) AlterTableRename(context.Context, string, string, string) error
- func (r *RedisProvider) Client() *redis.Client
- func (r *RedisProvider) Close() error
- func (r *RedisProvider) CreateIndex(context.Context, string, db.IndexDef) error
- func (r *RedisProvider) CreateTable(context.Context, string, []db.ColumnDef, bool) error
- func (r *RedisProvider) CreateView(context.Context, db.ViewDef) error
- func (r *RedisProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)
- func (r *RedisProvider) DescribeTable(context.Context, string) ([]db.ColumnInfo, error)
- func (r *RedisProvider) DropIndex(context.Context, string, string) error
- func (r *RedisProvider) DropTable(context.Context, string, bool) error
- func (r *RedisProvider) DropView(context.Context, string) error
- func (r *RedisProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (r *RedisProvider) Kind() db.ProviderKind
- func (r *RedisProvider) ListConstraints(context.Context, string) ([]db.ConstraintInfo, error)
- func (r *RedisProvider) ListIndexes(context.Context, string) ([]db.IndexInfo, error)
- func (r *RedisProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)
- func (r *RedisProvider) ListViews(context.Context, string) ([]db.ViewInfo, error)
- func (r *RedisProvider) Ping(ctx context.Context) error
- func (r *RedisProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
- func (r *RedisProvider) TableSize(ctx context.Context, _ string) (*db.TableStats, error)
- type ReplicationSlot
- type ReplicationStat
- type RoleInfo
- type SQLiteProvider
- func (s *SQLiteProvider) AlterTableAdd(ctx context.Context, table string, column db.ColumnDef) error
- func (s *SQLiteProvider) AlterTableDrop(ctx context.Context, table string, columnName string) error
- func (s *SQLiteProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error
- func (s *SQLiteProvider) Close() error
- func (s *SQLiteProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error
- func (s *SQLiteProvider) CreateTable(ctx context.Context, name string, columns []db.ColumnDef, ifNotExists bool) error
- func (s *SQLiteProvider) CreateView(ctx context.Context, view db.ViewDef) error
- func (s *SQLiteProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)
- func (s *SQLiteProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
- func (s *SQLiteProvider) DropIndex(ctx context.Context, _ string, indexName string) error
- func (s *SQLiteProvider) DropTable(ctx context.Context, name string, ifExists bool) error
- func (s *SQLiteProvider) DropView(ctx context.Context, name string) error
- func (s *SQLiteProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (s *SQLiteProvider) Kind() db.ProviderKind
- func (s *SQLiteProvider) ListConstraints(ctx context.Context, table string) ([]db.ConstraintInfo, error)
- func (s *SQLiteProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)
- func (s *SQLiteProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)
- func (s *SQLiteProvider) ListViews(ctx context.Context, _ string) ([]db.ViewInfo, error)
- func (s *SQLiteProvider) Ping(ctx context.Context) error
- func (s *SQLiteProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
- func (s *SQLiteProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
- type SchemaInfo
- type TriggerInfo
- type VectorStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BloatInfo ¶
type BloatInfo struct {
Name string
SchemaName string
TableSize int64
DeadTuples int64
LiveTuples int64
LastVacuum string
LastAutoVac string
LastAnalyze string
BloatRatio float64
}
BloatInfo holds table or index bloat statistics.
type EmbeddingRow ¶
EmbeddingRow represents a row for bulk upsert.
type ExtensionInfo ¶
type ExtensionInfo struct {
Name string
Version string
Schema string
Comment string
Installed bool
}
ExtensionInfo holds metadata about a PostgreSQL extension.
type IndexBloatInfo ¶
type IndexBloatInfo struct {
SchemaName string
TableName string
IndexName string
IndexSize int64
TableSize int64
BloatPct float64
}
IndexBloatInfo holds index-level bloat statistics.
type MongoDBProvider ¶
type MongoDBProvider struct {
// contains filtered or unexported fields
}
MongoDBProvider implements db.Provider for MongoDB.
func (*MongoDBProvider) AlterTableAdd ¶
func (*MongoDBProvider) AlterTableDrop ¶
func (*MongoDBProvider) AlterTableRename ¶
func (*MongoDBProvider) Client ¶
func (m *MongoDBProvider) Client() *mongo.Client
Client returns the underlying mongo.Client.
func (*MongoDBProvider) Close ¶
func (m *MongoDBProvider) Close() error
func (*MongoDBProvider) CreateIndex ¶
CreateIndex creates an index on a collection.
func (*MongoDBProvider) CreateTable ¶
func (m *MongoDBProvider) CreateTable(ctx context.Context, name string, _ []db.ColumnDef, _ bool) error
CreateTable creates a new collection.
func (*MongoDBProvider) CreateView ¶
CreateView creates a MongoDB view.
func (*MongoDBProvider) DBName ¶
func (m *MongoDBProvider) DBName() string
DBName returns the database name.
func (*MongoDBProvider) Database ¶
func (m *MongoDBProvider) Database() *mongo.Database
Database returns the mongo.Database for this connection.
func (*MongoDBProvider) DatabaseStats ¶
DatabaseStats returns database-level stats.
func (*MongoDBProvider) DescribeTable ¶
func (m *MongoDBProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
DescribeTable samples the first document and infers fields/types.
func (*MongoDBProvider) DropIndex ¶
func (m *MongoDBProvider) DropIndex(ctx context.Context, table, indexName string) error
DropIndex drops an index from a collection.
func (*MongoDBProvider) DropView ¶
func (m *MongoDBProvider) DropView(ctx context.Context, name string) error
DropView drops a view (same as dropping a collection in MongoDB).
func (*MongoDBProvider) Exec ¶
Exec runs a database command (e.g. insert, update, delete) via RunCommand. query is the command JSON. Returns 1 on success.
func (*MongoDBProvider) Kind ¶
func (m *MongoDBProvider) Kind() db.ProviderKind
func (*MongoDBProvider) ListConstraints ¶
func (m *MongoDBProvider) ListConstraints(context.Context, string) ([]db.ConstraintInfo, error)
func (*MongoDBProvider) ListIndexes ¶
ListIndexes returns indexes on a collection.
func (*MongoDBProvider) ListTables ¶
ListTables returns collection names.
func (*MongoDBProvider) Query ¶
func (m *MongoDBProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
Query interprets the query string as a collection name and uses args[0] as a JSON filter string. Returns matching documents as maps.
func (*MongoDBProvider) TableSize ¶
func (m *MongoDBProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
TableSize returns collection stats (document count + storage size).
type MySQLProvider ¶
type MySQLProvider struct {
// contains filtered or unexported fields
}
MySQLProvider implements db.Provider for MySQL databases.
func NewMySQL ¶
func NewMySQL(sqlDB *sql.DB) *MySQLProvider
NewMySQL creates a new MySQLProvider wrapping the given *sql.DB.
func (*MySQLProvider) AlterTableAdd ¶
func (*MySQLProvider) AlterTableDrop ¶
func (*MySQLProvider) AlterTableRename ¶
func (m *MySQLProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error
func (*MySQLProvider) Close ¶
func (m *MySQLProvider) Close() error
func (*MySQLProvider) CreateIndex ¶
func (*MySQLProvider) CreateTable ¶
func (*MySQLProvider) CreateView ¶
func (*MySQLProvider) DatabaseStats ¶
func (*MySQLProvider) DescribeTable ¶
func (m *MySQLProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
func (*MySQLProvider) DropIndex ¶
func (m *MySQLProvider) DropIndex(ctx context.Context, table, indexName string) error
func (*MySQLProvider) DropView ¶
func (m *MySQLProvider) DropView(ctx context.Context, name string) error
func (*MySQLProvider) Kind ¶
func (m *MySQLProvider) Kind() db.ProviderKind
func (*MySQLProvider) ListConstraints ¶
func (m *MySQLProvider) ListConstraints(ctx context.Context, table string) ([]db.ConstraintInfo, error)
func (*MySQLProvider) ListIndexes ¶
func (*MySQLProvider) ListTables ¶
func (*MySQLProvider) TableSize ¶
func (m *MySQLProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
type PartitionInfo ¶
PartitionInfo holds metadata about a table partition.
type PolicyDef ¶
type PolicyDef struct {
Table string
Name string
Permissive bool
Command string // ALL, SELECT, INSERT, UPDATE, DELETE
Roles []string
Using string
WithCheck string
}
PolicyDef defines a Row-Level Security policy.
type PolicyInfo ¶
type PolicyInfo struct {
Name string
Table string
Permissive string
Roles string
Command string
Using string
WithCheck string
}
PolicyInfo holds metadata about an RLS policy.
type PostgresProvider ¶
type PostgresProvider struct {
// contains filtered or unexported fields
}
PostgresProvider implements db.Provider for PostgreSQL databases.
func NewPostgres ¶
func NewPostgres(sqlDB *sql.DB) *PostgresProvider
NewPostgres creates a new PostgresProvider wrapping the given *sql.DB.
func (*PostgresProvider) AddTsvectorColumn ¶
func (p *PostgresProvider) AddTsvectorColumn(ctx context.Context, table, column, language string, sourceColumns []string) error
AddTsvectorColumn adds a tsvector column with an auto-update trigger.
func (*PostgresProvider) AddVectorColumn ¶
func (p *PostgresProvider) AddVectorColumn(ctx context.Context, table, column string, dimensions int) error
AddVectorColumn adds a vector column to a table.
func (*PostgresProvider) AlterTableAdd ¶
func (*PostgresProvider) AlterTableDrop ¶
func (*PostgresProvider) AlterTableRename ¶
func (p *PostgresProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error
func (*PostgresProvider) BulkUpsertEmbeddings ¶
func (p *PostgresProvider) BulkUpsertEmbeddings(ctx context.Context, table, idColumn, column string, rows []EmbeddingRow) error
BulkUpsertEmbeddings inserts or updates multiple embeddings in a transaction.
func (*PostgresProvider) Close ¶
func (p *PostgresProvider) Close() error
func (*PostgresProvider) Cluster ¶
func (p *PostgresProvider) Cluster(ctx context.Context, table, index string) error
Cluster re-orders a table on disk based on an index.
func (*PostgresProvider) CreateGINIndex ¶
func (p *PostgresProvider) CreateGINIndex(ctx context.Context, table, column, indexName string) error
CreateGINIndex creates a GIN index on a tsvector or JSONB column.
func (*PostgresProvider) CreateIndex ¶
func (*PostgresProvider) CreateMaterializedView ¶
func (p *PostgresProvider) CreateMaterializedView(ctx context.Context, name, query string, withData bool) error
CreateMaterializedView creates a materialized view.
func (*PostgresProvider) CreatePartition ¶
func (p *PostgresProvider) CreatePartition(ctx context.Context, parent, name, bound string) error
CreatePartition creates a partition of a parent table.
func (*PostgresProvider) CreatePartitionedTable ¶
func (p *PostgresProvider) CreatePartitionedTable(ctx context.Context, name string, columns []db.ColumnDef, partitionBy, partitionKey string) error
CreatePartitionedTable creates a partitioned table.
func (*PostgresProvider) CreatePolicy ¶
func (p *PostgresProvider) CreatePolicy(ctx context.Context, pol PolicyDef) error
CreatePolicy creates a Row-Level Security policy.
func (*PostgresProvider) CreateRole ¶
func (p *PostgresProvider) CreateRole(ctx context.Context, name, password string, login, createdb, superuser bool) error
CreateRole creates a new database role.
func (*PostgresProvider) CreateSchema ¶
func (p *PostgresProvider) CreateSchema(ctx context.Context, name, authorization string) error
CreateSchema creates a new PostgreSQL schema.
func (*PostgresProvider) CreateTable ¶
func (*PostgresProvider) CreateTrigger ¶
func (p *PostgresProvider) CreateTrigger(ctx context.Context, table, name, timing string, events []string, level, function, whenCondition string) error
CreateTrigger creates a trigger on a table.
func (*PostgresProvider) CreateTriggerFunction ¶
func (p *PostgresProvider) CreateTriggerFunction(ctx context.Context, name, body, language string, replace bool) error
CreateTriggerFunction creates a PL/pgSQL function that returns TRIGGER.
func (*PostgresProvider) CreateVectorIndex ¶
func (p *PostgresProvider) CreateVectorIndex(ctx context.Context, table, column, method, distance string, m, efConstruction, lists int) error
CreateVectorIndex creates an HNSW or IVFFlat index on a vector column.
func (*PostgresProvider) CreateView ¶
func (*PostgresProvider) DatabaseStats ¶
func (*PostgresProvider) DeleteEmbeddings ¶
func (p *PostgresProvider) DeleteEmbeddings(ctx context.Context, table, idColumn string, ids []string, where string) (int64, error)
DeleteEmbeddings deletes rows by ID list or WHERE filter.
func (*PostgresProvider) DescribeTable ¶
func (p *PostgresProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
func (*PostgresProvider) DetachPartition ¶
func (p *PostgresProvider) DetachPartition(ctx context.Context, parent, partition string, concurrent bool) error
DetachPartition detaches a partition from its parent table.
func (*PostgresProvider) DisableRLS ¶
func (p *PostgresProvider) DisableRLS(ctx context.Context, table string) error
DisableRLS disables row-level security on a table.
func (*PostgresProvider) DropSchema ¶
DropSchema drops a PostgreSQL schema.
func (*PostgresProvider) DropTrigger ¶
DropTrigger drops a trigger from a table.
func (*PostgresProvider) DropView ¶
func (p *PostgresProvider) DropView(ctx context.Context, name string) error
func (*PostgresProvider) EnableExtension ¶
func (p *PostgresProvider) EnableExtension(ctx context.Context, name, schema string) error
EnableExtension installs a PostgreSQL extension.
func (*PostgresProvider) EnableVectors ¶
func (p *PostgresProvider) EnableVectors(ctx context.Context) error
EnableVectors enables the pgvector extension.
func (*PostgresProvider) FTSSearch ¶
func (p *PostgresProvider) FTSSearch(ctx context.Context, table, column, query, language string, limit int) ([]map[string]any, error)
FTSSearch performs a full-text search on a tsvector column.
func (*PostgresProvider) GetSearchPath ¶
func (p *PostgresProvider) GetSearchPath(ctx context.Context) (string, error)
GetSearchPath returns the current search_path setting.
func (*PostgresProvider) GetVectorStats ¶
func (p *PostgresProvider) GetVectorStats(ctx context.Context, table, column string) (*VectorStats, error)
GetVectorStats returns statistics about a vector column.
func (*PostgresProvider) Grant ¶
func (p *PostgresProvider) Grant(ctx context.Context, privileges, on, to string) error
Grant grants privileges to a role.
func (*PostgresProvider) IndexBloat ¶
func (p *PostgresProvider) IndexBloat(ctx context.Context, minBloatPct float64) ([]IndexBloatInfo, error)
IndexBloat returns estimated index bloat data.
func (*PostgresProvider) Kind ¶
func (p *PostgresProvider) Kind() db.ProviderKind
func (*PostgresProvider) ListChannels ¶
func (p *PostgresProvider) ListChannels(ctx context.Context) ([]string, error)
ListChannels returns channels currently being listened on.
func (*PostgresProvider) ListConstraints ¶
func (p *PostgresProvider) ListConstraints(ctx context.Context, table string) ([]db.ConstraintInfo, error)
func (*PostgresProvider) ListExtensions ¶
func (p *PostgresProvider) ListExtensions(ctx context.Context, available bool) ([]ExtensionInfo, error)
ListExtensions lists installed or available extensions.
func (*PostgresProvider) ListIndexes ¶
func (*PostgresProvider) ListPartitions ¶
func (p *PostgresProvider) ListPartitions(ctx context.Context, table string) ([]PartitionInfo, error)
ListPartitions lists partitions of a table.
func (*PostgresProvider) ListPolicies ¶
func (p *PostgresProvider) ListPolicies(ctx context.Context, table string) ([]PolicyInfo, error)
ListPolicies lists RLS policies, optionally filtered by table.
func (*PostgresProvider) ListPublications ¶
func (p *PostgresProvider) ListPublications(ctx context.Context) ([]PublicationInfo, error)
ListPublications returns logical replication publications.
func (*PostgresProvider) ListReplicationSlots ¶
func (p *PostgresProvider) ListReplicationSlots(ctx context.Context) ([]ReplicationSlot, error)
ListReplicationSlots returns all replication slots.
func (*PostgresProvider) ListRoles ¶
func (p *PostgresProvider) ListRoles(ctx context.Context) ([]RoleInfo, error)
ListRoles lists all roles/users.
func (*PostgresProvider) ListSchemas ¶
func (p *PostgresProvider) ListSchemas(ctx context.Context) ([]SchemaInfo, error)
ListSchemas returns all schemas in the database.
func (*PostgresProvider) ListTables ¶
func (*PostgresProvider) ListTriggers ¶
func (p *PostgresProvider) ListTriggers(ctx context.Context, table string) ([]TriggerInfo, error)
ListTriggers lists triggers, optionally filtered by table.
func (*PostgresProvider) Listen ¶
func (p *PostgresProvider) Listen(ctx context.Context, channel string) error
Listen registers a LISTEN on a channel.
func (*PostgresProvider) Notify ¶
func (p *PostgresProvider) Notify(ctx context.Context, channel, payload string) error
Notify sends a NOTIFY on a channel with optional payload.
func (*PostgresProvider) RefreshMaterializedView ¶
func (p *PostgresProvider) RefreshMaterializedView(ctx context.Context, name string, concurrently bool) error
RefreshMaterializedView refreshes a materialized view.
func (*PostgresProvider) Reindex ¶
Reindex rebuilds an index, table indexes, or entire database indexes.
func (*PostgresProvider) ReplicationStatus ¶
func (p *PostgresProvider) ReplicationStatus(ctx context.Context) ([]ReplicationStat, error)
ReplicationStatus returns pg_stat_replication data.
func (*PostgresProvider) Revoke ¶
func (p *PostgresProvider) Revoke(ctx context.Context, privileges, on, from string) error
Revoke revokes privileges from a role.
func (*PostgresProvider) SetSearchPath ¶
func (p *PostgresProvider) SetSearchPath(ctx context.Context, schemas []string) error
SetSearchPath sets the PostgreSQL search_path for the current session.
func (*PostgresProvider) TableBloat ¶
TableBloat returns bloat statistics for tables.
func (*PostgresProvider) TableSize ¶
func (p *PostgresProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
func (*PostgresProvider) UpsertEmbedding ¶
func (p *PostgresProvider) UpsertEmbedding(ctx context.Context, table, idColumn, idValue, column string, vector []float64, metadataCol string, metadata map[string]any) error
UpsertEmbedding inserts or updates an embedding vector for a row.
type PublicationInfo ¶
type PublicationInfo struct {
Name string
Owner string
AllTables bool
Insert bool
Update bool
Delete bool
Tables []string
}
PublicationInfo holds logical replication publication info.
type RedisProvider ¶
type RedisProvider struct {
// contains filtered or unexported fields
}
RedisProvider implements db.Provider for Redis.
func (*RedisProvider) AlterTableAdd ¶
func (*RedisProvider) AlterTableDrop ¶
func (*RedisProvider) AlterTableRename ¶
func (*RedisProvider) Client ¶
func (r *RedisProvider) Client() *redis.Client
Client returns the underlying redis.Client for use by Redis-specific tools.
func (*RedisProvider) Close ¶
func (r *RedisProvider) Close() error
func (*RedisProvider) CreateIndex ¶
func (*RedisProvider) CreateTable ¶
func (*RedisProvider) CreateView ¶
func (*RedisProvider) DatabaseStats ¶
DatabaseStats returns INFO server + memory + DBSIZE.
func (*RedisProvider) DescribeTable ¶
func (r *RedisProvider) DescribeTable(context.Context, string) ([]db.ColumnInfo, error)
func (*RedisProvider) Exec ¶
Exec interprets the string as a raw Redis command via Do(). Returns 1 on success.
func (*RedisProvider) Kind ¶
func (r *RedisProvider) Kind() db.ProviderKind
func (*RedisProvider) ListConstraints ¶
func (r *RedisProvider) ListConstraints(context.Context, string) ([]db.ConstraintInfo, error)
func (*RedisProvider) ListIndexes ¶
func (*RedisProvider) ListTables ¶
ListTables returns keyspace databases from INFO keyspace.
func (*RedisProvider) Query ¶
func (r *RedisProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)
Query interprets the string as a raw Redis command via Do(). Returns the result as a single-row map.
func (*RedisProvider) TableSize ¶
func (r *RedisProvider) TableSize(ctx context.Context, _ string) (*db.TableStats, error)
TableSize returns DBSIZE (key count) as the "row count".
type ReplicationSlot ¶
type ReplicationSlot struct {
Name string
Plugin string
SlotType string
Active bool
RestLSN string
}
ReplicationSlot holds replication slot information.
type ReplicationStat ¶
type ReplicationStat struct {
PID int64
UserName string
AppName string
ClientIP string
State string
SentLSN string
WriteLSN string
FlushLSN string
ReplayLSN string
}
ReplicationStat holds replication status information.
type RoleInfo ¶
type RoleInfo struct {
Name string
SuperUser bool
CreateDB bool
CreateRole bool
Login bool
Replication bool
ConnLimit int
}
RoleInfo holds metadata about a database role.
type SQLiteProvider ¶
type SQLiteProvider struct {
// contains filtered or unexported fields
}
SQLiteProvider implements db.Provider for SQLite databases.
func NewSQLite ¶
func NewSQLite(sqlDB *sql.DB) *SQLiteProvider
NewSQLite creates a new SQLite provider wrapping the given *sql.DB.
func (*SQLiteProvider) AlterTableAdd ¶
func (*SQLiteProvider) AlterTableDrop ¶
func (*SQLiteProvider) AlterTableRename ¶
func (s *SQLiteProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error
func (*SQLiteProvider) Close ¶
func (s *SQLiteProvider) Close() error
func (*SQLiteProvider) CreateIndex ¶
func (*SQLiteProvider) CreateTable ¶
func (*SQLiteProvider) CreateView ¶
func (*SQLiteProvider) DatabaseStats ¶
func (*SQLiteProvider) DescribeTable ¶
func (s *SQLiteProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)
func (*SQLiteProvider) DropView ¶
func (s *SQLiteProvider) DropView(ctx context.Context, name string) error
func (*SQLiteProvider) Kind ¶
func (s *SQLiteProvider) Kind() db.ProviderKind
func (*SQLiteProvider) ListConstraints ¶
func (s *SQLiteProvider) ListConstraints(ctx context.Context, table string) ([]db.ConstraintInfo, error)
func (*SQLiteProvider) ListIndexes ¶
func (*SQLiteProvider) ListTables ¶
func (*SQLiteProvider) TableSize ¶
func (s *SQLiteProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)
type SchemaInfo ¶
SchemaInfo holds metadata about a PostgreSQL schema.
type TriggerInfo ¶
type TriggerInfo struct {
Name string
Table string
Timing string // BEFORE, AFTER, INSTEAD OF
Events []string // INSERT, UPDATE, DELETE
Level string // ROW, STATEMENT
Function string
Condition string
Enabled string // O=origin, D=disabled, R=replica, A=always
}
TriggerInfo holds metadata about a PostgreSQL trigger.