persist

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package persist saves run information between sessions of fitplot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDatabase

func ConnectDatabase(name string, dbpath string) (db *sql.DB, err error)

InitializeDatabase opens a database file and create the appropriate tables.

func CreateTempFile

func CreateTempFile(bytes []byte) (tmpFile *os.File, err error)

CreateTempFile takes an in-memory array of bytes and stores it in a temporary file location (which varies by operating system)

func DeleteTempFile

func DeleteTempFile(tmpFile *os.File)

DeleteTempFile deletes the temp file if it exists. Assumes file

func InsertNewRecord

func InsertNewRecord(db *sql.DB, r Record) (err error)

InsertNewRecord inserts a new record into the runfiles table containing a filename and a binary blob. It assumes the database has been initialized and the table built.

func MigrateDatabase

func MigrateDatabase(db *sql.DB) (err error)

MigrateDatabase updates the database schema to the latest version.

Types

type Record

type Record struct {
	FName     string
	FType     string
	FContent  []byte
	TimeStamp time.Time
}

func GetRecsByTime

func GetRecsByTime(db *sql.DB, startTime, endTime time.Time) (recs []Record)

GetRecsByTime retrieves on or more binary blobs stored in the database for a given date range provided as YYYY-MM-DD.

Jump to

Keyboard shortcuts

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