db

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 8 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

Overview

Package db provides a lightweight GORM-based SQLite wrapper for persisting state required by the Push Universal Validator (UV), such as block tracking, processed cross-chain messages, and transaction receipts.

Index

Constants

View Source
const (
	// InMemorySQLiteDSN is a special DSN to create an ephemeral in-memory SQLite database.
	InMemorySQLiteDSN = ":memory:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps a GORM client and provides simplified DB lifecycle management.

func OpenFileDB

func OpenFileDB(dir, filename string, migrateSchema bool) (*DB, error)

OpenFileDB opens (or creates) a file-backed SQLite database located in the given directory. If `migrateSchema` is true, all defined schema models are automatically migrated.

func OpenInMemoryDB

func OpenInMemoryDB(migrateSchema bool) (*DB, error)

OpenInMemoryDB opens a non-persistent SQLite database in memory. This is useful for testing or ephemeral state.

func (*DB) Client

func (d *DB) Client() *gorm.DB

Client returns the internal *gorm.DB instance for direct usage in queries.

func (*DB) Close

func (d *DB) Close() error

Close safely closes the underlying database connection.

Jump to

Keyboard shortcuts

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