db

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func Connect

func Connect(ctx context.Context, localPort int, user, password, dbname string, readOnly bool) (*DB, error)

func (*DB) Close

func (d *DB) Close()

func (*DB) InsertRow added in v0.3.0

func (d *DB) InsertRow(ctx context.Context, schema, table string, data map[string]string) error

func (*DB) ReadOnly

func (d *DB) ReadOnly() bool

func (*DB) RunQuery

func (d *DB) RunQuery(ctx context.Context, sql string) (*QueryResult, error)

func (*DB) Schemas

func (d *DB) Schemas(ctx context.Context) ([]string, error)

func (*DB) TableCount

func (d *DB) TableCount(ctx context.Context, schema, table, filterCol, filterVal string) (int64, error)

func (*DB) TableData

func (d *DB) TableData(ctx context.Context, schema, table string, page, pageSize int, sortCol, sortDir, filterCol, filterVal string) (*QueryResult, error)

func (*DB) Tables

func (d *DB) Tables(ctx context.Context, schema string) ([]TableInfo, error)

type QueryResult

type QueryResult struct {
	Columns []string `json:"columns"`
	Rows    [][]any  `json:"rows"`
}

type TableInfo

type TableInfo struct {
	Schema string `json:"schema"`
	Name   string `json:"name"`
	Rows   int64  `json:"rows"`
}

Jump to

Keyboard shortcuts

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