30 lines
460 B
Go
30 lines
460 B
Go
|
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
|
||
|
}
|