# Packages
No description provided by the author
# Functions
DisableLog disables all library log output.
ExecuteSQLTransactionWithRetry is a helper function that executes a transaction with retry logic.
IsSerializationError returns true if the given error is a serialization error.
MapSQLError attempts to interpret a given error as a database agnostic SQL error.
NewPostgresStore creates a new store that is backed by a Postgres database backend.
NewSqliteStore attempts to open a new sqlite database based on the passed config.
NewTestPgFixture constructs a new TestPgFixture starting up a docker container running Postgres 11.
NewTestPostgresDB is a helper function that creates a Postgres database for testing using the given fixture.
NewTestPostgresDBWithVersion is a helper function that creates a Postgres database for testing and migrates it to the given version.
NewTestSqliteDB is a helper function that creates an SQLite database for testing.
NewTestSqliteDBWithVersion is a helper function that creates an SQLite database for testing and migrates it to the given version.
NewTransactionExecutor creates a new instance of a TransactionExecutor given a Querier query object and a concrete type for the type of transactions the Querier understands.
SQLInt32 turns a numerical integer type into the NullInt32 that sql/sqlc uses when an integer field can be permitted to be NULL.
SQLInt64 turns a numerical integer type into the NullInt64 that sql/sqlc uses when an integer field can be permitted to be NULL.
SQLStr turns a string into the NullString that sql/sqlc uses when a string can be permitted to be NULL.
SQLTime turns a time.Time into the NullTime that sql/sqlc uses when a time can be permitted to be NULL.
UseLogger uses a specified Logger to output package logging info.
WithTxRetries is a functional option that allows us to specify the number of times a transaction should be retried if it fails with a repeatable error.
WithTxRetryDelay is a functional option that allows us to specify the delay to wait before a transaction is retried.
# Constants
DefaultMaxRetryDelay is the default maximum delay between retries.
DefaultNumTxRetries is the default number of times we'll retry a transaction if it fails with an error that permits transaction repetition.
DefaultRetryDelay is the default delay between retries.
No description provided by the author
Subsystem defines the logging code for this subsystem.
# Variables
DefaultPostgresFixtureLifetime is the default maximum time a Postgres test fixture is being kept alive.
DefaultStoreTimeout is the default timeout used for any interaction with the storage/database.
ErrRetriesExceeded is returned when a transaction is retried more than the max allowed valued without a success.
TargetLatest is a MigrationTarget that migrates to the latest version available.
TargetVersion is a MigrationTarget that migrates to the given version.
# Structs
BaseDB is the base database struct that each implementation can embed to gain some common functionality.
ErrSerializationError is an error type which represents a database agnostic error that a transaction couldn't be serialized with other concurrent db transactions.
ErrSQLUniqueConstraintViolation is an error type which represents a database agnostic SQL unique constraint violation.
PostgresConfig holds the postgres database configuration.
PostgresStore is a database store implementation that uses a Postgres backend.
SqliteConfig holds all the config arguments needed to interact with our sqlite DB.
SqliteStore is a database store implementation that uses a sqlite backend.
TestPgFixture is a test fixture that starts a Postgres 11 instance in a docker container.
TransactionExecutor is a generic struct that abstracts away from the type of query a type needs to run under a database transaction, and also the set of options for that transaction.
# Interfaces
BatchedQuerier is a generic interface that allows callers to create a new database transaction based on an abstract type that implements the TxOptions interface.
BatchedTx is a generic interface that represents the ability to execute several operations to a given storage interface in a single atomic transaction.
Tx represents a database transaction that can be committed or rolled back.
TxOptions represents a set of options one can use to control what type of database transaction is created.
# Type aliases
MakeTx is a function that creates a new transaction.
MigrationTarget is a functional option that can be passed to applyMigrations to specify a target version to migrate to.
OnBackoff is a function that is called when a transaction is retried due to a serialization error.
QueryCreator is a generic function that's used to create a Querier, which is a type of interface that implements storage related methods from a database transaction.
RollbackTx is a function that is called when a transaction needs to be rolled back due to a serialization error.
TxBody represents the function type for transactions.
TxExecutorOption is a functional option that allows us to pass in optional argument when creating the executor.