plugins

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDriverNotSelected = errors.New("driver not selected")

Functions

This section is empty.

Types

type MySQLBrowser added in v0.22.0

type MySQLBrowser struct {
	// contains filtered or unexported fields
}

func NewMySQLBrowser added in v0.22.0

func NewMySQLBrowser(driver *MySQLDriver) *MySQLBrowser

func (*MySQLBrowser) Connect added in v0.22.0

func (b *MySQLBrowser) Connect(ctx context.Context, dsn string) error

func (*MySQLBrowser) Disconnect added in v0.22.0

func (b *MySQLBrowser) Disconnect(ctx context.Context) error

func (*MySQLBrowser) List added in v0.22.0

func (b *MySQLBrowser) List(ctx context.Context, ids []string) ([]plugin.BrowserItem, error)

List navigates the MySQL database hierarchy:

[]                                       → databases
[database]                               → object type categories
[database, type]                         → objects of that type
[database, "table", name]                → table sub-categories
[database, "table", name, category]      → items in sub-category

func (*MySQLBrowser) ParseExplain added in v0.22.0

func (*MySQLBrowser) Query added in v0.22.0

func (*MySQLBrowser) Show added in v0.22.0

func (b *MySQLBrowser) Show(ctx context.Context, ids []string) (string, error)

type MySQLDriver added in v0.22.0

type MySQLDriver struct{}

func NewMySQLDriver added in v0.22.0

func NewMySQLDriver() *MySQLDriver

func (*MySQLDriver) Connect added in v0.22.0

func (*MySQLDriver) Disconnect added in v0.22.0

func (d *MySQLDriver) Disconnect(ctx context.Context, conn plugin.DriverConnection) error

type MySQLDriverConnection added in v0.22.0

type MySQLDriverConnection struct {
	DB *sql.DB
}

func (*MySQLDriverConnection) AppendAuditLog added in v0.22.0

func (*MySQLDriverConnection) LockAuditLog added in v0.22.0

func (*MySQLDriverConnection) Query added in v0.22.0

func (*MySQLDriverConnection) ReadAuditLogs added in v0.22.0

func (*MySQLDriverConnection) UnlockAuditLog added in v0.22.0

func (*MySQLDriverConnection) UpsertAuditLockTable added in v0.22.0

func (c *MySQLDriverConnection) UpsertAuditLockTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

func (*MySQLDriverConnection) UpsertAuditLogTable added in v0.22.0

func (c *MySQLDriverConnection) UpsertAuditLogTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

type MySQLQuery added in v0.22.0

type MySQLQuery struct {
	// contains filtered or unexported fields
}

func (*MySQLQuery) Begin added in v0.22.0

func (q *MySQLQuery) Begin(ctx context.Context) (plugin.DriverQuery, error)

func (*MySQLQuery) Commit added in v0.22.0

func (q *MySQLQuery) Commit(ctx context.Context) error

func (*MySQLQuery) Exec added in v0.22.0

func (q *MySQLQuery) Exec(ctx context.Context, query string, args ...any) error

func (*MySQLQuery) Query added in v0.22.0

func (q *MySQLQuery) Query(ctx context.Context, query string, args ...any) (*plugin.DriverQueryResult, error)

func (*MySQLQuery) Rollback added in v0.22.0

func (q *MySQLQuery) Rollback(ctx context.Context) error

type NullDriver

type NullDriver struct {
	plugin.Driver
}

func NewNullDriver

func NewNullDriver() *NullDriver

func (*NullDriver) Connect

func (*NullDriver) Disconnect

func (d *NullDriver) Disconnect(ctx context.Context, conn plugin.DriverConnection) error

type NullDriverConnection

type NullDriverConnection struct {
	plugin.DriverConnection
}

func (*NullDriverConnection) AppendAuditLog

func (*NullDriverConnection) LockAuditLog

func (*NullDriverConnection) Query

func (*NullDriverConnection) ReadAuditLogs

func (*NullDriverConnection) UnlockAuditLog

func (*NullDriverConnection) UpsertAuditLockTable

func (c *NullDriverConnection) UpsertAuditLockTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

func (*NullDriverConnection) UpsertAuditLogTable

func (c *NullDriverConnection) UpsertAuditLogTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

type NullDriverQuery

type NullDriverQuery struct{}

func (*NullDriverQuery) Begin

func (*NullDriverQuery) Commit

func (q *NullDriverQuery) Commit(ctx context.Context) error

func (*NullDriverQuery) Exec

func (q *NullDriverQuery) Exec(ctx context.Context, query string, args ...any) error

func (*NullDriverQuery) Query

func (q *NullDriverQuery) Query(ctx context.Context, query string, args ...any) (*plugin.DriverQueryResult, error)

func (*NullDriverQuery) Rollback

func (q *NullDriverQuery) Rollback(ctx context.Context) error

type PostgreSQLBrowser

type PostgreSQLBrowser struct {
	// contains filtered or unexported fields
}

func NewPostgreSQLBrowser

func NewPostgreSQLBrowser(driver *PostgreSQLDriver) *PostgreSQLBrowser

func (*PostgreSQLBrowser) Connect

func (b *PostgreSQLBrowser) Connect(ctx context.Context, dsn string) error

func (*PostgreSQLBrowser) Disconnect

func (b *PostgreSQLBrowser) Disconnect(ctx context.Context) error

func (*PostgreSQLBrowser) List

func (b *PostgreSQLBrowser) List(ctx context.Context, ids []string) ([]plugin.BrowserItem, error)

func (*PostgreSQLBrowser) ParseExplain

func (*PostgreSQLBrowser) Query

func (*PostgreSQLBrowser) Show

func (b *PostgreSQLBrowser) Show(ctx context.Context, ids []string) (string, error)

type PostgreSQLDriver

type PostgreSQLDriver struct {
}

func NewPostgreSQLDriver

func NewPostgreSQLDriver() *PostgreSQLDriver

func (*PostgreSQLDriver) Connect

func (*PostgreSQLDriver) Disconnect

func (d *PostgreSQLDriver) Disconnect(ctx context.Context, conn plugin.DriverConnection) error

type PostgreSQLDriverConnection

type PostgreSQLDriverConnection struct {
	Conn *pgx.Conn
}

func (*PostgreSQLDriverConnection) AppendAuditLog

func (*PostgreSQLDriverConnection) LockAuditLog

func (*PostgreSQLDriverConnection) Query

func (*PostgreSQLDriverConnection) ReadAuditLogs

func (*PostgreSQLDriverConnection) UnlockAuditLog

func (*PostgreSQLDriverConnection) UpsertAuditLockTable

func (c *PostgreSQLDriverConnection) UpsertAuditLockTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

func (*PostgreSQLDriverConnection) UpsertAuditLogTable

func (c *PostgreSQLDriverConnection) UpsertAuditLogTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

type PostgreSQLQuery

type PostgreSQLQuery struct {
	// contains filtered or unexported fields
}

func (*PostgreSQLQuery) Begin

func (*PostgreSQLQuery) Commit

func (q *PostgreSQLQuery) Commit(ctx context.Context) error

func (*PostgreSQLQuery) Exec

func (q *PostgreSQLQuery) Exec(ctx context.Context, query string, args ...any) error

func (*PostgreSQLQuery) Query

func (q *PostgreSQLQuery) Query(ctx context.Context, query string, args ...any) (*plugin.DriverQueryResult, error)

func (*PostgreSQLQuery) Rollback

func (q *PostgreSQLQuery) Rollback(ctx context.Context) error

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func New

func New() *Registry

func (*Registry) Get

func (r *Registry) Get(name string) (plugin.Driver, error)

func (*Registry) GetBrowser

func (r *Registry) GetBrowser(name string) (plugin.Browser, error)

func (*Registry) Register

func (r *Registry) Register(name string, driver plugin.Driver)

func (*Registry) RegisterAll

func (r *Registry) RegisterAll()

func (*Registry) RegisterBrowser

func (r *Registry) RegisterBrowser(name string, browser plugin.Browser)

type SQLiteBrowser added in v0.22.0

type SQLiteBrowser struct {
	// contains filtered or unexported fields
}

func NewSQLiteBrowser added in v0.22.0

func NewSQLiteBrowser(driver *SQLiteDriver) *SQLiteBrowser

func (*SQLiteBrowser) Connect added in v0.22.0

func (b *SQLiteBrowser) Connect(ctx context.Context, dsn string) error

func (*SQLiteBrowser) Disconnect added in v0.22.0

func (b *SQLiteBrowser) Disconnect(ctx context.Context) error

func (*SQLiteBrowser) List added in v0.22.0

func (b *SQLiteBrowser) List(ctx context.Context, ids []string) ([]plugin.BrowserItem, error)

List navigates a hierarchy with no schema level (SQLite is schema-free):

[]            → object type categories (Tables, Views, Triggers)
[type]        → objects of that type
[table, name] → sub-categories (Columns, Indexes, Foreign Keys, Triggers)
[table, name, category] → items within that category

func (*SQLiteBrowser) ParseExplain added in v0.22.0

ParseExplain parses the output of SQLite EXPLAIN (VDBE bytecode).

SQLite EXPLAIN produces 8 columns: addr opcode p1 p2 p3 p4 p5 comment.

Result layout:

  • Root: logical plan tree derived from opcode patterns (scans, filters, projections, global aggregation/sort/limit).
  • SummaryLines: instruction count and key opcode tallies.
  • Tables[0]: full VDBE bytecode listing with key opcodes highlighted.
  • Tables[1]: cursor access summary (OpenRead / OpenWrite).

func (*SQLiteBrowser) Query added in v0.22.0

Query executes arbitrary SQL against the database using the read pool.

func (*SQLiteBrowser) Show added in v0.22.0

func (b *SQLiteBrowser) Show(ctx context.Context, ids []string) (string, error)

Show returns a query that previews the selected object.

["table"|"view", name]            → SELECT * FROM name LIMIT 100
["trigger", name]                 → SELECT sql FROM sqlite_master …
["table", name, "index", idx]     → SELECT sql FROM sqlite_master …

type SQLiteDriver

type SQLiteDriver struct {
	Path string
}

func NewSQLiteDriver

func NewSQLiteDriver() *SQLiteDriver

func (*SQLiteDriver) Connect

func (*SQLiteDriver) CreateDatabase added in v0.22.0

func (d *SQLiteDriver) CreateDatabase(ctx context.Context, path string) error

func (*SQLiteDriver) Disconnect

func (d *SQLiteDriver) Disconnect(ctx context.Context, conn plugin.DriverConnection) error

func (*SQLiteDriver) Initialize added in v0.22.0

func (d *SQLiteDriver) Initialize(ctx context.Context) error

TODO: add this to all drivers and call it once per app lifecycle

type SQLiteDriverConnection

type SQLiteDriverConnection struct {
	Read  *sql.DB
	Write *sql.DB
}

func (*SQLiteDriverConnection) AppendAuditLog

func (*SQLiteDriverConnection) LockAuditLog

func (*SQLiteDriverConnection) Query

func (*SQLiteDriverConnection) ReadAuditLogs

func (*SQLiteDriverConnection) UnlockAuditLog

func (*SQLiteDriverConnection) UpsertAuditLockTable

func (c *SQLiteDriverConnection) UpsertAuditLockTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

func (*SQLiteDriverConnection) UpsertAuditLogTable

func (c *SQLiteDriverConnection) UpsertAuditLogTable(ctx context.Context, execCtx plugin.DriverExecutionContext) error

type SQLiteDriverQuery

type SQLiteDriverQuery struct {
	// contains filtered or unexported fields
}

func (*SQLiteDriverQuery) Begin

func (*SQLiteDriverQuery) Commit

func (q *SQLiteDriverQuery) Commit(ctx context.Context) error

func (*SQLiteDriverQuery) Exec

func (q *SQLiteDriverQuery) Exec(ctx context.Context, query string, args ...any) error

func (*SQLiteDriverQuery) Query

func (q *SQLiteDriverQuery) Query(ctx context.Context, query string, args ...any) (*plugin.DriverQueryResult, error)

func (*SQLiteDriverQuery) Rollback

func (q *SQLiteDriverQuery) Rollback(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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