Documentation
¶
Overview ¶
Package reason holds the explanations the server gives an administrator: why a capability is degraded, why a connection cannot run an action, what a configuration relies on. Each has a stable code the console translates (zh-CN, en), named parameters, and the English text logs, the CLI and MCP show.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Code ¶
type Code string
Code names an explanation; its English template is in templates.
const ( // Capabilities of the dialects. ReturningInsert Code = "returning.insertReturning" ReturningLastInsertID Code = "returning.lastInsertId" ExplainPostgresJSON Code = "explain.postgresJson" ExplainMySQLJSON Code = "explain.mysqlJson" ExplainPlanner Code = "explain.plannerEstimates" ExplainCoarse Code = "explain.coarseEstimates" ExplainAnalyze Code = "explain.analyze" ExplainNoAnalyze Code = "explain.noAnalyze" // Statement timeouts and the refusal of unkeyed writes, per connection. PostgresTimeout Code = "timeout.postgresStatementTimeout" PostgresTimeoutPooled Code = "timeout.postgresPooled" PostgresCancelOnly Code = "timeout.postgresCancelOnly" NoQueryTimeout Code = "timeout.none" SessionVariable Code = "timeout.sessionVariable" SessionVariableReadsOnly Code = "timeout.sessionVariableSelectOnly" DSNSetsTimeout Code = "timeout.dsnSetsVariable" MySQLWriteKilled Code = "timeout.mysqlWriteKilled" MySQLWritePooled Code = "timeout.mysqlWritePooled" SettingPooled Code = "setting.pooled" UnkeyedGateOnly Code = "unkeyedWrite.gateOnly" UnkeyedDSNOff Code = "unkeyedWrite.dsnOff" UnkeyedDSNOn Code = "unkeyedWrite.dsnOn" UnkeyedDSNUnclear Code = "unkeyedWrite.dsnUnclear" UnkeyedSafeUpdates Code = "unkeyedWrite.safeUpdates" LimitUnjudged Code = "limit.unjudged" // The work relying on a limit. UseReads Code = "limitUse.reads" UseWrites Code = "limitUse.writes" UseReadsAfterWrite Code = "limitUse.readsAfterWrites" UseProcedures Code = "limitUse.procedures" UseSQLEscape Code = "limitUse.sqlEscape" // Whether a connection may run an action. PrivilegeReadOnlyServer Code = "privilege.readOnlyServer" PrivilegeMissing Code = "privilege.missing" PrivilegeFilterNeedsSelect Code = "privilege.filterNeedsSelect" PrivilegeReadsBack Code = "privilege.readsBack" PrivilegeUncheckable Code = "privilege.uncheckable" // How firmly a connection guarantees a capability. StrengthEnforced Code = "strength.enforced" StrengthBestEffort Code = "strength.bestEffort" StrengthUnsupported Code = "strength.unsupported" // What validating a configuration reports, without refusing it. CapabilityDenied Code = "validation.capabilityDenied" LimitNotEnforced Code = "validation.limitNotEnforced" // A plan grants an action the connection cannot run. PlanActionDenied Code = "plan.actionDenied" )
The codes, one place for all: adding an explanation means a constant and its English template here, then the console's zh-CN and en messages under reasons.<code> (go test ./core/reason -update refreshes the fixture the console checks its messages against).
type Reason ¶
Reason is one explanation: its code, the values of its template's {placeholders}, and its English text. A placeholder may name a part, an explanation of its own (the cause, the work affected) that the console translates by its own code; parts do not nest.
func Compose ¶
Compose is New with parts, explanations filling placeholders of their own by their text.