plugin

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EditorTypeString  = "string"
	EditorTypeFloat64 = "float64"
	EditorTypeInt64   = "int64"
	EditorTypeUint64  = "uint64"
	EditorTypeObject  = "object"
)
View Source
const (
	DriverAuditLogTableName        = "_ferro_audit_log"
	DriverAuditLockTableName       = "_ferro_audit_lock"
	DriverAuditLockIDForMigrations = "migrataion"
)
View Source
const (
	DriverAuditColumnString int = iota + 1
	DriverAuditColumnInt64
	DriverAuditColumnTime
	DriverAuditColumnJSON
)

Variables

View Source
var (
	// audit log columns
	DriverAuditColumnID        = DriverAuditColumn{PrimaryKey: true, Name: "id", Type: DriverAuditColumnInt64, Nullable: false}
	DriverAuditColumnAppliedAt = DriverAuditColumn{PrimaryKey: false, Name: "applied_at", Type: DriverAuditColumnTime, Nullable: false}
	DriverAuditColumnEvent     = DriverAuditColumn{PrimaryKey: false, Name: "event", Type: DriverAuditColumnString, Nullable: false}
	DriverAuditColumnData      = DriverAuditColumn{PrimaryKey: false, Name: "data", Type: DriverAuditColumnJSON, Nullable: false}
	DriverAuditColumnMetadata  = DriverAuditColumn{PrimaryKey: false, Name: "metadata", Type: DriverAuditColumnJSON, Nullable: true}

	// lock columns
	DriverAuditLockColumnID       = DriverAuditColumn{PrimaryKey: true, Name: "id", Type: DriverAuditColumnString, Nullable: false}
	DriverAuditLockColumnLockedAt = DriverAuditColumn{PrimaryKey: false, Name: "locked_at", Type: DriverAuditColumnTime, Nullable: false}
	DriverAuditLockColumnLockedBy = DriverAuditColumn{PrimaryKey: false, Name: "locked_by", Type: DriverAuditColumnString, Nullable: false}
	DriverAuditLockColumnData     = DriverAuditColumn{PrimaryKey: false, Name: "data", Type: DriverAuditColumnJSON, Nullable: false}

	ErrAuditAlreadyLocked = fmt.Errorf("audit log is already locked")
)

Functions

This section is empty.

Types

type Browser

type Browser interface {
	Connect(ctx context.Context, dsn string) error
	Disconnect(ctx context.Context) error
	List(ctx context.Context, ids []string) ([]BrowserItem, error)
	Show(ctx context.Context, ids []string) (string, error)
	Query(ctx context.Context, sql string) (BrowserQueryResult, error)
	ParseExplain(data BrowserQueryResult) (BrowserExplainResult, error)
}

type BrowserExplainLine

type BrowserExplainLine struct {
	Text      string
	Highlight bool
}

type BrowserExplainNode

type BrowserExplainNode struct {
	Name     string
	Lines    []BrowserExplainLine
	Children []BrowserExplainNode
}

type BrowserExplainResult

type BrowserExplainResult struct {
	Root         BrowserExplainNode
	SummaryLines []BrowserExplainLine
	Tables       []BrowserExplainTable
}

type BrowserExplainRow

type BrowserExplainRow struct {
	Cells     []string
	Highlight bool
}

type BrowserExplainTable

type BrowserExplainTable struct {
	Title   string
	Headers []string
	Rows    []BrowserExplainRow
}

type BrowserItem

type BrowserItem struct {
	ID          string
	Name        string
	HasChildren bool
}

type BrowserQueryResult

type BrowserQueryResult struct {
	Headers     []string
	Rows        [][]string
	ColumnTypes []string
}

type Driver

type Driver interface {
	Connect(ctx context.Context, config config.DriverConfig) (DriverConnection, error)
	Disconnect(ctx context.Context, conn DriverConnection) error
}

type DriverAuditColumn

type DriverAuditColumn struct {
	PrimaryKey bool
	Name       string
	Type       int
	Nullable   bool
}

type DriverAuditLock

type DriverAuditLock struct {
	ID       string
	LockedAt time.Time
	LockedBy string
	Data     map[string]any
}

type DriverAuditLog

type DriverAuditLog struct {
	ID        int64
	AppliedAt time.Time
	Event     string
	Data      map[string]any
	Metadata  map[string]any
}

func (*DriverAuditLog) GetData

func (d *DriverAuditLog) GetData(key string) string

func (*DriverAuditLog) GetMetadata

func (d *DriverAuditLog) GetMetadata(key string) string

type DriverConnection

type DriverConnection interface {
	UpsertAuditLogTable(ctx context.Context, execCtx DriverExecutionContext) error
	UpsertAuditLockTable(ctx context.Context, execCtx DriverExecutionContext) error
	LockAuditLog(ctx context.Context, execCtx DriverExecutionContext, lock DriverAuditLock) error
	UnlockAuditLog(ctx context.Context, execCtx DriverExecutionContext, lock DriverAuditLock) error
	AppendAuditLog(ctx context.Context, execCtx DriverExecutionContext, log DriverAuditLog) error
	ReadAuditLogs(ctx context.Context, execCtx DriverExecutionContext) ([]DriverAuditLog, error)
	Query(execCtx DriverExecutionContext) DriverQuery
}

type DriverExecutionContext

type DriverExecutionContext struct {
	Schema string
	Prefix string
}

type DriverInstance

type DriverInstance struct {
	Driver Driver
	Config *config.Driver
}

type DriverQuery

type DriverQuery interface {
	Begin(ctx context.Context) (DriverQuery, error)
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
	Exec(ctx context.Context, query string, args ...any) error
	Query(ctx context.Context, query string, args ...any) (*DriverQueryResult, error)
}

type DriverQueryResult

type DriverQueryResult struct {
	AffectedRows int64
	Rows         [][]any
}

Jump to

Keyboard shortcuts

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