schemas

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabaseConfigSchema

func GetDatabaseConfigSchema() (map[string]interface{}, error)

GetDatabaseConfigSchema returns the DatabaseConfig schema as a map This is typically a definition within the PgBouncer schema

func GetPGAuditSchema

func GetPGAuditSchema() (map[string]interface{}, error)

GetPGAuditSchema returns the parsed PGAudit schema as a map

func GetPGAuditSchemaJSON

func GetPGAuditSchemaJSON() []byte

GetPGAuditSchemaJSON returns the raw JSON bytes for the PGAudit schema

func GetPgBouncerSchema

func GetPgBouncerSchema() (map[string]interface{}, error)

GetPgBouncerSchema returns the parsed PgBouncer schema as a map

func GetPgBouncerSchemaJSON

func GetPgBouncerSchemaJSON() []byte

GetPgBouncerSchemaJSON returns the raw JSON bytes for the PgBouncer schema

func GetPgHBASchema

func GetPgHBASchema() (map[string]interface{}, error)

GetPgHBASchema returns the parsed pg_hba.conf schema as a map

func GetPgHBASchemaJSON

func GetPgHBASchemaJSON() []byte

GetPgHBASchemaJSON returns the raw JSON bytes for the pg_hba.conf schema

func GetPgconfigSchemaJSON

func GetPgconfigSchemaJSON() []byte

GetPgconfigSchemaJSON returns the raw JSON bytes for the main pgconfig schema

func GetPostgRESTSchema

func GetPostgRESTSchema() (map[string]interface{}, error)

GetPostgRESTSchema returns the parsed PostgREST schema as a map

func GetPostgRESTSchemaJSON

func GetPostgRESTSchemaJSON() []byte

GetPostgRESTSchemaJSON returns the raw JSON bytes for the PostgREST schema

func GetSchema

func GetSchema(schemaType SchemaType) (map[string]interface{}, error)

GetSchema returns the parsed schema as a map for a given schema type

func GetSchemaJSON

func GetSchemaJSON(schemaType SchemaType) ([]byte, error)

GetSchemaJSON returns the raw JSON bytes for a given schema type

func GetWalGSchema

func GetWalGSchema() (map[string]interface{}, error)

GetWalGSchema returns the parsed WAL-G schema as a map

func GetWalGSchemaJSON

func GetWalGSchemaJSON() []byte

GetWalGSchemaJSON returns the raw JSON bytes for the WAL-G schema

func ValidateAgainstSchema

func ValidateAgainstSchema(data interface{}, schemaType SchemaType) error

ValidateAgainstSchema validates data against a schema

Types

type Param

type Param struct {
	Name           string   `json:"name"`            // Parameter name (e.g., "shared_buffers")
	VarType        string   `json:"vartype"`         // Type: bool, enum, integer, real, string
	Unit           string   `json:"unit"`            // Unit: kB, MB, GB, s, ms, min, etc.
	Category       string   `json:"category"`        // Category path (e.g., "Write-Ahead Log / Settings")
	ShortDesc      string   `json:"short_desc"`      // Short description
	ExtraDesc      string   `json:"extra_desc"`      // Extended description
	Context        string   `json:"context"`         // When can be changed: postmaster, sighup, backend, superuser, user
	VarClass       string   `json:"varclass"`        // Class: configuration, preset, fixed
	MinVal         float64  `json:"min_val"`         // Minimum value (for numeric types)
	MaxVal         float64  `json:"max_val"`         // Maximum value (for numeric types)
	EnumVals       []string `json:"enum_vals"`       // Valid enum values (for enum types)
	BootVal        string   `json:"boot_val"`        // Default/boot value
	Setting        string   `json:"setting"`         // Current setting value
	SourceFile     string   `json:"source_file"`     // Configuration source file
	SourceLine     string   `json:"source_line"`     // Line number in source file
	PendingRestart bool     `json:"pending_restart"` // Whether change requires restart
}

Param represents a PostgreSQL configuration parameter with all its metadata

func FilterParamsByCategory

func FilterParamsByCategory(params []Param, category string) []Param

FilterParamsByCategory returns parameters that belong to the specified category

func FilterParamsByContext

func FilterParamsByContext(params []Param, context string) []Param

FilterParamsByContext returns parameters that can be changed in the specified context

func GetParamByName

func GetParamByName(params []Param, name string) *Param

GetParamByName returns a parameter by name from a slice of parameters

func ParseDescribeConfig

func ParseDescribeConfig(output string) ([]Param, error)

ParseDescribeConfig parses the output of `postgres --describe-config` The output is tab-separated values with the following fields (PostgreSQL 17+): name, context, category, vartype, boot_val, min_val, max_val, short_desc, extra_desc

func (*Param) ValidateParamValue

func (p *Param) ValidateParamValue(value string) error

ValidateParamValue validates a parameter value against its constraints

type SchemaType

type SchemaType string

SchemaType represents the type of schema

const (
	SchemaTypePgConfig  SchemaType = "pgconfig"
	SchemaTypePgBouncer SchemaType = "pgbouncer"
	SchemaTypePostgREST SchemaType = "postgrest"
	SchemaTypeWalG      SchemaType = "walg"
	SchemaTypePGAudit   SchemaType = "pgaudit"
	SchemaTypePgHBA     SchemaType = "pghba"
)

func GetAllSchemaTypes

func GetAllSchemaTypes() []SchemaType

GetAllSchemaTypes returns all available schema types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL