Documentation
¶
Index ¶
- 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 ResolveProfile(cfg config.File, name string) (config.Profile, *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 SchemaTimeout(profile config.Profile, overrideSeconds int, overrideSet bool, ...) time.Duration
- type App
- type Connection
- type ConnectionOptions
- type ProfileListResult
- type QueryRequest
- type SchemaDumpRequest
- type TableDescribeRequest
- type TableListRequest
- type VersionInfo
Constants ¶
This section is empty.
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 ResolveProfile ¶ added in v1.0.0
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
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 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.