app

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeTable added in v1.0.0

func DescribeTable(ctx context.Context, req TableDescribeRequest) (*db.Table, *errors.XError)

DescribeTable loads the schema for a single table using a resolved profile.

func DumpSchema added in v1.0.0

func DumpSchema(ctx context.Context, req SchemaDumpRequest) (*db.SchemaInfo, *errors.XError)

DumpSchema exports the schema using a resolved profile.

func ListTables added in v1.0.0

func ListTables(ctx context.Context, req TableListRequest) (*db.TableList, *errors.XError)

ListTables loads the lightweight table list using a resolved profile.

func LoadProfileDetail added in v1.0.0

func LoadProfileDetail(opts config.Options, name string) (map[string]any, *errors.XError)

LoadProfileDetail loads a single profile and redacts sensitive fields.

func Query added in v1.0.0

func Query(ctx context.Context, req QueryRequest) (*db.QueryResult, *errors.XError)

Query executes a SQL query using a resolved profile.

func QueryTimeout added in v1.0.0

func QueryTimeout(profile config.Profile, overrideSeconds int, overrideSet bool, fallback time.Duration) time.Duration

QueryTimeout resolves the effective query timeout.

func ResolveProfile added in v1.0.0

func ResolveProfile(cfg config.File, name string) (config.Profile, *errors.XError)

ResolveProfile returns a fully prepared profile with ssh config and default ports.

func ResolveReconnectableSSH added in v0.1.0

func ResolveReconnectableSSH(ctx context.Context, profile config.Profile, allowPlaintext, skipHostKeyCheck bool, onStatus func(ssh.StatusEvent)) (*ssh.ReconnectDialer, *errors.XError)

ResolveReconnectableSSH creates an SSH ReconnectDialer for long-lived connections (e.g. the proxy command). It wraps the SSH connection with automatic keepalive monitoring and reconnection on failure.

func ResolveSSH added in v0.0.9

func ResolveSSH(ctx context.Context, profile config.Profile, allowPlaintext, skipHostKeyCheck bool) (*ssh.Client, *errors.XError)

func SchemaTimeout added in v1.0.0

func SchemaTimeout(profile config.Profile, overrideSeconds int, overrideSet bool, fallback time.Duration) time.Duration

SchemaTimeout resolves the effective schema dump timeout.

Types

type App

type App struct {
	Version string
	Commit  string
	Date    string
}

func New

func New(version, commit, date string) App

func (App) BuildSpec

func (a App) BuildSpec() spec.Spec

func (App) VersionInfo

func (a App) VersionInfo() VersionInfo

type Connection added in v0.0.9

type Connection struct {
	DB        *sql.DB
	SSHClient *ssh.Client
	Profile   config.Profile
	// contains filtered or unexported fields
}

func ResolveConnection added in v0.0.9

func ResolveConnection(ctx context.Context, opts ConnectionOptions) (*Connection, *errors.XError)

func (*Connection) Close added in v0.0.9

func (c *Connection) Close() error

type ConnectionOptions added in v0.0.9

type ConnectionOptions struct {
	Profile          config.Profile
	AllowPlaintext   bool
	SkipHostKeyCheck bool
}

type ProfileListResult added in v1.0.0

type ProfileListResult struct {
	ConfigPath string               `json:"config_path" yaml:"config_path"`
	Profiles   []config.ProfileInfo `json:"profiles" yaml:"profiles"`
}

ProfileListResult is the structured result for profile listing.

func LoadProfiles added in v1.0.0

func LoadProfiles(opts config.Options) (*ProfileListResult, *errors.XError)

LoadProfiles loads and summarizes the configured profiles.

func (*ProfileListResult) ToProfileListData added in v1.0.0

func (r *ProfileListResult) ToProfileListData() (string, []output.ProfileListItem, bool)

ToProfileListData implements output.ProfileListFormatter.

type QueryRequest added in v1.0.0

type QueryRequest struct {
	Profile          config.Profile
	SQL              string
	AllowPlaintext   bool
	SkipHostKeyCheck bool
	UnsafeAllowWrite bool
}

QueryRequest contains options for a query operation.

type SchemaDumpRequest added in v1.0.0

type SchemaDumpRequest struct {
	Profile          config.Profile
	TablePattern     string
	IncludeSystem    bool
	AllowPlaintext   bool
	SkipHostKeyCheck bool
}

SchemaDumpRequest contains options for a schema dump operation.

type TableDescribeRequest added in v1.0.0

type TableDescribeRequest struct {
	Profile          config.Profile
	Schema           string
	Name             string
	AllowPlaintext   bool
	SkipHostKeyCheck bool
}

TableDescribeRequest contains options for loading a single table schema.

type TableListRequest added in v1.0.0

type TableListRequest struct {
	Profile          config.Profile
	TablePattern     string
	IncludeSystem    bool
	AllowPlaintext   bool
	SkipHostKeyCheck bool
}

TableListRequest contains options for loading the lightweight table list.

type VersionInfo

type VersionInfo struct {
	Version string `json:"version" yaml:"version"`
	Commit  string `json:"commit,omitempty" yaml:"commit,omitempty"`
	Date    string `json:"date,omitempty" yaml:"date,omitempty"`
}

Jump to

Keyboard shortcuts

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