sql

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQuoteInIdentifier is an error returned when an identifier
	// contains a double-quote.
	ErrQuoteInIdentifier = errors.New("identifier contains double quotes")
)

Functions

func Identifier

func Identifier(id string) (string, error)

Identifier escapes an Oracle identifier. If id is not a valid identifier the ErrQuoteInIdentifier error is returned.

func IsPrivilege

func IsPrivilege(p string) bool

IsPrivilege returns true if parameter has the expected syntax of (comma separated) list of privileges.

func IsValidParameterValue

func IsValidParameterValue(value string, isTypeString bool) bool

IsValidParameterValue returns false if parameter value is not a valid one based on the parameter type. It still can return true in cases when parameter value won't be accepted by the database e.g. int value set for a boolean parameter or vice versa, but the cases relevant for constructing a syntactically correct query are supported.

func MustBeIdentifier

func MustBeIdentifier(id string) string

MustBeIdentifier escapes an Oracle identifier. It panics if id is not a valid identifier.

func MustBeObjectName

func MustBeObjectName(id string) string

MustBeObjectName escapes an Oracle object name. It panics if id is not a valid identifier.

func ObjectName

func ObjectName(id string) (string, error)

ObjectName escapes an Oracle object name. If id is not a valid identifier the ErrQuoteInIdentifier error is returned.

func QueryAlterUser

func QueryAlterUser(name, pass string) string

QueryAlterUser constructs a sql statement for updating user password. It panics if any parameter is not a valid identifier.

func QueryCreateDir

func QueryCreateDir(dirName, path string) string

QueryCreateDir constructs a sql statement for creating a new Oracle directory. It panics if dirName is not a valid identifier.

func QueryCreatePDB

func QueryCreatePDB(pdbName, adminUser, adminUserPass, dataFilesDir, defaultTablespace, defaultTablespaceDatafile, fileConvertFrom, fileConvertTo string) string

QueryCreatePDB constructs a sql statement for creating a new pluggable database. It panics if one of the following params is not a valid identifier * pdbName * adminUser * adminUserPass * defaultTablespace

func QueryCreateUser

func QueryCreateUser(name, pass string) string

QueryCreateUser constructs a sql statement for creating a new database user. It panics if any parameter is not a valid identifier.

func QueryGrantPrivileges

func QueryGrantPrivileges(privileges, grantee string) string

QueryGrantPrivileges constructs a sql statement for granting privileges. It panics if privileges is not a valid list of privileges (syntactically) or grantee is not a valid identifier.

func QueryRevokePrivileges

func QueryRevokePrivileges(privileges, grantee string) string

QueryRevokePrivileges constructs a sql statement for revoking privileges. It panics if privileges is not a valid list of privileges (syntactically) or grantee is not a valid identifier.

func QuerySetSessionContainer

func QuerySetSessionContainer(pdbName string) string

QuerySetSessionContainer constructs a sql statement for changing session container to the given pdbName. It panics if pdbName is not a valid identifier.

func QuerySetSystemParameterNoPanic

func QuerySetSystemParameterNoPanic(name, value string, isTypeString bool) (string, error)

QuerySetSystemParameter constructs a sql statement for setting a database parameter. It returns an error if IsValidParameterValue(value, isTypeString) return false.

func StringParam

func StringParam(s string) string

StringParam escapes a string parameter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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