sqlutil

package
v0.0.0-...-0641379 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValuesPlaceholders

func ValuesPlaceholders(valuesPerRow, numRows int) string

ValuesPlaceholders returns a set of SQL placeholder numbers grouped for use in an INSERT statement. For example, ValuesPlaceholders(2,3) returns ($1, $2), ($3, $4), ($5, $6) It panics if either param is <= 0.

func WherePlaceholders

func WherePlaceholders(cols []string, numRows int) string

Returns a where clause with placeholders where each column value is ANDed and each row is ORed Args:

cols: List of column names
numRows: Number of rows

For example, if cols = ["name", "city"] and numRows = 2, return value would be (name=$1 AND city=$2) OR (name=$3 AND city=$4)

Types

This section is empty.

Jump to

Keyboard shortcuts

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