gime-flat/model_tag.go

30 lines
460 B
Go
Raw Normal View History

2018-08-02 20:05:31 +00:00
package main
import "github.com/pborman/uuid"
type Tag struct {
UUID string
Name string
Billable bool
}
func NewTag(nm string, bill bool) *Tag {
t := Tag{UUID: uuid.New(), Name: nm, Billable: bill}
return &t
}
func (t *Tag) String() string {
ret := "{ " + t.Name + ", "
if t.Billable {
ret += "Billable"
} else {
ret += "Nonbillable"
}
ret += " (" + t.UUID + ") }"
return ret
}
func (t *Tag) SetBillable(v bool) {
t.Billable = v
}