sql

package
v0.8.35 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewCQRS = c.NewWithValidate[cqrs, ClientOption]

Functions

This section is empty.

Types

type CQRS

type CQRS interface {
	RW() DB
	RO() DB
}

type ClientOption

type ClientOption c.Option[cqrs]

func WithRO

func WithRO(db DB) ClientOption

func WithRW

func WithRW(db DB) ClientOption

type Config

type Config struct {
	Driver   string `validate:"oneof=noop mysql pgx"`
	Host     string `validate:"required"`
	Database string `validate:"required"`
	User     string `validate:"required"`
	Password string `validate:"required"`
	Port     int64  `validate:"gt=1000,lt=65536"`
}

func (Config) DSN

func (c Config) DSN() string

type DB

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

func Connect

func Connect(
	ctx context.Context,
	driver string,
	dsn string,
) (DB, error)

func (DB) MultiNamedExecContext added in v0.8.8

func (db DB) MultiNamedExecContext(
	ctx context.Context,
	query Query,
	args []map[string]any,
) (
	sql.Result,
	error,
)

func (DB) NamedExecContext

func (db DB) NamedExecContext(
	ctx context.Context,
	query Query,
	args map[string]any,
) (
	sql.Result,
	error,
)

func (DB) NamedQueryContext

func (db DB) NamedQueryContext(
	ctx context.Context,
	query Query,
	args map[string]any,
) (
	*sqlx.Rows,
	error,
)

type Query

type Query string

func (Query) String

func (q Query) String() string

func (Query) WithSpan

func (q Query) WithSpan(span trace.Span) string

Jump to

Keyboard shortcuts

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