postgres

package
v0.1.0-alpha7 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package postgres provides functions for interacting with postgres-compatible databases and includes migration scripts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, url string) (*sql.DB, error)

Open a connection to the database instance described in the URL, performing migrations on success.

func WithinTransaction

func WithinTransaction(ctx context.Context, db *sql.DB, fn TransactionFunc) error

WithinTransaction invokes the TransactionFunc, providing it an sql.Tx transaction to perform SQL operations against. If the TransactionFunc returns a non-nil error, the transaction is rolled back. Otherwise, it is committed.

Types

type TransactionFunc

type TransactionFunc func(ctx context.Context, tx *sql.Tx) error

The TransactionFunc is a function invoked when calling WithinTransaction.

Jump to

Keyboard shortcuts

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