Help us shape the future of Go! Take the 2026 Go Developer Survey

providers

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

type EmbeddingRow struct {
	ID     string
	Vector []float64
}

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 (m *MongoDBProvider) AlterTableAdd(context.Context, string, db.ColumnDef) error

func (*MongoDBProvider) AlterTableDrop

func (m *MongoDBProvider) AlterTableDrop(context.Context, string, string) error

func (*MongoDBProvider) AlterTableRename

func (m *MongoDBProvider) AlterTableRename(context.Context, string, string, string) error

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

func (m *MongoDBProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error

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

func (m *MongoDBProvider) CreateView(ctx context.Context, view db.ViewDef) error

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

func (m *MongoDBProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)

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) DropTable

func (m *MongoDBProvider) DropTable(ctx context.Context, name string, _ bool) error

DropTable drops 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

func (m *MongoDBProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)

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

func (m *MongoDBProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)

ListIndexes returns indexes on a collection.

func (*MongoDBProvider) ListTables

func (m *MongoDBProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)

ListTables returns collection names.

func (*MongoDBProvider) ListViews

func (m *MongoDBProvider) ListViews(ctx context.Context, _ string) ([]db.ViewInfo, error)

ListViews returns views (collections with type "view").

func (*MongoDBProvider) Ping

func (m *MongoDBProvider) Ping(ctx context.Context) error

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 (m *MySQLProvider) AlterTableAdd(ctx context.Context, table string, column db.ColumnDef) error

func (*MySQLProvider) AlterTableDrop

func (m *MySQLProvider) AlterTableDrop(ctx context.Context, table string, columnName string) error

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 (m *MySQLProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error

func (*MySQLProvider) CreateTable

func (m *MySQLProvider) CreateTable(ctx context.Context, name string, columns []db.ColumnDef, ifNotExists bool) error

func (*MySQLProvider) CreateView

func (m *MySQLProvider) CreateView(ctx context.Context, view db.ViewDef) error

func (*MySQLProvider) DatabaseStats

func (m *MySQLProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)

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) DropTable

func (m *MySQLProvider) DropTable(ctx context.Context, name string, ifExists bool) error

func (*MySQLProvider) DropView

func (m *MySQLProvider) DropView(ctx context.Context, name string) error

func (*MySQLProvider) Exec

func (m *MySQLProvider) Exec(ctx context.Context, query string, args ...any) (int64, 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 (m *MySQLProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)

func (*MySQLProvider) ListTables

func (m *MySQLProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)

func (*MySQLProvider) ListViews

func (m *MySQLProvider) ListViews(ctx context.Context, _ string) ([]db.ViewInfo, error)

func (*MySQLProvider) Ping

func (m *MySQLProvider) Ping(ctx context.Context) error

func (*MySQLProvider) Query

func (m *MySQLProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)

func (*MySQLProvider) TableSize

func (m *MySQLProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)

type PartitionInfo

type PartitionInfo struct {
	Name       string
	Parent     string
	Expression string
}

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 (p *PostgresProvider) AlterTableAdd(ctx context.Context, table string, column db.ColumnDef) error

func (*PostgresProvider) AlterTableDrop

func (p *PostgresProvider) AlterTableDrop(ctx context.Context, table string, columnName string) error

func (*PostgresProvider) AlterTableRename

func (p *PostgresProvider) AlterTableRename(ctx context.Context, table, oldCol, newCol string) error

func (*PostgresProvider) Analyze

func (p *PostgresProvider) Analyze(ctx context.Context, table string, verbose bool) error

Analyze runs ANALYZE on a specific table or the entire database.

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 (p *PostgresProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error

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 (p *PostgresProvider) CreateTable(ctx context.Context, name string, columns []db.ColumnDef, ifNotExists bool) error

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 (p *PostgresProvider) CreateView(ctx context.Context, view db.ViewDef) error

func (*PostgresProvider) DatabaseStats

func (p *PostgresProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)

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) DropIndex

func (p *PostgresProvider) DropIndex(ctx context.Context, _ string, indexName string) error

func (*PostgresProvider) DropSchema

func (p *PostgresProvider) DropSchema(ctx context.Context, name string, cascade bool) error

DropSchema drops a PostgreSQL schema.

func (*PostgresProvider) DropTable

func (p *PostgresProvider) DropTable(ctx context.Context, name string, ifExists bool) error

func (*PostgresProvider) DropTrigger

func (p *PostgresProvider) DropTrigger(ctx context.Context, table, name string, cascade bool) error

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) EnableRLS

func (p *PostgresProvider) EnableRLS(ctx context.Context, table string, force bool) error

EnableRLS enables row-level security on a table.

func (*PostgresProvider) EnableVectors

func (p *PostgresProvider) EnableVectors(ctx context.Context) error

EnableVectors enables the pgvector extension.

func (*PostgresProvider) Exec

func (p *PostgresProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)

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 (p *PostgresProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)

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 (p *PostgresProvider) ListTables(ctx context.Context, schema string) ([]db.TableInfo, error)

func (*PostgresProvider) ListTriggers

func (p *PostgresProvider) ListTriggers(ctx context.Context, table string) ([]TriggerInfo, error)

ListTriggers lists triggers, optionally filtered by table.

func (*PostgresProvider) ListViews

func (p *PostgresProvider) ListViews(ctx context.Context, schema string) ([]db.ViewInfo, error)

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) Ping

func (p *PostgresProvider) Ping(ctx context.Context) error

func (*PostgresProvider) Query

func (p *PostgresProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)

func (*PostgresProvider) RefreshMaterializedView

func (p *PostgresProvider) RefreshMaterializedView(ctx context.Context, name string, concurrently bool) error

RefreshMaterializedView refreshes a materialized view.

func (*PostgresProvider) Reindex

func (p *PostgresProvider) Reindex(ctx context.Context, target, name string, concurrent bool) error

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

func (p *PostgresProvider) TableBloat(ctx context.Context, table string) ([]BloatInfo, error)

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.

func (*PostgresProvider) Vacuum

func (p *PostgresProvider) Vacuum(ctx context.Context, table string, analyze, full bool) error

Vacuum runs VACUUM on a specific table or the entire database.

func (*PostgresProvider) VectorSearch

func (p *PostgresProvider) VectorSearch(ctx context.Context, table, column string, queryVector []float64, distance string, limit int, selectColumns []string, where string) ([]map[string]any, error)

VectorSearch performs a similarity search on a vector column.

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 (r *RedisProvider) AlterTableAdd(context.Context, string, db.ColumnDef) error

func (*RedisProvider) AlterTableDrop

func (r *RedisProvider) AlterTableDrop(context.Context, string, string) error

func (*RedisProvider) AlterTableRename

func (r *RedisProvider) AlterTableRename(context.Context, string, string, string) error

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 (r *RedisProvider) CreateIndex(context.Context, string, db.IndexDef) error

func (*RedisProvider) CreateTable

func (r *RedisProvider) CreateTable(context.Context, string, []db.ColumnDef, bool) error

func (*RedisProvider) CreateView

func (r *RedisProvider) CreateView(context.Context, db.ViewDef) error

func (*RedisProvider) DatabaseStats

func (r *RedisProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)

DatabaseStats returns INFO server + memory + DBSIZE.

func (*RedisProvider) DescribeTable

func (r *RedisProvider) DescribeTable(context.Context, string) ([]db.ColumnInfo, error)

func (*RedisProvider) DropIndex

func (r *RedisProvider) DropIndex(context.Context, string, string) error

func (*RedisProvider) DropTable

func (r *RedisProvider) DropTable(context.Context, string, bool) error

func (*RedisProvider) DropView

func (r *RedisProvider) DropView(context.Context, string) error

func (*RedisProvider) Exec

func (r *RedisProvider) Exec(ctx context.Context, query string, args ...any) (int64, error)

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 (r *RedisProvider) ListIndexes(context.Context, string) ([]db.IndexInfo, error)

func (*RedisProvider) ListTables

func (r *RedisProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)

ListTables returns keyspace databases from INFO keyspace.

func (*RedisProvider) ListViews

func (r *RedisProvider) ListViews(context.Context, string) ([]db.ViewInfo, error)

func (*RedisProvider) Ping

func (r *RedisProvider) Ping(ctx context.Context) error

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 (s *SQLiteProvider) AlterTableAdd(ctx context.Context, table string, column db.ColumnDef) error

func (*SQLiteProvider) AlterTableDrop

func (s *SQLiteProvider) AlterTableDrop(ctx context.Context, table string, columnName string) error

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 (s *SQLiteProvider) CreateIndex(ctx context.Context, table string, index db.IndexDef) error

func (*SQLiteProvider) CreateTable

func (s *SQLiteProvider) CreateTable(ctx context.Context, name string, columns []db.ColumnDef, ifNotExists bool) error

func (*SQLiteProvider) CreateView

func (s *SQLiteProvider) CreateView(ctx context.Context, view db.ViewDef) error

func (*SQLiteProvider) DatabaseStats

func (s *SQLiteProvider) DatabaseStats(ctx context.Context) (*db.DbStats, error)

func (*SQLiteProvider) DescribeTable

func (s *SQLiteProvider) DescribeTable(ctx context.Context, table string) ([]db.ColumnInfo, error)

func (*SQLiteProvider) DropIndex

func (s *SQLiteProvider) DropIndex(ctx context.Context, _ string, indexName string) error

func (*SQLiteProvider) DropTable

func (s *SQLiteProvider) DropTable(ctx context.Context, name string, ifExists bool) error

func (*SQLiteProvider) DropView

func (s *SQLiteProvider) DropView(ctx context.Context, name string) error

func (*SQLiteProvider) Exec

func (s *SQLiteProvider) Exec(ctx context.Context, query string, args ...any) (int64, 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 (s *SQLiteProvider) ListIndexes(ctx context.Context, table string) ([]db.IndexInfo, error)

func (*SQLiteProvider) ListTables

func (s *SQLiteProvider) ListTables(ctx context.Context, _ string) ([]db.TableInfo, error)

func (*SQLiteProvider) ListViews

func (s *SQLiteProvider) ListViews(ctx context.Context, _ string) ([]db.ViewInfo, error)

func (*SQLiteProvider) Ping

func (s *SQLiteProvider) Ping(ctx context.Context) error

func (*SQLiteProvider) Query

func (s *SQLiteProvider) Query(ctx context.Context, query string, args ...any) ([]map[string]any, error)

func (*SQLiteProvider) TableSize

func (s *SQLiteProvider) TableSize(ctx context.Context, table string) (*db.TableStats, error)

type SchemaInfo

type SchemaInfo struct {
	Name    string
	Owner   string
	Default bool
}

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.

type VectorStats

type VectorStats struct {
	Table      string
	Column     string
	Dimensions int
	RowCount   int64
	IndexName  string
	IndexType  string
	IndexSize  string
}

VectorStats holds statistics about a vector column.

Jump to

Keyboard shortcuts

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