Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAuthFailed = errors.New("auth failed; check ARCHERY_USERNAME / ARCHERY_PASSWORD")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) InstanceResource ¶
func (c *Client) InstanceResource(rt ResourceType, db, schema, table string) ([]string, error)
InstanceResource lists databases / schemas / tables / columns. db/schema/table are passed only when meaningful for the resource type.
func (*Client) Login ¶
Login establishes an authenticated session with Archery.
hhyo/Archery's login form is JS-driven: the page POSTs to /authenticate/ (not /login/) over AJAX with username + password. We mirror that:
- GET /login/ — primes the csrftoken cookie (the page itself sets it).
- POST /authenticate/ with X-CSRFToken header + form (username, password). Response is {"status": 0, "msg": "ok", "data": null} on success and the server sets a sessionid cookie.
type QueryResult ¶
type QueryResult struct {
FullSQL string `json:"full_sql"`
IsExecute bool `json:"is_execute"`
IsMasked bool `json:"is_masked"`
QueryTime float64 `json:"query_time"`
MaskRuleHit bool `json:"mask_rule_hit"`
Warning *string `json:"warning"`
Error *string `json:"error"`
IsCritical bool `json:"is_critical"`
Rows [][]any `json:"rows"`
ColumnList []string `json:"column_list"`
ColumnType []string `json:"column_type"`
AffectedRows int `json:"affected_rows"`
}
QueryResult mirrors the data block of /query/ responses.
type ResourceType ¶
type ResourceType string
ResourceType is the kind of metadata to list via /instance/instance_resource/.
const ( ResDatabase ResourceType = "database" ResSchema ResourceType = "schema" ResTable ResourceType = "table" ResColumn ResourceType = "column" )
type ServerError ¶
ServerError is returned when archery responds with status != 0.
func (*ServerError) Error ¶
func (e *ServerError) Error() string
Click to show internal directories.
Click to hide internal directories.