Documentation ¶
Index ¶
- Constants
- func BuildQuery(q litsql.Query, options ...BuildQueryOption) (string, []any, error)
- func GetArgValuesInstance(values any) (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) ([]any, error)
- func ToAnySlice[T any, Ts ~[]T](slice Ts) []any
- type BuildQueryOption
- type DBNamedArgument
- type DBNamedArgumentWithDefault
- type FuncArgument
- 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
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
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) error
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 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.