db

package
v0.2.18-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 7 Imported by: ? modules, 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

Index

Constants

View Source
const (
	// LatestMigrationVersion is the latest migration version of the
	// database. This is used to implement downgrade protection for the
	// daemon.
	//
	// NOTE: This MUST be updated when a new migration is added.
	LatestMigrationVersion = 2
)

Variables

View Source
var (
	FaradayMigrationSet = sqldb.MigrationSet{
		TrackingTableName: pgx.DefaultMigrationsTable,
		SQLFileDirectory:  "sqlc/migrations",
		SQLFiles:          sqlSchemas,

		LatestMigrationVersion: LatestMigrationVersion,
		Descriptors:            MakeMigrationDescriptors(),

		MakeProgrammaticMigrations: func(
			db *sqldb.BaseDB,
		) (map[uint]migrate.ProgrammaticMigrEntry, error) {

			return make(map[uint]migrate.ProgrammaticMigrEntry), nil
		},
	}
	FaradayMigrationSets = []sqldb.MigrationSet{FaradayMigrationSet}
)

Functions

func MakeMigrationDescriptors

func MakeMigrationDescriptors() []sqldb.MigrationDescriptor

MakeMigrationDescriptors returns the ordered migration descriptors for faraday's SQL schema. Both migrations are schema-only, so neither carries a programmatic migration step.

func NewTestPostgresDB

func NewTestPostgresDB(t testing.TB) *sqldb.PostgresStore

NewTestPostgresDB is a helper function that creates a Postgres database for testing.

Types

type QueriesTxOptions

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

QueriesTxOptions defines the set of db txn options the SQLQueries understands.

func NewQueryReadTx

func NewQueryReadTx() QueriesTxOptions

NewQueryReadTx creates a new read transaction option set.

func (*QueriesTxOptions) ReadOnly

func (a *QueriesTxOptions) ReadOnly() bool

ReadOnly returns true if the transaction should be read only.

NOTE: This implements the TxOptions.

type SqliteConfig

type SqliteConfig struct {
	// SkipMigrations if true, then all the tables will be created on start
	// up if they don't already exist.
	SkipMigrations bool `long:"skipmigrations" description:"Skip applying migrations on startup."`

	// SkipMigrationDbBackup if true, then a backup of the database will not
	// be created before applying migrations.
	SkipMigrationDbBackup bool `long:"skipmigrationdbbackup" description:"Skip creating a backup of the database before applying migrations."`

	// DatabaseFileName is the full file path where the database file can be
	// found.
	DatabaseFileName string `long:"dbfile" description:"The full path to the database."`
}

SqliteConfig holds all the config arguments needed to interact with our sqlite DB.

nolint: lll

Directories

Path Synopsis
Package sqlc provides a set of custom database queries and utilities for interacting with the SQL database used in the application.
Package sqlc provides a set of custom database queries and utilities for interacting with the SQL database used in the application.

Jump to

Keyboard shortcuts

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