dbcontext

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRelevantContext

func BuildRelevantContext(ctx context.Context, question string, name string) (string, error)

Types

type Column

type Column struct {
	Name     string
	Type     string
	Nullable bool
}

type Connection

type Connection struct {
	Name           string
	Driver         string
	Vendor         string
	Host           string
	ConnectionName string
	Port           int
	Database       string
	Username       string
	Password       string
	PasswordEnv    string
	Path           string
	DSN            string
	DSNEnv         string
	Description    string
	SSLMode        string
	PoolMode       string
	QueryExecMode  string
	Params         map[string]string
}

func ListConnections

func ListConnections() ([]Connection, string, error)

func ResolveConnection

func ResolveConnection(name string) (Connection, error)

func (Connection) Kind

func (c Connection) Kind() string

func (Connection) Target

func (c Connection) Target() string

type Inspection

type Inspection struct {
	Connection      Connection
	PingMillis      int64
	Version         string
	CurrentDatabase string
	SchemaCount     int
	TableCount      int
	ViewCount       int
	TotalSizeBytes  int64
	TopSchemas      []SchemaSummary
	LargestTables   []TableSummary
	Objects         []Object
}

func Inspect

func Inspect(ctx context.Context, name string) (Inspection, error)

type Object

type Object struct {
	Schema  string
	Name    string
	Type    string
	Columns []Column
}

type QueryResult

type QueryResult struct {
	Connection Connection
	Query      string
	Columns    []string
	Rows       []map[string]string
	Truncated  bool
}

func ExecuteReadQuery

func ExecuteReadQuery(ctx context.Context, name string, query string) (QueryResult, error)

func ExecuteReadQueryOnConnection

func ExecuteReadQueryOnConnection(ctx context.Context, connection Connection, query string) (QueryResult, error)

type SchemaSummary

type SchemaSummary struct {
	Schema     string
	TableCount int
	ViewCount  int
}

type TableSummary

type TableSummary struct {
	Schema      string
	Name        string
	Type        string
	SizeBytes   int64
	RowEstimate int64
}

Jump to

Keyboard shortcuts

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