Documentation ¶
Index ¶
- Constants
- func IdentifierIsGood(identifierName string) (bool, error)
- func MakeDsn(host string, port string, database string, username string, password string, ...) (dsn string)
- func ProcedureExists(connection *sql.DB, schemaName string, procedureName string) (procedureExists bool, err error)
- func ProcedureNameIsGood(procedureName string) (bool, error)
- func ScreenSingleQuotes(src string) (dst string)
- func TableExists(connection *sql.DB, schemaName string, tableName string) (result bool, err error)
- func TableNameIsGood(tableName string) (bool, error)
Constants ¶
const ( DsnPrefix = "postgresql://" DsnUsernamePasswordDelimiter = ":" DsnUsernameHostDelimiter = "@" DsnHostPortDelimiter = ":" DsnHostDatabaseDelimiter = "/" DsnParametersPrefix = "?" )
PostgreSQL constants.
const ( SingleQuote = `'` SingleQuoteTwice = SingleQuote + SingleQuote Underscore = '_' )
Symbols.
const ( QueryFTableExists = `SELECT EXISTS ( SELECT 1 FROM information_schema.tables WHERE table_schema = $1 AND table_name = $2 );` QueryFProcedureExists = `` /* 216-byte string literal not displayed */ )
SQL query templates.
const (
// ErrFBadSymbol is an error message format for a bad symbol.
ErrFBadSymbol = "bad symbol: '%v'"
)
Error message formats.
Variables ¶
This section is empty.
Functions ¶
func IdentifierIsGood ¶
IdentifierIsGood checks whether the specified identifier is good.
func MakeDsn ¶
func MakeDsn( host string, port string, database string, username string, password string, parameters string, ) (dsn string)
MakeDsn function returns a connection string for PostgreSQL database according to the documentation located at: "https://www.postgresql.org/docs/10/libpq-connect.html". Format reference: postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]
func ProcedureExists ¶
func ProcedureExists( connection *sql.DB, schemaName string, procedureName string, ) (procedureExists bool, err error)
ProcedureExists function checks whether the specified procedure exists.
func ProcedureNameIsGood ¶
ProcedureNameIsGood checks whether the specified procedure name is a good identifier.
func ScreenSingleQuotes ¶
ScreenSingleQuotes function does the single quotes screening.
func TableExists ¶
func TableExists( connection *sql.DB, schemaName string, tableName string, ) (result bool, err error)
TableExists function checks whether the specified table exists.
func TableNameIsGood ¶
TableNameIsGood checks whether the specified table name is a good identifier.
Types ¶
This section is empty.