Documentation ¶
Index ¶
- Constants
- func BuildQuery(q litsql.Query, options ...BuildQueryOption) (string, []any, error)
- func GetArgValuesInstance(values any, options ...GetArgValuesInstanceOption) (litsql.ArgValues, error)
- func MergeClauses[T litsql.QueryClause](clauses ...T) (T, error)
- func NewClauseError(f string, args ...any) error
- func NewClauseErrorInvalidMerge(clauseName string) error
- func NewClauseErrorInvalidMergeCannotHaveMultiple(clauseName string) error
- func NewClauseErrorInvalidMergeHasChanges(clauseName string) error
- func NewClauseErrorWrap(err error) error
- func NewWriter(w io.Writer, options ...WriterOption) litsql.Writer
- func ParseArgValues(args []any, values litsql.ArgValues) ([]any, error)
- func ParseArgs(args []any, values any, options ...GetArgValuesInstanceOption) ([]any, error)
- func ToAnySlice[T any, Ts ~[]T](slice Ts) []any
- type BuildQueryOption
- func WithBuildQueryGetArgValuesInstanceOptions(options ...GetArgValuesInstanceOption) BuildQueryOption
- func WithBuildQueryParseArgValues(argValues litsql.ArgValues) BuildQueryOption
- func WithBuildQueryParseArgs(argValues any) BuildQueryOption
- func WithBuildQueryWriterOptions(writerOptions ...WriterOption) BuildQueryOption
- type DBNamedArgument
- type DBNamedArgumentWithDefault
- type FuncArgument
- type GetArgValuesInstanceOption
- type NamedArgument
- type NamedArgumentWithDefault
- type WriterIO
- type WriterOption
Constants ¶
const ( Space = " " NewLine = "\n" OpenPar = "(" ClosePar = ")" Comma = "," CommaSpace = ", " )
Variables ¶
This section is empty.
Functions ¶
func BuildQuery ¶ added in v0.4.1
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 NewClauseErrorInvalidMerge ¶ added in v0.4.0
func NewClauseErrorInvalidMergeCannotHaveMultiple ¶ added in v0.4.0
func NewClauseErrorInvalidMergeHasChanges ¶ added in v0.4.0
func NewClauseErrorWrap ¶ added in v0.3.2
func ParseArgValues ¶ added in v0.4.2
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 ¶
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 (a DBNamedArgumentWithDefault) DBName() string
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 (a NamedArgumentWithDefault) Name() string
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 ¶
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.