pqdialect

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: ISC Imports: 9 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.

Via https://github.com/lib/pq v1.10.9. Copyright (c) 2011-2013, 'pq' Contributors Portions Copyright (C) 2011 Blake Mizerany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Types

type PqDialect

type PqDialect struct{}

func (PqDialect) BuildDelete

func (dialect PqDialect) BuildDelete(config rem.QueryConfig) (string, []interface{}, error)

func (PqDialect) BuildInsert

func (dialect PqDialect) BuildInsert(config rem.QueryConfig, rowMap map[string]interface{}, columns ...string) (string, []interface{}, error)

func (PqDialect) BuildSelect

func (dialect PqDialect) BuildSelect(config rem.QueryConfig) (string, []interface{}, error)

func (PqDialect) BuildTableColumnAdd

func (dialect PqDialect) BuildTableColumnAdd(config rem.QueryConfig, column string) (string, error)

func (PqDialect) BuildTableColumnDrop

func (dialect PqDialect) BuildTableColumnDrop(config rem.QueryConfig, column string) (string, error)

func (PqDialect) BuildTableCreate

func (dialect PqDialect) BuildTableCreate(config rem.QueryConfig, tableCreateConfig rem.TableCreateConfig) (string, error)

func (PqDialect) BuildTableDrop

func (dialect PqDialect) BuildTableDrop(config rem.QueryConfig, tableDropConfig rem.TableDropConfig) (string, error)

func (PqDialect) BuildUpdate

func (dialect PqDialect) BuildUpdate(config rem.QueryConfig, rowMap map[string]interface{}, columns ...string) (string, []interface{}, error)

func (PqDialect) ColumnType

func (dialect PqDialect) ColumnType(field reflect.StructField) (string, error)

func (PqDialect) Param

func (dialect PqDialect) Param(identifier int) string

func (PqDialect) QuoteIdentifier

func (dialect PqDialect) QuoteIdentifier(identifier string) string

Jump to

Keyboard shortcuts

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