Documentation
¶
Index ¶
Constants ¶
const ConfigJSONSchema = `` /* 735-byte string literal not displayed */
ConfigJSONSchema documents the runtime shape expected by storage providers. It is intentionally minimal; provider-specific options are captured in the nested "options" map.
const ProfileJSONSchema = ` { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "StorageProfile", "type": "object", "required": ["name", "provider", "config"], "properties": { "name": { "type": "string", "pattern": "^[a-z0-9_-]+$", "description": "Profile identifier referenced by repositories" }, "description": { "type": "string" }, "provider": { "type": "string", "description": "Registered provider key resolved by the DI container" }, "config": ` + ConfigJSONSchema + `, "fallbacks": { "type": "array", "items": { "type": "string" }, "description": "Ordered list of fallback profiles to consult when the primary is unavailable" }, "labels": { "type": "object", "additionalProperties": { "type": "string" } }, "default": { "type": "boolean", "description": "Marks the profile as the default selection for repositories without explicit configuration" } }, "additionalProperties": false } `
ProfileJSONSchema describes the payload used to define storage profiles in admin APIs. The container will validate updates against this schema before attempting a hot reload.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
SupportsReload bool
ReadReplicas bool
MultiTenant bool
Metadata map[string]any
}
Capabilities documents optional behaviours supported by a provider.
type CapabilityReporter ¶
type CapabilityReporter interface {
Capabilities() Capabilities
}
CapabilityReporter exposes optional provider features (e.g., read replicas, sharding) so repositories can make runtime decisions.
type Config ¶
Config captures the runtime configuration for a storage provider. Detailed schema validation is handled by higher layers (runtimeconfig/admin services).
type Profile ¶
type Profile struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Provider string `json:"provider"`
Config Config `json:"config"`
Fallbacks []string `json:"fallbacks,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Default bool `json:"default,omitempty"`
}
Profile captures a named storage configuration that can be referenced by repositories at runtime. Future phases will persist these profiles and drive hot-swap mechanics based on admin updates.
type Provider ¶
type Provider interface {
Query(ctx context.Context, query string, args ...any) (Rows, error)
Exec(ctx context.Context, query string, args ...any) (Result, error)
Transaction(ctx context.Context, fn func(tx Transaction) error) error
}
Provider encapsulates the operations required by go-cms repositories. It embeds the legacy StorageProvider contract and adds optional hooks that dynamic implementations can satisfy to support runtime reconfiguration.
type Reloadable ¶
Reloadable providers can apply a new configuration at runtime. Implementations that do not support reloads may omit this interface; the container will keep using the existing provider.