sessiondata

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const PgCatalogName = "pg_catalog"

PgCatalogName is the name of the pg_catalog system schema.

View Source
const PgExtensionSchemaName = "pg_extension"

PgExtensionSchemaName is the alias for schemas which are usually "public" in postgres when installing an extension, but must be stored as a separate schema in CRDB.

View Source
const PgTempSchemaName = "pg_temp"

PgTempSchemaName is the alias for temporary schemas across sessions.

View Source
const PublicSchemaName = "public"

PublicSchemaName is the name of the pg_catalog system schema.

Variables

View Source
var EmptySearchPath = SearchPath{}

EmptySearchPath is a SearchPath with no schema names in it.

Functions

This section is empty.

Types

type SearchPath

type SearchPath struct {
	// contains filtered or unexported fields
}

SearchPath represents a list of namespaces to search builtins in. The names must be normalized (as per Name.Normalize) already.

func MakeSearchPath

func MakeSearchPath(paths []string) SearchPath

MakeSearchPath returns a new immutable SearchPath struct. The paths slice must not be modified after hand-off to MakeSearchPath.

func (SearchPath) Contains

func (s SearchPath) Contains(target string) bool

Contains returns true iff the SearchPath contains the given string.

func (SearchPath) Equals

func (s SearchPath) Equals(other *SearchPath) bool

Equals returns true if two SearchPaths are the same.

func (SearchPath) GetPathArray

func (s SearchPath) GetPathArray() []string

GetPathArray returns the underlying path array of this SearchPath. The resultant slice is not to be modified.

func (SearchPath) GetTemporarySchemaName

func (s SearchPath) GetTemporarySchemaName() string

GetTemporarySchemaName returns the temporary schema specific to the current session.

func (SearchPath) Iter

func (s SearchPath) Iter() SearchPathIter

Iter returns an iterator through the search path. We must include the implicit pg_catalog and temporary schema at the beginning of the search path, unless they have been explicitly set later by the user. We also include pg_extension in the path, as this normally be used in place of the public schema. This should be read before "public" is read. "The system catalog schema, pg_catalog, is always searched, whether it is mentioned in the path or not. If it is mentioned in the path then it will be searched in the specified order. If pg_catalog is not in the path then it will be searched before searching any of the path items." "Likewise, the current session's temporary-table schema, pg_temp_nnn, is always searched if it exists. It can be explicitly listed in the path by using the alias pg_temp. If it is not listed in the path then it is searched first (even before pg_catalog)." - https://www.postgresql.org/docs/9.1/static/runtime-config-client.html

func (SearchPath) IterWithoutImplicitPGSchemas

func (s SearchPath) IterWithoutImplicitPGSchemas() SearchPathIter

IterWithoutImplicitPGSchemas is the same as Iter, but does not include the implicit pg_temp and pg_catalog.

func (SearchPath) MaybeResolveTemporarySchema

func (s SearchPath) MaybeResolveTemporarySchema(schemaName string) (string, error)

MaybeResolveTemporarySchema returns the session specific temporary schema for the pg_temp alias (only if a temporary schema exists). It acts as a pass through for all other schema names.

func (SearchPath) String

func (s SearchPath) String() string

func (SearchPath) UpdatePaths

func (s SearchPath) UpdatePaths(paths []string) SearchPath

UpdatePaths returns a new immutable SearchPath struct with the paths supplied and the same tempSchemaName as before.

func (SearchPath) WithTemporarySchemaName

func (s SearchPath) WithTemporarySchemaName(tempSchemaName string) SearchPath

WithTemporarySchemaName returns a new immutable SearchPath struct with the tempSchemaName supplied and the same paths as before. This should be called every time a session creates a temporary schema for the first time.

type SearchPathIter

type SearchPathIter struct {
	// contains filtered or unexported fields
}

SearchPathIter enables iteration over the search paths without triggering an allocation. Use one of the SearchPath.Iter methods to get an instance of the iterator, and then repeatedly call the Next method in order to iterate over each search path. The tempSchemaName in the iterator is only set if the session has created a temporary schema.

func (*SearchPathIter) Next

func (iter *SearchPathIter) Next() (path string, ok bool)

Next returns the next search path, or false if there are no remaining paths.

Jump to

Keyboard shortcuts

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