internal

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Space      = " "
	NewLine    = "\n"
	OpenPar    = "("
	ClosePar   = ")"
	Comma      = ","
	CommaSpace = ", "
)

Variables

This section is empty.

Functions

func BuildQuery added in v0.4.1

func BuildQuery(q litsql.Query, options ...BuildQueryOption) (string, []any, error)

BuildQuery builds a query string and its arguments.

func GetArgValuesInstance added in v0.5.6

func GetArgValuesInstance(values any, options ...GetArgValuesInstanceOption) (litsql.ArgValues, error)

GetArgValuesInstance gets the litsql.ArgValues instance from the passed parameter.

func MergeClauses added in v0.4.0

func MergeClauses[T litsql.QueryClause](clauses ...T) (T, error)

MergeClauses merge all clauses into the first one in the list.

func NewClauseError added in v0.3.2

func NewClauseError(f string, args ...any) error

func NewClauseErrorInvalidMerge added in v0.4.0

func NewClauseErrorInvalidMerge(clauseName string) error

func NewClauseErrorInvalidMergeCannotHaveMultiple added in v0.4.0

func NewClauseErrorInvalidMergeCannotHaveMultiple(clauseName string) error

func NewClauseErrorInvalidMergeHasChanges added in v0.4.0

func NewClauseErrorInvalidMergeHasChanges(clauseName string) error

func NewClauseErrorWrap added in v0.3.2

func NewClauseErrorWrap(err error) error

func NewWriter added in v0.3.5

func NewWriter(w io.Writer, options ...WriterOption) litsql.Writer

func ParseArgValues added in v0.4.2

func ParseArgValues(args []any, values litsql.ArgValues) ([]any, error)

ParseArgValues replaces all litsql.Argument instances in args with named values.

func ParseArgs added in v0.4.2

func ParseArgs(args []any, values any, options ...GetArgValuesInstanceOption) ([]any, error)

ParseArgs replaces all litsql.Argument instances in args with named values.

func ToAnySlice

func ToAnySlice[T any, Ts ~[]T](slice Ts) []any

Types

type BuildQueryOption added in v0.4.2

type BuildQueryOption func(options *buildQueryOptions)

func WithBuildQueryGetArgValuesInstanceOptions added in v0.7.0

func WithBuildQueryGetArgValuesInstanceOptions(options ...GetArgValuesInstanceOption) BuildQueryOption

WithBuildQueryGetArgValuesInstanceOptions adds query parse args options.

func WithBuildQueryParseArgValues added in v0.4.2

func WithBuildQueryParseArgValues(argValues litsql.ArgValues) BuildQueryOption

WithBuildQueryParseArgValues adds named argument values.

func WithBuildQueryParseArgs added in v0.4.2

func WithBuildQueryParseArgs(argValues any) BuildQueryOption

WithBuildQueryParseArgs adds named argument values.

func WithBuildQueryWriterOptions added in v0.4.2

func WithBuildQueryWriterOptions(writerOptions ...WriterOption) BuildQueryOption

WithBuildQueryWriterOptions adds writer options.

type DBNamedArgument added in v0.5.4

type DBNamedArgument struct {
	litsql.ArgumentBase
	ArgName string
}

func (DBNamedArgument) DBName added in v0.5.4

func (a DBNamedArgument) DBName() string

type DBNamedArgumentWithDefault added in v0.5.4

type DBNamedArgumentWithDefault struct {
	litsql.ArgumentBase
	ArgName      string
	DefaultValue any
}

func (DBNamedArgumentWithDefault) DBName added in v0.5.4

func (DBNamedArgumentWithDefault) Value added in v0.5.4

func (a DBNamedArgumentWithDefault) Value() (any, error)

type FuncArgument added in v0.5.4

type FuncArgument struct {
	litsql.ArgumentBase
	FN func() (any, error)
}

func (FuncArgument) Value added in v0.5.4

func (f FuncArgument) Value() (any, error)

type GetArgValuesInstanceOption added in v0.6.6

type GetArgValuesInstanceOption func(*getArgValuesInstanceOptions)

func WithGetArgValuesInstanceOptionCustom added in v0.6.6

func WithGetArgValuesInstanceOptionCustom(custom func(values any) (litsql.ArgValues, error)) GetArgValuesInstanceOption

WithGetArgValuesInstanceOptionCustom adds a custom litsql.ArgValues detector.

type NamedArgument added in v0.5.4

type NamedArgument struct {
	litsql.ArgumentBase
	ArgName string
}

func (NamedArgument) Name added in v0.5.4

func (a NamedArgument) Name() string

type NamedArgumentWithDefault added in v0.5.4

type NamedArgumentWithDefault struct {
	litsql.ArgumentBase
	ArgName      string
	DefaultValue any
}

func (NamedArgumentWithDefault) Name added in v0.5.4

func (NamedArgumentWithDefault) Value added in v0.5.4

func (a NamedArgumentWithDefault) Value() (any, error)

type WriterIO

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

func WewWriterIO

func WewWriterIO(w io.Writer) *WriterIO

func (*WriterIO) Err

func (w *WriterIO) Err() error

func (*WriterIO) Write

func (w *WriterIO) Write(s string)

type WriterOption added in v0.3.5

type WriterOption func(*writer)

func WithWriterIndentString added in v0.6.0

func WithWriterIndentString(indentString string) WriterOption

WithWriterIndentString sets the indent string (used only if WithWriterUseNewLine is true). Default is " " (two spaces).

func WithWriterUseNewLine added in v0.3.5

func WithWriterUseNewLine(useNewLine bool) WriterOption

WithWriterUseNewLine sets whether to use newlines in the output or not. Default is true.

Directories

Path Synopsis
dialectgen module

Jump to

Keyboard shortcuts

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