Documentation
¶
Overview ¶
Package sqlite implements myhours.Database on top of SQLite.
Contains also utilities for initializing a new SQLite databases with the required schema.
Index ¶
- func InitiateSQLiteDatabase(dbFile string) (*sql.DB, error)
- type Option
- type SQLite
- func (db *SQLite) ActiveRecord() (*myhours.Record, error)
- func (db *SQLite) Categories() ([]myhours.Category, error)
- func (db *SQLite) FinishRecord(recordID int64, start, end time.Time, notes string) error
- func (db *SQLite) ImportRecords(records []myhours.Record) ([]int64, error)
- func (db *SQLite) Records(from, before time.Time) ([]myhours.Record, error)
- func (db *SQLite) RecordsInCategory(from, before time.Time, categoryID int64) ([]myhours.Record, error)
- func (db *SQLite) Settings() (*myhours.Settings, error)
- func (db *SQLite) StartRecord(start time.Time, categoryID int64, notes string) (int64, error)
- func (db *SQLite) UpdateRecordCategory(recordID int64, categoryID int64) error
- func (db *SQLite) UpdateSetting(key myhours.Setting, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*SQLite)
Option defines option function for SQLite based Database solution.
type SQLite ¶
type SQLite struct {
// contains filtered or unexported fields
}
SQLite implements Database on top of SQLite.
func NewSQLite ¶
NewSQLite return a SQLite database implementation using given *sql.DB handle.
Use for example InitiateSQLiteDatabase to open/initiate an SQLite based *sql.DB handle.
func (*SQLite) ActiveRecord ¶
ActiveRecord implements myhours.Database ActiveRecord on top of SQLite
func (*SQLite) FinishRecord ¶
func (*SQLite) ImportRecords ¶
ImportRecords implements Database.ImportRecords on top of SQLite.
Inserts are done in a transaction, so the result is all or nothing.
Returns the IDs of created records.
func (*SQLite) RecordsInCategory ¶
func (db *SQLite) RecordsInCategory(from, before time.Time, categoryID int64) ([]myhours.Record, error)
RecordsInCategory implements myhours.Database RecordsInCategory on top of SQLite