xql

package module
v0.0.0-...-da54062 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableReplacer = "{t}"
)

Variables

This section is empty.

Functions

func Explode

func Explode(sep string, v ...string) []string

func ExtractStructTags

func ExtractStructTags(v any, tag ...string) []string

func Get

func Get[T Row](db sqlx.Queryer, dst *T, args ...SelectArg) error

func GetContext

func GetContext[T Row](ctx context.Context, db sqlx.QueryerContext, dst *T, args ...SelectArg) error

func RemoveDuplicates

func RemoveDuplicates[T comparable](v []T) []T

func Select

func Select[T Row](db sqlx.Queryer, dst *[]T, args ...SelectArg) error

func SelectContext

func SelectContext[T Row](ctx context.Context, db sqlx.QueryerContext, dst *[]T, args ...SelectArg) error

func ToSnakeCase

func ToSnakeCase(str string) string

Types

type Optional

type Optional[T comparable] struct {
	Val   T
	Valid bool
}

func Opt

func Opt[T comparable](v T) Optional[T]

func Optz

func Optz[T comparable](v T) Optional[T]

Optz checks if v is the zero value equivalent of T. If true, the Valid field of the Optional is set to false.

func (*Optional[T]) Scan

func (n *Optional[T]) Scan(value any) error

Scan implements the Scanner interface.

func (Optional[T]) Value

func (v Optional[T]) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Row

type Row interface {
	comparable
	Table() string
}

type RowWithJoin

type RowWithJoin interface {
	TableJoins()
}

type SelectArg

type SelectArg func(b squirrel.SelectBuilder) squirrel.SelectBuilder

func Where

func Where(pred any, args ...any) SelectArg

type WithSelectColumns

type WithSelectColumns interface {
	SelectColumns() []string
}

Jump to

Keyboard shortcuts

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