db

package
v0.0.0-...-1e39069 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package db provides helper functionality for interacting with the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
}

DB is a wrapper for *sql.DB, for the purpose of "inheriting" methods like Close that can be used alongside the custom ones here.

func New

func New(path string) (DB, error)

New returns DB struct, given a valid path to the local database file.

func (DB) Get

func (d DB) Get(match string) (spotify.Track, error)

Get retrieves the first track matching the specified pattern.

func (DB) GetAll

func (d DB) GetAll() ([]spotify.Track, error)

GetAll gets all tracks.

func (DB) Init

func (d DB) Init() error

Init initializes the database with the tracks table.

func (DB) Insert

func (d DB) Insert(t spotify.Track) error

Insert inserts a track into the database.

Jump to

Keyboard shortcuts

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