38 lines
618 B
Go
38 lines
618 B
Go
package item
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Kind string
|
|
|
|
const (
|
|
KindTask Kind = "task"
|
|
KindEvent Kind = "event"
|
|
)
|
|
|
|
var (
|
|
KnownKinds = []Kind{KindTask, KindEvent}
|
|
)
|
|
|
|
type Item struct {
|
|
ID string `json:"id"`
|
|
Kind Kind `json:"kind"`
|
|
Updated time.Time `json:"updated"`
|
|
Deleted bool `json:"deleted"`
|
|
Recurrer *Recur `json:"recurrer"`
|
|
RecurNext time.Time `json:"recurNext"`
|
|
Body string `json:"body"`
|
|
}
|
|
|
|
func NewItem(k Kind, body string) Item {
|
|
return Item{
|
|
ID: uuid.New().String(),
|
|
Kind: k,
|
|
Updated: time.Now(),
|
|
Body: body,
|
|
}
|
|
}
|