aboutsummaryrefslogtreecommitdiffstats
path: root/timetask/fields.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-04 02:07:50 +0200
committerTeddy Wing2017-06-04 02:07:50 +0200
commit02e4fb5d0d95b8c5c5442ee0a97b960f1296c236 (patch)
tree4cf323694692322036b80d2d921ff966096c6c36 /timetask/fields.go
parent055301ca09d57b759b290d897bbb7560460251ca (diff)
parent9b6a6543e351308939bd420243507368b0669e63 (diff)
downloadtimetasker-02e4fb5d0d95b8c5c5442ee0a97b960f1296c236.tar.bz2
Merge branch 'timetasker-daily'
Diffstat (limited to 'timetask/fields.go')
-rw-r--r--timetask/fields.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/timetask/fields.go b/timetask/fields.go
deleted file mode 100644
index fb3a026..0000000
--- a/timetask/fields.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package timetask
-
-import "fmt"
-
-type Client struct {
- ID int
- Name string
- Projects []Project
-}
-
-type Project struct {
- ID int
- Name string
- Modules []Module
- Tasks []Task
- WorkTypes []WorkType `yaml:"work_types"`
-}
-
-type Module struct {
- ID int
- Name string
-}
-type Task struct {
- ID int
- Name string
-}
-type WorkType struct {
- ID int
- Name string
-}
-
-type Fields struct {
- PersonID int `yaml:"person_id"`
- Clients []Client
-}
-
-func (f *Fields) ClientByName(client_name string) (*Client, error) {
- for _, client := range f.Clients {
- if client.Name == client_name {
- return &client, nil
- }
- }
-
- return nil, fmt.Errorf("Client %s not found", client_name)
-}
-
-func (c *Client) ProjectByName(project_name string) (*Project, error) {
- for _, project := range c.Projects {
- if project.Name == project_name {
- return &project, nil
- }
- }
-
- return nil, fmt.Errorf("Project %s not found", project_name)
-}
-
-func (p *Project) ModuleByName(module_name string) (*Module, error) {
- for _, module := range p.Modules {
- if module.Name == module_name {
- return &module, nil
- }
- }
-
- return nil, fmt.Errorf("Module %s not found", module_name)
-}
-
-func (p *Project) TaskByName(task_name string) (*Task, error) {
- for _, task := range p.Tasks {
- if task.Name == task_name {
- return &task, nil
- }
- }
-
- return nil, fmt.Errorf("Task %s not found", task_name)
-}
-
-func (p *Project) WorkTypeByName(work_type_name string) (*WorkType, error) {
- for _, work_type := range p.WorkTypes {
- if work_type.Name == work_type_name {
- return &work_type, nil
- }
- }
-
- return nil, fmt.Errorf("Work type %s not found", work_type_name)
-}