sqldb

package
v0.0.0-...-0ba1a38 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CryptoRandSource

type CryptoRandSource struct{}

func (CryptoRandSource) Int63

func (CryptoRandSource) Int63() int64

func (CryptoRandSource) Seed

func (CryptoRandSource) Seed(int64)

type DB

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

DB implements the Radiotation database API, backed by a SQLite database. NOTE: Since the database doesn't support concurrent writers, we don't actually hold the *sql.DB in this struct, we force all callers to get a handle via channels.

func New

func New(fn string, src rand.Source) (*DB, error)

New creates a new *DB that is stored on disk at the given filename.

func (*DB) AddRoom

func (s *DB) AddRoom(rm *db.Room) (db.RoomID, error)

func (*DB) AddToHistory

func (s *DB) AddToHistory(rid db.RoomID, te *db.TrackEntry) (int, error)

func (*DB) AddTrack

func (s *DB) AddTrack(qID db.QueueID, track *radio.Track, afterQTID string) error

AddTrack adds a track after the given qtID. If a blank ID is given, the song is added first. The song can't be added before a song that's already played.

func (*DB) AddUser

func (s *DB) AddUser(user *db.User) error

func (*DB) AddUserToRoom

func (s *DB) AddUserToRoom(rid db.RoomID, uid db.UserID) error

func (*DB) Close

func (s *DB) Close() error

func (*DB) History

func (s *DB) History(rid db.RoomID) ([]*db.TrackEntry, error)

func (*DB) MarkVetoed

func (s *DB) MarkVetoed(rid db.RoomID, uid db.UserID) error

func (*DB) NextTrack

func (s *DB) NextTrack(rID db.RoomID) (*db.User, *radio.Track, error)

func (*DB) RemoveTrack

func (s *DB) RemoveTrack(qID db.QueueID, qtID string) error

RemoveTrack remove a given track from a queue. To do it, we find the QueueTrack in question, get it's previous/next tracks, and update their pointers to each other.

func (*DB) Room

func (s *DB) Room(rid db.RoomID) (*db.Room, error)

func (*DB) SearchRooms

func (s *DB) SearchRooms(q string) ([]*db.Room, error)

func (*DB) Tracks

func (s *DB) Tracks(qID db.QueueID, qo *db.QueueOptions) ([]*db.QueueTrack, error)

func (*DB) User

func (s *DB) User(id db.UserID) (*db.User, error)

func (*DB) Users

func (s *DB) Users(rid db.RoomID) ([]*db.User, error)

Jump to

Keyboard shortcuts

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