Documentation ¶
Overview ¶
Package db contains utilities to record train sightings in a SQLite db.
Index ¶
- Variables
- func Backup(src *sqlx.DB, destPath string) error
- func GetAllBlobs(db *sqlx.DB) (map[string]struct{}, error)
- func InsertTrain(db *sqlx.DB, t stitch.Train) (int64, error)
- func Open(path string) (*sqlx.DB, error)
- func SetCleanedUp(db *sqlx.DB, id int64) error
- func SetUploaded(db *sqlx.DB, id int64) error
- type Train
Constants ¶
This section is empty.
Variables ¶
var ErrNoRowAffected = errors.New("no rows affected")
ErrNoRowAffected means that a row was expected to change - but none did.
Functions ¶
func GetAllBlobs ¶
GetAllBlobs lists all blobs which the database knows about. Does not include thumbnails.
func InsertTrain ¶
InsertTrain inserts a new train sighting into the database. Returns the db id of the new row.
func Open ¶
Open creates a new SQLite database or opens an existing one. Will run the schema/migration script.
func SetCleanedUp ¶
SetCleanedUp marks a train sighting as uploaded in the database.
Types ¶
type Train ¶
Train represents the basics of a train in the database.
func GetNextCleanup ¶
GetNextCleanup returns the next train sighting for which we can delete the blobs locally.
func GetNextUpload ¶
GetNextUpload returns the next train sighting to upload from the database.
func (*Train) GIFFileName ¶
GIFFileName returns the GIF file name for this train (derived from timestamp).
func (*Train) ImgFileName ¶
ImgFileName returns the image file name for this train (derived from timestamp).