Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBlocksLength ¶
func WithBlocksLength(length int) option
WithBlocksLength sets the expected number of blocks for the Baranka instance. It panics if length is negative.
func WithIncludeTemplate ¶
func WithIncludeTemplate(template string) option
WithIncludeTemplate sets the template for value blocks (default: "(%s)"). The template must contain exactly one %s and no other % verbs; invalid templates are ignored and the default is kept.
func WithPlaceholderFormat ¶
func WithPlaceholderFormat(format PlaceholderFormat) option
WithPlaceholderFormat sets the placeholder format for the Baranka instance.
Types ¶
type Baranka ¶
type Baranka struct {
// contains filtered or unexported fields
}
func (*Baranka) Add ¶
Add appends a new block of arguments and generates corresponding placeholders.
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression is a SQL fragment with its own placeholders, e.g. "POINT(%s %s)". Each %s in the template is replaced with a placeholder ($1, ?, ...) and the corresponding argument is collected for the driver. Construct it with NewExpression. Literal % characters are not supported in the template.
func NewExpression ¶
func NewExpression(template string, args ...any) Expression
NewExpression creates an Expression. It panics if the number of %s verbs in the template does not match the number of arguments, or if the template contains any other % verb — both would silently produce invalid SQL.
type PlaceholderFormat ¶
type PlaceholderFormat byte
PlaceholderFormat specifies the placeholder style for SQL queries.
const ( // PlaceholderFormatDollar uses $1, $2, ... (PostgreSQL style). PlaceholderFormatDollar PlaceholderFormat = iota // PlaceholderFormatQuestionMark uses ?, ?, ... (MySQL/SQLite style). PlaceholderFormatQuestionMark )