placeholder

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Numbered

type Numbered string

Numbered represents a placeholder with a numbered format, such as "$1", which is often used in PostgreSQL and other SQL databases.

func (Numbered) Get

func (np Numbered) Get(n int) string

Get returns a formatted numbered placeholder string for Numbered. The placeholder format is based on the provided prefix (e.g., "$") followed by the index. Parameters:

n: The index to be used in the placeholder format (e.g., "$1").

Returns:

A string representing the numbered placeholder (e.g., "$1").

func (Numbered) Numbered

func (Numbered) Numbered() bool

Numbered returns true for Numbered, indicating that it uses a numbered format.

type Placeholder

type Placeholder interface {
	Get(int) string // Returns the placeholder string for a given index.
	Numbered() bool // Returns true if the placeholder format is numbered.
}

Placeholder defines the interface for generating SQL placeholders in queries. Implementations of this interface provide different styles of placeholders, such as simple placeholders or numbered placeholders.

Methods:

Get(int) string: Returns the placeholder string for the given index.
Numbered() bool: Indicates if the placeholder uses a numbered format.

type UnNumbered

type UnNumbered string

UnNumbered represents a placeholder with a simple format, such as "?" which is commonly used in SQL queries.

func (UnNumbered) Get

func (d UnNumbered) Get(int) string

Get returns the placeholder string for UnNumbered. It always returns "?" regardless of the provided index. Parameters:

index: The index of the placeholder (ignored for UnNumbered).

Returns:

A string representing the placeholder, which is always "?".

func (UnNumbered) Numbered

func (UnNumbered) Numbered() bool

Numbered returns false for UnNumbered, indicating it does not use a numbered format.

Jump to

Keyboard shortcuts

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