pg

package
v0.0.0-...-3309553 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuoteIdentifier

func QuoteIdentifier(name string) string

QuoteIdentifier quotes an "identifier" (e.g. a table or a column name) to be used as part of an SQL statement. For example:

tblname := "my_table"
data := "my_data"
quoted := pq.QuoteIdentifier(tblname)
err := db.Exec(fmt.Sprintf("INSERT INTO %s VALUES ($1)", quoted), data)

Any double quotes in name will be escaped. The quoted identifier will be case-sensitive when used in a query. If the input string contains a zero byte, the result will be truncated immediately before it.

It's a copy of the function from github.com/lib/pq.

Types

type StmtParams

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

StmtParams is a helper for generating prepared statement parameters, i.e. $1, $2, $3, ...

func (*StmtParams) Next

func (p *StmtParams) Next() string

Next returns next parameter.

Jump to

Keyboard shortcuts

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