pkg

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnection added in v0.2.0

func CloseConnection(conn *sql.DB) error

func DefaultLogger added in v1.0.0

func DefaultLogger(ctx context.Context, query string, args ...any)

func ExecWithLog added in v1.0.0

func ExecWithLog(ctx context.Context, db *sql.DB, query string, args ...any) (sql.Result, error)

func MigrateDatabase

func MigrateDatabase() error

func NewConsumer

func NewConsumer(ctx context.Context, topics []string, groupID string, handler func(kafka.Message))

func NewSqlcWithConnection added in v1.0.0

func NewSqlcWithConnection[T any](ctx context.Context, factory SqlcFactory[T], opts ConnectOptions) (T, *sql.DB, error)

func OpenConnection

func OpenConnection() (*sql.DB, error)

func OpenConnectionV2 added in v1.0.0

func OpenConnectionV2(ctx context.Context, opts ConnectOptions) (*sql.DB, error)

func QueryRowWithLog added in v1.0.0

func QueryRowWithLog(ctx context.Context, db *sql.DB, query string, args ...any) *sql.Row

func QueryWithLog added in v1.0.0

func QueryWithLog(ctx context.Context, db *sql.DB, query string, args ...any) (*sql.Rows, error)

Types

type ConnectOptions added in v1.0.0

type ConnectOptions struct {
	DSN             string
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxIdle     time.Duration
	ConnMaxLifetime time.Duration
	ForceUTC        bool
	QueryLogger     QueryLogger
}

type Consumer

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

type Producer added in v0.1.9

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

func NewProducer added in v0.1.9

func NewProducer(topic string) *Producer

func (*Producer) Close added in v0.1.9

func (producer *Producer) Close() error

func (*Producer) ProduceMessage added in v0.1.9

func (producer *Producer) ProduceMessage(ctx context.Context, key string, value interface{}) error

type QueryLogger added in v1.0.0

type QueryLogger func(ctx context.Context, query string, args ...any)

type SqlcFactory added in v1.0.0

type SqlcFactory[T any] func(db *sql.DB) T

Jump to

Keyboard shortcuts

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