database

package
v0.0.0-...-7b2f1e6 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package database provides the persistence layer and the assorted operations we need to perform.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database wraps the database connection and its associated state and exposes the operations we can perform on it.

func OpenDB

func OpenDB(path string) (*Database, error)

OpenDB opens a new database connection.

func (*Database) Begin

func (db *Database) Begin() error

Begin starts a transaction

func (*Database) Close

func (db *Database) Close()

Close closes the database connection

func (*Database) Commit

func (db *Database) Commit() error

Commit finishes a transaction

func (*Database) EventAdd

func (db *Database) EventAdd(ev *event.Event) error

EventAdd inserts an Event into the database.

func (*Database) EventGetRecent

func (db *Database) EventGetRecent(n int) ([]event.Event, error)

EventGetRecent fetches the (up to) <n> most recent events from the database. If n == -1, all Events are fetched.

func (*Database) EventGetRecentByType

func (db *Database) EventGetRecentByType(n int, evType event.ID) ([]event.Event, error)

EventGetRecentByType fetches the <n> most recent Events of the given type.

func (*Database) EventGetRecentErr

func (db *Database) EventGetRecentErr(n int) ([]event.Event, error)

func (*Database) Rollback

func (db *Database) Rollback() error

Rollback aborts a transaction

Directories

Path Synopsis
Package event provides symbolic constants that represent the destructive operations we can perform using the package manager.
Package event provides symbolic constants that represent the destructive operations we can perform using the package manager.
Package query provides symbolic constants that identify the operations we perform on the database.
Package query provides symbolic constants that identify the operations we perform on the database.

Jump to

Keyboard shortcuts

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