Initial Template structure
This commit is contained in:
24
main.go
24
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)
|
||||
}
|
||||
|
||||
18
template.go
18
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 {
|
||||
|
||||
Reference in New Issue
Block a user