db

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	RW *sql.DB
	RO *sql.DB

	QueriesRW *queries.Queries
	QueriesRO *queries.Queries
}

DB struct abstact a safe connection with the database using sqlc queries, sqlite as a database engine and go-sqlite3 as a driver.

func Init

func Init(dataDir string, dbName string) (*DB, error)

Init function starts a database using the data path provided as argument. It opens two different connections, one for read only, and another for read and write, with different configurations, optimized for each use case.

func (*DB) Close

func (db *DB) Close() error

Close function stops all internal connections to the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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