Help us shape the future of Go! Take the 2026 Go Developer Survey

sql

package
v0.10.103 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 15 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"`
	Enabled  bool
}

func (Config) DSN

func (c Config) DSN() string

func (Config) MergeWith added in v0.8.105

func (c Config) MergeWith(other Config) Config

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) Close added in v0.8.36

func (db DB) Close(ctx context.Context) 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,
)

func (DB) Ping added in v0.8.36

func (db DB) Ping(ctx context.Context) error

func (DB) SQLDB added in v0.8.124

func (db DB) SQLDB() *sql.DB

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