Documentation
¶
Overview ¶
Package doctor provides health checks for melange authorization infrastructure.
The doctor command validates that the authorization system is properly configured by checking schema files, database state, generated functions, and data health.
Example usage:
d := doctor.New(db, "schemas")
report, err := d.Run(ctx)
if err != nil {
log.Fatal(err)
}
report.Print(os.Stdout, true) // verbose=true
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CastColumn ¶ added in v0.7.2
type CastColumn struct {
ViewColumn string // e.g., "object_id"
SourceColumn string // e.g., "organization_id"
CastType string // e.g., "text"
}
CastColumn represents a column with a ::text cast in the view.
type CheckResult ¶
type CheckResult struct {
// Category groups related checks (e.g., "schema", "functions", "tuples").
Category string
// Name is a short identifier for the check.
Name string
// Status is the check outcome.
Status Status
// Message is a human-readable description of the result.
Message string
// Details provides additional information for verbose output.
Details string
// FixHint suggests how to resolve issues.
FixHint string
}
CheckResult represents the outcome of a single health check.
type Doctor ¶
type Doctor struct {
// contains filtered or unexported fields
}
Doctor performs health checks on the melange authorization infrastructure.
type Options ¶ added in v0.7.2
type Options struct {
SkipPerformance bool
}
Options configures doctor behavior.
type Report ¶
type Report struct {
Checks []CheckResult
// Summary counts.
Passed int
Warnings int
Errors int
}
Report contains all health check results.
func (*Report) AddCheck ¶
func (r *Report) AddCheck(check CheckResult)
AddCheck adds a check result and updates summary counts.
type TuplesInfo ¶
type TuplesInfo struct {
Exists bool
RelKind string // 'r' = table, 'v' = view, 'm' = materialized view
RelKindStr string // human-readable
Columns []string
RowCount int64 // -1 if unknown/expensive to compute
}
TuplesInfo contains information about the melange_tuples relation.
type ViewBranch ¶ added in v0.7.2
type ViewBranch struct {
SourceTable string // e.g., "organization_members"
SourceSchema string // e.g., "public"
ColumnMapping map[string]string // view alias -> source expression
CastColumns []CastColumn
}
ViewBranch represents one SELECT in the UNION ALL view.
type ViewDefinition ¶ added in v0.7.2
type ViewDefinition struct {
Branches []ViewBranch
HasUnion bool // bare UNION detected (not UNION ALL)
RawSQL string // original SQL from pg_get_viewdef
}
ViewDefinition represents a parsed melange_tuples view definition.