Documentation
¶
Index ¶
- Variables
- func GetPgsqlScope(t PgsqlScopeType) sql.SystemVariableScope
- func GlobalOnlySystemVariableScope(name string) (sql.MysqlSVScopeType, bool)
- func Init()
- func IsGlobalOnlySystemVariable(name string) bool
- func IsValidDoltConfigParameter(name string) bool
- 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(ctx *sql.Context, 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(ctx *sql.Context, 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 GlobalOnlySystemVariableScope ¶ added in v0.57.1
func GlobalOnlySystemVariableScope(name string) (sql.MysqlSVScopeType, bool)
GlobalOnlySystemVariableScope returns the declared scope of the given system variable and true if the variable is registered and has no session scope (Global, Persist, or PersistOnly). See IsGlobalOnlySystemVariable.
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
func IsGlobalOnlySystemVariable ¶ added in v0.57.1
IsGlobalOnlySystemVariable returns true if the given name refers to a registered system variable that has no session scope (e.g. Dolt's cluster replication variables such as dolt_cluster_role). Such variables can only meaningfully be read from and written to the global scope: sessions snapshot system variables at creation time, so a session copy would go stale (on read) or be invisible to the rest of the server (on write).
func IsValidDoltConfigParameter ¶ added in v0.12.0
IsValidDoltConfigParameter returns true if the given parameter name is a valid Dolt configuration parameter.
func IsValidPostgresConfigParameter ¶
IsValidPostgresConfigParameter returns true if the given parameter name is a valid postgres configuration parameter.
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(currVal, newVal 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 )