Documentation
¶
Index ¶
- func BuildDSN(params OpenParams) string
- func Exec(ctx context.Context, db execer, query string, args ...any) error
- func ExecOrWrap(ctx context.Context, db execer, query string, wrapMsg string, args ...any) error
- func ExecRequireRow(ctx context.Context, db execer, query string, args ...any) error
- func ExecRequireRowOrWrap(ctx context.Context, db execer, query string, wrapMsg string, args ...any) error
- func InsertFlowEvent(ctx context.Context, db execer, query string, correlationID string, ...) error
- func NormalizeDatabaseName(databaseName string) (string, error)
- func Open(ctx context.Context, params OpenParams) (*sql.DB, error)deprecated
- func OpenPGXPool(ctx context.Context, params OpenParams) (*pgxpool.Pool, error)
- func OpenSQLDB(ctx context.Context, params OpenParams) (*sql.DB, error)
- type OpenParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDSN ¶
func BuildDSN(params OpenParams) string
BuildDSN builds PostgreSQL connection string from open params.
func ExecOrWrap ¶
ExecOrWrap runs Exec and wraps any error with the provided message.
func ExecRequireRow ¶
ExecRequireRow runs Exec and returns pgx.ErrNoRows if it affected 0 rows.
func ExecRequireRowOrWrap ¶
func ExecRequireRowOrWrap(ctx context.Context, db execer, query string, wrapMsg string, args ...any) error
ExecRequireRowOrWrap runs ExecRequireRow and: - returns nil if a row was affected, - returns pgx.ErrNoRows if 0 rows were affected, - wraps any other error with the provided message.
func InsertFlowEvent ¶
func InsertFlowEvent( ctx context.Context, db execer, query string, correlationID string, actorType string, actorID string, eventType string, payload []byte, createdAt time.Time, ) error
InsertFlowEvent inserts a row into flow_events using the provided SQL query.
func NormalizeDatabaseName ¶
NormalizeDatabaseName validates and normalizes PostgreSQL database name input.
func OpenPGXPool ¶
OpenPGXPool opens a pgx native pool and verifies it via Ping.
Types ¶
Click to show internal directories.
Click to hide internal directories.