Documentation
¶
Overview ¶
Holds all what neccessary for odTimeTracker database - datatypes `Activity` and `Project` and functions for manipulating data.
Index ¶
- func InitStorage(path string) (db *sql.DB, err error)
- func RemoveActivity(db *sql.DB, id ...int64) (int, error)
- func RemoveProject(db *sql.DB, id ...int64) (int, error)
- func UpdateActivity(db *sql.DB, a Activity) (cnt int64, err error)
- func UpdateProject(db *sql.DB, p Project) (cnt int64, err error)
- type Activity
- func InsertActivity(db *sql.DB, pid int64, name string, desc string, tags string) (a Activity, err error)
- func SelectActivities(db *sql.DB, limit int) (activities []Activity, err error)
- func SelectActivityById(db *sql.DB, id ...int64) (a []Activity, err error)
- func SelectActivityRunning(db *sql.DB) (a Activity, err error)
- type Project
- func InsertProject(db *sql.DB, name string, desc string) (p Project, err error)
- func SelectProjectById(db *sql.DB, id ...int64) (p []Project, err error)
- func SelectProjectByName(db *sql.DB, name ...string) (projects []Project, err error)
- func SelectProjectWithTerm(db *sql.DB, term string) (projects []Project, err error)
- func SelectProjects(db *sql.DB, limit int) (p []Project, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveActivity ¶
Remove activity(-ies) with given Id(s) form the database.
func RemoveProject ¶
Remove project(s) with given Id(s) form the database.
func UpdateActivity ¶
Update activity in the database Return 1 if update was successfull otherwise 0.
Types ¶
type Activity ¶
type Activity struct {
ActivityId int64
ProjectId int64
Name string
Description string
Tags string
Started string
Stopped string
// contains filtered or unexported fields
}
Activity definition
func InsertActivity ¶
func InsertActivity(db *sql.DB, pid int64, name string, desc string, tags string) (a Activity, err error)
Insert new activity.
func SelectActivities ¶
Return activities.
func SelectActivityById ¶
Return activity(-ies) by given ID(s).
func SelectActivityRunning ¶
Return currently running activity.
func (*Activity) GetProject ¶
Get project associated with the activity.
func (*Activity) SetProject ¶
Set project associated with the activity.
func (*Activity) StartedTime ¶
Returns `Started` string as regular instance of `time.Time`.
type Project ¶
type Project struct {
ProjectId int64 // Numeric identifier of the project.
Name string // Name of the project.
Description string // Description of the project.
Created string // Datetime of creation of the project (formatted by RFC3339).
}
Project definition
func InsertProject ¶
Insert new project.
func SelectProjectById ¶
Return project(s) by given ID(s).
func SelectProjectByName ¶
Return single project by given name(s).
func SelectProjectWithTerm ¶
Return project(s) which names contains given term.
func SelectProjects ¶
Return projects.