db

package
v0.0.0-...-f445fa1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDB

type BoltDB struct {
	*bbolt.DB
	// contains filtered or unexported fields
}

BoltDB implements the Database interface using a bolt database

func NewBoltDB

func NewBoltDB(path string) (*BoltDB, error)

NewBoltDB returns a new bolt database

func (*BoltDB) Get

func (db *BoltDB) Get(keys []model.EncodedKey) (map[model.EncodedKey][]model.TableValue, error)

Get retrieves the provided keys' values from the bolt file

func (*BoltDB) GetSong

func (db *BoltDB) GetSong(songID uint32) (string, error)

GetSong does a songID => song name lookup in the database

func (*BoltDB) GetSongID

func (db *BoltDB) GetSongID(name string) (uint32, error)

GetSongID does a song name => songID lookup in the database

func (*BoltDB) Set

func (db *BoltDB) Set(batch map[model.EncodedKey]model.TableValue) error

Set stores the list of (key, value) into the bolt file

func (*BoltDB) SetSong

func (db *BoltDB) SetSong(song string) (uint32, error)

SetSong stores a song name in the database and returns it's song ID It first checks if the song is not already stored in the database

type Database

type Database interface {
	Get([]model.EncodedKey) (map[model.EncodedKey][]model.TableValue, error)
	Set(map[model.EncodedKey]model.TableValue) error

	GetSongID(name string) (songID uint32, err error)
	GetSong(songID uint32) (name string, err error)
	SetSong(name string) (songID uint32, err error)

	Close() error
}

Database is an interface for storing fingerprint parts in a database and retrieving them

Jump to

Keyboard shortcuts

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