Documentation
¶
Overview ¶
Package db deals with database access.
Index ¶
- Constants
- Variables
- func AddSignal(ctx context.Context, tx *sql.Tx, name string, kindCode vcd.VarKindCode, ...) error
- func AddValue(ctx context.Context, tx *sql.Tx, timestamp uint64, code string, value string) error
- func CreateDBFile(name string) (bool, error)
- func CreateSchema(ctx context.Context, tx *sql.Tx) error
- func FindSignalByName(ctx context.Context, tx *sql.Tx, name string) *sql.Row
- func FindValueById(ctx context.Context, tx *sql.Tx, id uint64) *sql.Row
- func OpenDB(ctx context.Context, name string) (*sql.DB, error)
- func Scan1[T any](rows *sql.Rows) (*T, error)
- func Scan2[T any, U any](rows *sql.Rows) (*T, *U, error)
- func Scan3NoNext[T any, U any, V any](rows *sql.Rows) (*T, *U, *V, error)
Constants ¶
View Source
const ( // Pragmas are used to initialize an in-memory database. Useful for tests. Pragmas = `?cache=shared&mode=memory` // For the time being, use an in-memory database. DefaultFilename = `file:test.db` + Pragmas // SqliteDriver is the name of the used SQL driver module. SqliteDriver = `sqlite3` )
Variables ¶
View Source
var ( // NowFn is a function that retrieves the current time. Can be overridden // in tests. NowFn = time.Now )
Functions ¶
func CreateDBFile ¶
CreateDBFile creates the database file if it does not already exist. Returns true, if the db schema needs to be created.
func CreateSchema ¶
CreateSchema schedules a transactional schema creation.
func FindSignalByName ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.