Documentation
¶
Index ¶
- Constants
- func DescribeTable(ctx context.Context, req TableDescribeRequest) (*db.Table, *errors.XError)
- func DumpSchema(ctx context.Context, req SchemaDumpRequest) (*db.SchemaInfo, *errors.XError)
- func ListTables(ctx context.Context, req TableListRequest) (*db.TableList, *errors.XError)
- func LoadProfileDetail(opts config.Options, name string) (map[string]any, *errors.XError)
- func Query(ctx context.Context, req QueryRequest) (*db.QueryResult, *errors.XError)
- func QueryTimeout(profile config.Profile, overrideSeconds int, overrideSet bool, ...) time.Duration
- func ResolveMCPMaxResponseBytes(mcpCfg config.MCPConfig) int
- func ResolveMCPMaxRowsLimit(mcpCfg config.MCPConfig) int
- func ResolveProfile(cfg config.File, name string) (config.Profile, *errors.XError)
- func ResolveQueryMaxRows(profile config.Profile, envMaxRows string, cliValue int, cliSet bool) (limit int, xe *errors.XError)
- func ResolveReconnectableSSH(ctx context.Context, profile config.Profile, ...) (*ssh.ReconnectDialer, *errors.XError)
- func ResolveSSH(ctx context.Context, profile config.Profile, ...) (*ssh.Client, *errors.XError)
- func SSHOptionsForProfile(profile config.Profile, allowPlaintext, skipHostKeyCheck bool) (ssh.Options, *errors.XError)
- func SchemaTimeout(profile config.Profile, overrideSeconds int, overrideSet bool, ...) time.Duration
- func TestAIConnection(ctx context.Context, aiCfg config.AIConfig) (map[string]any, *errors.XError)
- func TestProfileConnection(ctx context.Context, profile config.Profile, allowPlaintext, skipHostKey bool) (map[string]any, *errors.XError)
- func TestSSHProxyConnection(ctx context.Context, proxy config.SSHProxy, allowPlaintext, skipHostKey bool) (map[string]any, *errors.XError)
- type App
- type Connection
- type ConnectionOptions
- type MCPMaxRowsMeta
- type ProfileListResult
- type QueryRequest
- type SchemaDumpRequest
- type TableDescribeRequest
- type TableListRequest
- type VersionInfo
Constants ¶
const ( // DefaultQueryMaxRows is the default row cap for CLI, Web, and TUI queries. DefaultQueryMaxRows = 1000 // DefaultMCPQueryMaxRows is a lower default for MCP tool responses (smaller agent payloads). DefaultMCPQueryMaxRows = 500 // DefaultMCPMaxRowsLimit is the hard ceiling for MCP query max_rows (requests above are clamped). DefaultMCPMaxRowsLimit = 10000 // DefaultMCPMaxResponseBytes is the default serialized JSON size cap for MCP query results. DefaultMCPMaxResponseBytes = 512 * 1024 )
const MCPResponseTruncationHint = errors.HintMCPResponseTruncated
MCPResponseTruncationHint is appended when MCP byte guard trims rows.
const QueryTruncationHint = errors.HintQueryResultTruncated
QueryTruncationHint is returned when results are truncated for agents/humans.
Variables ¶
This section is empty.
Functions ¶
func DescribeTable ¶ added in v1.0.0
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
ListTables loads the lightweight table list using a resolved profile.
func LoadProfileDetail ¶ added in v1.0.0
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 ResolveMCPMaxResponseBytes ¶ added in v1.21.0
ResolveMCPMaxResponseBytes returns the MCP JSON response byte cap.
func ResolveMCPMaxRowsLimit ¶ added in v1.21.0
ResolveMCPMaxRowsLimit returns the configured MCP max_rows ceiling.
func ResolveProfile ¶ added in v1.0.0
ResolveProfile returns a fully prepared profile with ssh config and default ports.
func ResolveQueryMaxRows ¶ added in v1.21.0
func ResolveQueryMaxRows(profile config.Profile, envMaxRows string, cliValue int, cliSet bool) (limit int, xe *errors.XError)
ResolveQueryMaxRows returns the effective row limit for CLI/Web/TUI. limit 0 means unlimited. Negative values are invalid.
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 SSHOptionsForProfile ¶ added in v1.21.0
func SSHOptionsForProfile(profile config.Profile, allowPlaintext, skipHostKeyCheck bool) (ssh.Options, *errors.XError)
SSHOptionsForProfile builds SSH options from a resolved profile, resolving secrets. skipHostKeyCheck is the runtime override (e.g. CLI --ssh-skip-known-hosts-check); profile ssh_proxy.skip_host_key is also honored.
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.
func TestAIConnection ¶ added in v1.20.0
TestAIConnection tests AI configuration and measures latency.
Types ¶
type App ¶
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 MCPMaxRowsMeta ¶ added in v1.21.0
MCPMaxRowsMeta describes MCP max_rows resolution/clamping for response metadata.
func ResolveMCPQueryMaxRows ¶ added in v1.21.0
func ResolveMCPQueryMaxRows(profile config.Profile, mcpCfg config.MCPConfig, argValue int, argSet bool) (effective int, meta MCPMaxRowsMeta, xe *errors.XError)
ResolveMCPQueryMaxRows returns the MCP row limit (never unlimited). MCP max_rows 0 means unset (use defaults). Negative values are rejected.
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
MaxRows int
TruncationHint string
}
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.