sq

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arg added in v0.3.0

func Arg(name string) litsql.Argument

Arg adds a named argument.

func ArgDefault added in v0.3.0

func ArgDefault(name string, defaultValue any) litsql.Argument

ArgDefault adds a named argument with a default value.

func ArgFunc added in v0.3.0

func ArgFunc(fn func() (any, error)) litsql.Argument

ArgFunc returns the argument value in a callback.

func Build added in v0.3.0

func Build(q litsql.Query, writerOptions ...WriterOption) (string, []any, error)

func DBArg added in v0.3.0

func DBArg(name string) litsql.Argument

DBArg adds a DB named argument.

func NewWriter added in v0.3.0

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

func ParseArgs added in v0.3.0

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

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

Types

type ArgValues added in v0.3.0

type ArgValues interface {
	Get(string) (any, bool)
}

ArgValues is the supplier of values for named arguments.

type BuildQuery added in v0.3.0

type BuildQuery interface {
	Build(writerOptions ...WriterOption) (string, []any, error)
}

type Builder

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

func NewQueryBuilder

func NewQueryBuilder(d litsql.Dialect) *Builder

func (*Builder) Add

func (s *Builder) Add(q litsql.QueryClause)

func (*Builder) ClauseList

func (s *Builder) ClauseList() []litsql.QueryClause

func (*Builder) Dialect

func (s *Builder) Dialect() litsql.Dialect

type MapArgValues added in v0.3.0

type MapArgValues map[string]any

MapArgValues is an ArgValues backed from a map[string]any.

func (MapArgValues) Get added in v0.3.0

func (m MapArgValues) Get(s string) (any, bool)

type Mod

type Mod[T, A any] interface {
	ModTag[T]
	Apply(A)
}

type ModTag

type ModTag[T any] interface {
	// contains filtered or unexported methods
}

type ModTagImpl

type ModTagImpl[T any] struct {
}

type Query

type Query[T any] interface {
	litsql.QueryBuilder
	litsql.Query
	QueryModApply[T]
	BuildQuery
}

type QueryMod

type QueryMod[T any] interface {
	ModTag[T]
	Apply(qb litsql.QueryBuilder)
}

func QueryModFunc

func QueryModFunc[T any](f func(apply litsql.QueryBuilder)) QueryMod[T]

type QueryModApply

type QueryModApply[T any] interface {
	Apply(...QueryMod[T])
}

type WriterOption added in v0.3.0

type WriterOption func(*writer)

func WithWriterIndentStr added in v0.3.0

func WithWriterIndentStr(indentStr string) WriterOption

func WithWriterUseNewLine added in v0.3.0

func WithWriterUseNewLine(useNewLine bool) WriterOption

Directories

Path Synopsis
reflectxargs module
structargs module

Jump to

Keyboard shortcuts

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