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

README

Known issues

Bindings generation with sqlc

  • Censuses table generated bindings are wrongly named Censuse. For now change this manually when regenerating the bindings.
  • In sqlc.yaml some tables with composed names like TokenHolders are changed to lower-case tokenholders for sqlc compatibility.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.1.2

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 added in v0.1.2

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