db

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 17 Imported by: 0 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

This section is empty.

Variables

This section is empty.

Functions

func Begin

func Begin() (*sql.Tx, error)

func CheckSchema

func CheckSchema() error

CheckSchema reports whether the schema has been applied (Admin TUI init, etc.).

func Close

func Close() error

func ConnectionTarget

func ConnectionTarget(databaseURL string) (host, database string)

ConnectionTarget returns host and database name from a PostgreSQL URL (no credentials).

func Exec

func Exec(query string, args ...any) (sql.Result, error)

func HashString

func HashString(value string) string

HashString returns a peppered HMAC-SHA256 hex digest for DB lookups (name_hash / phone_hash). Without the pepper, E.164 / username dictionaries cannot be matched offline against a DB dump alone.

func Init

func Init(url string) error

func Ping

func Ping() error

func Query

func Query(query string, args ...any) (*sql.Rows, error)

func QueryJSON

func QueryJSON(dst any, query string, args ...any) error

func QueryRow

func QueryRow(query string, args ...any) *sql.Row

func ResetForTest

func ResetForTest()

ResetForTest closes the database and allows Init to run again. Test use only.

func ResetSchema

func ResetSchema() error

ResetSchema drops all public tables and applies schema.sql on the database opened by Init.

func Select

func Select(dest any, query string, args ...any) error

func SetHashPepper

func SetHashPepper(pepper []byte)

SetHashPepper configures the HMAC key for HashString. Required before hashing name/phone lookup values.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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