Documentation
¶
Index ¶
- Constants
- func DeleteActivities(dbPath string, id []int) (err error)
- func DeleteActivity(dbPath string, id int) (err error)
- func GetActivities(dbPath string, ids []int) (activities []*activity.Activity, err error)
- func GetActivitiesAll(dbPath string) (activities []*activity.Activity, err error)
- func GetFormat(file string) (format graphviz.Format, err error)
- func InsertActivities(acts []*activity.Activity, dbPath string, ...) (err error)
- func InsertActivity(act *activity.Activity, dbPath string, ...) (err error)
- func Parse(path string) (activities []*activity.Activity, err error)
- func PrintPretty(activities []*activity.Activity, withColor bool)
- func PrintRaw(activities []*activity.Activity)
- func Sort(filename, start string) (activitiesSorted []*activity.Activity, err error)
- func UpdateActivity(dbPath string, id int, field, value string) (err error)
- func WriteFile(filename string, activities []*activity.Activity) (err error)
Constants ¶
const TimeFormat = "2 Jan 2006 15:04"
Time format to use when parsing
Variables ¶
This section is empty.
Functions ¶
func DeleteActivities ¶
DeleteActivities deletes activities with the specified 'ids' from the database located at 'dbPath'. It returns an error if the deletion operation encounters any issues.
func DeleteActivity ¶
DeleteActivity deletes the activity with the specified 'id' from the database located at 'dbPath'. It returns an error if the deletion operation encounters any issues.
func GetActivities ¶
GetActivities retrieves activities with the specified 'ids' from the database located at 'dbPath'. It returns a slice of activities and any encountered error during the operation.
func GetActivitiesAll ¶
GetActivitiesAll retrieves all activities from the database located at 'dbPath'. It returns a slice of activities and any encountered error during the operation.
func GetFormat ¶
GetFormat determines the graphviz format based on the file extension. It returns the detected format and any encountered error during the process.
func InsertActivities ¶
func InsertActivities(acts []*activity.Activity, dbPath string, duplicateInsertPolicy db.DuplicateInsertPolicy) (err error)
InsertActivities inserts the provided slice of activities 'acts' into the database located at 'dbPath'. The optional 'duplicateInsertPolicy' parameter specifies the policy for handling duplicate inserts. It returns an error if the insertion operation encounters any issues.
func InsertActivity ¶
func InsertActivity(act *activity.Activity, dbPath string, duplicateInsertPolicy db.DuplicateInsertPolicy) (err error)
InsertActivity inserts the provided 'act' activity into the database located at 'dbPath'. The optional 'duplicateInsertPolicy' parameter specifies the policy for handling duplicate inserts. It returns an error if the insertion operation encounters any issues.
func Parse ¶
Parse reads and interprets the content of a file specified by 'path' and returns a slice of activities. It automatically detects the file type based on its extension and uses the appropriate parser. Supported file types include SQLite database (.db), JSON (.json), CSV (.csv), and XLSX (.xlsx). It returns a slice of activities and any encountered error during the parsing process.
func PrintPretty ¶
PrintPretty prints a formatted table with details of each activity in the provided slice. The 'withColor' parameter determines whether to use colored output.
func Sort ¶
Sort reads the file specified by 'filename' and organizes the activities based on their dependencies. The 'start' parameter represents the project start date. It returns a sorted slice of activities and any encountered error during the sorting process.
func UpdateActivity ¶
UpdateActivity updates the specified field of the activity with 'id' in the database located at 'dbPath'. The 'field' parameter specifies the field to be updated, and 'value' is the new value for that field. It returns an error if the update operation encounters any issues.
Types ¶
This section is empty.