Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDestructiveQuery ¶
IsDestructiveQuery reports whether the query deletes or drops resources. This is a best-effort guardrail for agents, not a SQL parser. Statements led by DELETE, DROP, or TRUNCATE (including after CTEs) require approval.
Types ¶
type DestructiveQueryError ¶
type DestructiveQueryError struct{}
DestructiveQueryError is returned when a query would delete or drop data or schema objects and --force was not passed.
func (*DestructiveQueryError) Error ¶
func (e *DestructiveQueryError) Error() string
type Options ¶
type Options struct {
Organization string
Database string
Branch string
Query string
// Keyspace is the Vitess keyspace for MySQL. Optional; defaults to @primary (same as pscale shell).
Keyspace string
// PostgresDB is the PostgreSQL database name. Defaults to postgres.
PostgresDB string
// Role is reader, writer, readwriter, or admin (same as pscale shell --role).
Role string
// Replica routes reads to replicas when true (same as pscale shell --replica).
Replica bool
// Force allows destructive SQL (DELETE, DROP, TRUNCATE) after explicit user approval.
Force bool
}
Options selects the branch and SQL to execute.
type Result ¶
type Result struct {
Status string `json:"status"`
Database string `json:"database"`
Branch string `json:"branch"`
Kind string `json:"kind"`
Role string `json:"role,omitempty"`
Replica bool `json:"replica,omitempty"`
RowCount int `json:"row_count"`
RowsAffected int64 `json:"rows_affected,omitempty"`
Columns []string `json:"columns,omitempty"`
Rows []map[string]any `json:"rows,omitempty"`
NextSteps []string `json:"next_steps,omitempty"`
}
Result is returned for `pscale sql --format json`.
Click to show internal directories.
Click to hide internal directories.