db

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 8 Imported by: 0

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