Documentation
¶
Overview ¶
Package util contains various utility methods and constants
Index ¶
- func CreateExtension(ctx context.Context, dbConnection *sql.DB, ext model.Extension) error
- func CreateServer(ctx context.Context, dbConnection *sql.DB, server model.ForeignServer) error
- func CreateUserMap(ctx context.Context, dbConnection *sql.DB, usermap model.UserMap) error
- func DiffExtensions(dStateExts []model.Extension, dbExts []model.Extension) (extRemove []model.Extension, extAdd []model.Extension)
- func DiffForeignServers(dStateServers []model.ForeignServer, dbServers []model.ForeignServer) (fsRemove []model.ForeignServer, fsAdd []model.ForeignServer, ...)
- func DiffSchemas(dStateSchemas []model.Schema, dbSchemas []model.Schema) (schRemove []model.Schema, schAdd []model.Schema, schModify []model.Schema)
- func DiffUserMaps(dStateUserMaps []model.UserMap, dbUserMaps []model.UserMap) (umRemove []model.UserMap, umAdd []model.UserMap, umModify []model.UserMap)
- func DropExtension(ctx context.Context, dbConnection *sql.DB, ext model.Extension) error
- func DropSchema(ctx context.Context, dbConnection *sql.DB, schema model.Schema, ...) error
- func DropServer(ctx context.Context, dbConnection *sql.DB, servername string, cascade bool) error
- func DropUser(ctx context.Context, dbConnection *sql.DB, username string) error
- func DropUserMap(ctx context.Context, dbConnection *sql.DB, usermap model.UserMap, ...) error
- func EnsureUser(ctx context.Context, dbConnection *sql.DB, userName string, ...) error
- func FindForeignServer(foreignServers []model.ForeignServer, serverName string) *model.ForeignServer
- func FindUserMap(usermaps []model.UserMap, localuser string) *model.UserMap
- func GetExtensions(ctx context.Context, dbConnection *sql.DB) ([]model.Extension, error)
- func GetSchemasForServer(ctx context.Context, dbConnection *sql.DB, serverName string) ([]model.Schema, error)
- func GetSecret(ctx context.Context, secret model.Secret) (string, error)
- func GetServers(ctx context.Context, dbConnection *sql.DB) ([]model.ForeignServer, error)
- func GetUserMapsForServer(ctx context.Context, dbConnection *sql.DB, foreignServer string) ([]model.UserMap, error)
- func ImportSchema(ctx context.Context, dbConnection *sql.DB, serverName string, ...) error
- func ResolveConnectionString(connStr string, secret *model.Secret) string
- func SecretIsDefined(secret model.Secret) bool
- func StartsWithNumber(str string) bool
- func StringCoalesce(args ...string) string
- func UpdateServer(ctx context.Context, dbConnection *sql.DB, server model.ForeignServer) error
- func UpdateServerName(ctx context.Context, dbConnection *sql.DB, server model.ForeignServer, ...) error
- func UpdateUserMap(ctx context.Context, dbConnection *sql.DB, usermap model.UserMap) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateExtension ¶
CreateExtension creates a postgres extension in the database
func CreateServer ¶
func CreateUserMap ¶
func DiffExtensions ¶
func DiffExtensions(dStateExts []model.Extension, dbExts []model.Extension) (extRemove []model.Extension, extAdd []model.Extension)
DiffExtensions takes two lists of extensions and produces a list of extensions that migrate the second list (dbExts) to equal the first (dStateExts). The first list (dStateExts) is the desired state; the second list (dbExts) is the current state. A list of extensions to remove and extensions to add are returned.
func DiffForeignServers ¶
func DiffForeignServers(dStateServers []model.ForeignServer, dbServers []model.ForeignServer) (fsRemove []model.ForeignServer, fsAdd []model.ForeignServer, fsModify []model.ForeignServer)
DiffForeignServers produces a list of `ForeignServers` to remove, add, and modify to bring `dbServers` in line with `dStateServers`
func DiffSchemas ¶
func DiffSchemas(dStateSchemas []model.Schema, dbSchemas []model.Schema) (schRemove []model.Schema, schAdd []model.Schema, schModify []model.Schema)
DiffSchemas takes two lists of schemas and produces a list of schemas that migrate the second list (dbSchemas) to equal the first (dStateSchemas). The first list (dStateSchemas) is the desired state; the second list (dbSchemas) is the current state. A list of schemas to remove, schemas to add, and schemas to modify are returned.
func DiffUserMaps ¶
func DropExtension ¶
DropExtension drops a postgres extension from the database
func DropSchema ¶
func DropSchema(ctx context.Context, dbConnection *sql.DB, schema model.Schema, cascadeDrop bool) error
DropSchema drops a database schema with optional CASCADE
func DropServer ¶
func DropUserMap ¶
func EnsureUser ¶
func FindForeignServer ¶
func FindForeignServer(foreignServers []model.ForeignServer, serverName string) *model.ForeignServer
func GetExtensions ¶
GetExtensions returns a list of installed extensions
func GetSchemasForServer ¶
func GetSchemasForServer(ctx context.Context, dbConnection *sql.DB, serverName string) ([]model.Schema, error)
GetSchemasForServer returns a list of foreign schemas
func GetServers ¶
func GetUserMapsForServer ¶
func ImportSchema ¶
func ImportSchema(ctx context.Context, dbConnection *sql.DB, serverName string, schema model.Schema) error
ImportSchema attempts to import a remote schema from a foreign server into a local schema, optionally importing ENUM types used in the remote schema as well.
func ResolveConnectionString ¶
ResolveConnectionString returns a connection string populated with a credential obtained using the supplied secret configuration
func SecretIsDefined ¶
func StartsWithNumber ¶
StartsWithNumber determines if a string starts with a number
func StringCoalesce ¶
StringCoalesce returns the first string in the supplied arguments that is non-empty when trimmed. If there is no such string, the empty string is returned.
func UpdateServer ¶
func UpdateServerName ¶
Types ¶
This section is empty.