repo

package
v0.0.0-...-2147667 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(params Params) (*sql.DB, error)

func Register

func Register() fx.Option

func StringifyFilter

func StringifyFilter(filter domain.Filter, optAlias ...string) (string, error)

func StringifySort

func StringifySort(sort domain.Sort, optAlias ...string) (string, error)

Types

type MatcherBuilder

type MatcherBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewErrorMatcher

func NewErrorMatcher[T any](matched bool, err error) *MatcherBuilder[T]

func NewMatcher

func NewMatcher[T any](mb *MutationBuilder[T], matched bool) *MatcherBuilder[T]

func (*MatcherBuilder[T]) Exec

func (m *MatcherBuilder[T]) Exec(ctx context.Context, db *sql.DB) (int64, error)

func (*MatcherBuilder[T]) ThenDelete

func (m *MatcherBuilder[T]) ThenDelete() *MutationBuilder[T]

func (*MatcherBuilder[T]) ThenDoNothing

func (m *MatcherBuilder[T]) ThenDoNothing() *MutationBuilder[T]

func (*MatcherBuilder[T]) ThenInsert

func (m *MatcherBuilder[T]) ThenInsert(columns ...string) *MutationBuilder[T]

func (*MatcherBuilder[T]) ThenUpdate

func (m *MatcherBuilder[T]) ThenUpdate(columns ...string) *MutationBuilder[T]

type MergeCondition

type MergeCondition struct {
	SourceCol     string
	TargetCol     string
	Op            domain.Op
	CaseSensitive bool
}

type MutationBuilder

type MutationBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewMutationBuilder

func NewMutationBuilder[T any]() *MutationBuilder[T]

func (*MutationBuilder[T]) Exec

func (b *MutationBuilder[T]) Exec(ctx context.Context, db *sql.DB) (int64, error)

func (*MutationBuilder[T]) MergeInto

func (b *MutationBuilder[T]) MergeInto(table string) *MutationBuilder[T]

func (*MutationBuilder[T]) On

func (b *MutationBuilder[T]) On(mergeCond MergeCondition) *MutationBuilder[T]

func (*MutationBuilder[T]) Using

func (b *MutationBuilder[T]) Using(values *T) *MutationBuilder[T]

func (*MutationBuilder[T]) UsingValues

func (b *MutationBuilder[T]) UsingValues(values ...Setter) *MutationBuilder[T]

func (*MutationBuilder[T]) WhenMatched

func (b *MutationBuilder[T]) WhenMatched(cond ...string) *MatcherBuilder[T]

func (*MutationBuilder[T]) WhenNotMatched

func (b *MutationBuilder[T]) WhenNotMatched(cond ...string) *MatcherBuilder[T]

type Params

type Params struct {
	fx.In
	Config *conf.Conf
}

type QueryBuilder

type QueryBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewQueryBuilder

func NewQueryBuilder[T any]() *QueryBuilder[T]

func (*QueryBuilder[T]) Close

func (b *QueryBuilder[T]) Close()

func (*QueryBuilder[T]) Count

func (b *QueryBuilder[T]) Count(ctx context.Context, db *sql.DB) (int64, error)

func (*QueryBuilder[T]) Exist

func (b *QueryBuilder[T]) Exist(ctx context.Context, db *sql.DB) (bool, error)

func (*QueryBuilder[T]) From

func (b *QueryBuilder[T]) From(tables ...string) *QueryBuilder[T]

func (*QueryBuilder[T]) NoPagination

func (b *QueryBuilder[T]) NoPagination() *QueryBuilder[T]

func (*QueryBuilder[T]) OrderBy

func (b *QueryBuilder[T]) OrderBy(sort domain.Sort, optAlias ...string) *QueryBuilder[T]

func (*QueryBuilder[T]) Paginate

func (b *QueryBuilder[T]) Paginate(pagination domain.Pagination) *QueryBuilder[T]

func (*QueryBuilder[T]) Query

func (b *QueryBuilder[T]) Query(ctx context.Context, db *sql.DB, scanner func(row *sql.Rows, out T) error) (*T, error)

func (*QueryBuilder[T]) QueryAll

func (b *QueryBuilder[T]) QueryAll(
	ctx context.Context,
	db *sql.DB,
	scanner func(row *sql.Rows, out T) error,
) ([]*T, error)

func (*QueryBuilder[T]) Select

func (b *QueryBuilder[T]) Select(fields ...string) *QueryBuilder[T]

func (*QueryBuilder[T]) SelectCount

func (b *QueryBuilder[T]) SelectCount() *QueryBuilder[T]

func (*QueryBuilder[T]) SelectExists

func (b *QueryBuilder[T]) SelectExists() *QueryBuilder[T]

func (*QueryBuilder[T]) String

func (b *QueryBuilder[T]) String() (string, error)

func (*QueryBuilder[T]) Where

func (b *QueryBuilder[T]) Where(filter domain.Filter, optAlias ...string) *QueryBuilder[T]

func (*QueryBuilder[T]) WhereRaw

func (b *QueryBuilder[T]) WhereRaw(where string) *QueryBuilder[T]

type Setter

type Setter struct {
	Field string
	Value any
}

func ToSetters

func ToSetters[T any](in T) ([]Setter, error)

Jump to

Keyboard shortcuts

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