Documentation ¶
Index ¶
- Variables
- func GetPgsqlScope(t PgsqlScopeType) sql.SystemVariableScope
- func Init()
- func IsValidPostgresConfigParameter(name string) bool
- func TzOffsetToDuration(d string) (time.Duration, error)
- type Parameter
- func (p *Parameter) DisplayString(_ string) string
- func (p *Parameter) GetDefault() any
- func (p *Parameter) GetName() string
- func (p *Parameter) GetSessionScope() sql.SystemVariableScope
- func (p *Parameter) GetType() sql.Type
- func (p *Parameter) InitValue(val any, global bool) (sql.SystemVarValue, error)
- func (p *Parameter) IsGlobalOnly() bool
- func (p *Parameter) IsReadOnly() bool
- func (p *Parameter) SetDefault(a any)
- func (p *Parameter) SetValue(val any, global bool) (sql.SystemVarValue, error)
- type ParameterContext
- type ParameterSource
- type PgsqlScope
- type PgsqlScopeType
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidValue = errors.NewKind("ERROR: invalid value for parameter \"%s\": \"%s\"") ErrCannotChangeAtRuntime = errors.NewKind("ERROR: parameter \"%s\" cannot be changed now") )
Functions ¶
func GetPgsqlScope ¶
func GetPgsqlScope(t PgsqlScopeType) sql.SystemVariableScope
func Init ¶ added in v0.7.0
func Init()
Init initializes or appends to SystemVariables as it functions as a global variable. Currently, we append all of postgres configuration parameters to sql.SystemVariables. This means that all of mysql system variables and postgres config parameters will be stored together. TODO: get rid of me, use an integration point to define new sysvars
Types ¶
type Parameter ¶
type Parameter struct { Name string Default any Category string ShortDesc string Context ParameterContext Type sql.Type Source ParameterSource ResetVal any Scope sql.SystemVariableScope ValidateFunc func(any) (any, bool) }
func (*Parameter) DisplayString ¶
DisplayString implements sql.SystemVariable.
func (*Parameter) GetDefault ¶
GetDefault implements sql.SystemVariable.
func (*Parameter) GetSessionScope ¶
func (p *Parameter) GetSessionScope() sql.SystemVariableScope
GetSessionScope implements sql.SystemVariable.
func (*Parameter) IsGlobalOnly ¶
IsGlobalOnly implements sql.SystemVariable.
func (*Parameter) IsReadOnly ¶
IsReadOnly implements sql.SystemVariable.
func (*Parameter) SetDefault ¶
SetDefault implements sql.SystemVariable.
type ParameterContext ¶
type ParameterContext string
ParameterContext sets level of difficulty of changing the parameter settings. For more detailed description on how to change the settings of specific context, https://www.postgresql.org/docs/current/view-pg-settings.html
const ( ParameterContextInternal ParameterContext = "internal" ParameterContextPostmaster ParameterContext = "postmaster" ParameterContextSighup ParameterContext = "sighup" ParameterContextSuperUserBackend ParameterContext = "superuser-backend" ParameterContextBackend ParameterContext = "backend" ParameterContextSuperUser ParameterContext = "superuser" ParameterContextUser ParameterContext = "user" )
The following constants are in order of decreasing difficulty of changing the setting.
type ParameterSource ¶
type ParameterSource string
ParameterSource sets the source of the current parameter value.
const ( ParameterSourceClient ParameterSource = "client" // ParameterSourceConfigurationFile means that the parameter needs to set // its Default and ResetVal to what's defined in the given config file. ParameterSourceConfigurationFile ParameterSource = "configuration file" ParameterSourceDefault ParameterSource = "default" // ParameterSourceOverride means the default and reset value needs to be set at server start time // TODO: currently the default and reset values are dummy values. ParameterSourceOverride ParameterSource = "override" )
type PgsqlScope ¶
type PgsqlScope struct {
Type PgsqlScopeType
}
PgsqlScope represents the scope of a PostgreSQL configuration parameter.
func (*PgsqlScope) GetValue ¶
func (p *PgsqlScope) GetValue(ctx *sql.Context, name string, _ sql.CollationID) (any, error)
GetValue implements sql.SystemVariableScope.
func (*PgsqlScope) IsGlobalOnly ¶
func (p *PgsqlScope) IsGlobalOnly() bool
IsGlobalOnly implements sql.SystemVariableScope.
func (*PgsqlScope) IsSessionOnly ¶
func (p *PgsqlScope) IsSessionOnly() bool
IsSessionOnly implements sql.SystemVariableScope.
type PgsqlScopeType ¶
type PgsqlScopeType byte
PgsqlScopeType represents the scope of a configuration parameter.
const ( // PsqlScopeSession is set when the configuration parameter exists only in the session context. PsqlScopeSession PgsqlScopeType = iota // PsqlScopeLocal is set when the configuration parameter exists only in the local context. PsqlScopeLocal )