From de51449f7da78c1fe3e6e0ef2f4405df29720f68 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 16 Mar 2022 00:03:27 +0000 Subject: [PATCH] Initial Template structure --- main.go | 24 ++---------------------- template.go | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/main.go b/main.go index 0476815..df39780 100644 --- a/main.go +++ b/main.go @@ -1,27 +1,7 @@ package main -import "fmt" - -import "github.com/google/uuid" +// import "fmt" +// import "github.com/google/uuid" func main() { - store := NewStore("foo") - - out := &Template{ - Id: uuid.NewString(), - Test: "round trip", - } - - store.Write(out) - - in := &Template{ - Id: out.Id, - } - - store.Read(in) - - fmt.Printf("%+v\n", in) - - bus := NewBus() - bus.Announce(in) } diff --git a/template.go b/template.go index 6ab4702..cf6a3e2 100644 --- a/template.go +++ b/template.go @@ -1,8 +1,22 @@ package main +import "time" + type Template struct { - Id string - Test string + Id string `json:"id"` + Items []*Item `json:"items"` +} + +type Item struct { + Id string `json:"id"` + + Check *Check `json:"check,omitempty"` +} + +type Check struct { + Text string `json:"text"` + Owner string `json:"owner"` + Completed *time.Time `json:"completed"` } func (t *Template) GetType() string {