planner/cal/main.go

69 lines
1.1 KiB
Go
Raw Normal View History

2024-09-11 07:50:27 +02:00
package main
import (
"fmt"
"os"
"time"
2024-09-18 07:29:48 +02:00
2024-09-20 07:09:30 +02:00
"go-mod.ewintr.nl/planner/item"
2024-09-11 07:50:27 +02:00
)
func main() {
fmt.Println("cal")
2024-09-24 07:44:00 +02:00
repo, err := NewSqlite("test.db")
2024-09-11 07:50:27 +02:00
if err != nil {
fmt.Println(err)
os.Exit(1)
}
2024-09-24 07:44:00 +02:00
one := item.Event{
ID: "a",
EventBody: item.EventBody{
Title: "title",
Start: time.Now(),
End: time.Now().Add(-5 * time.Second),
},
2024-09-11 07:50:27 +02:00
}
2024-09-24 07:44:00 +02:00
if err := repo.Delete(one.ID); err != nil {
2024-09-11 07:50:27 +02:00
fmt.Println(err)
os.Exit(1)
}
2024-09-24 07:44:00 +02:00
all, err := repo.FindAll()
2024-09-11 07:50:27 +02:00
if err != nil {
fmt.Println(err)
os.Exit(1)
}
2024-09-24 07:44:00 +02:00
fmt.Printf("all: %+v\n", all)
// c := client.NewClient("http://localhost:8092", "testKey")
// items, err := c.Updated([]item.Kind{item.KindEvent}, time.Time{})
// if err != nil {
// fmt.Println(err)
// os.Exit(1)
// }
// fmt.Printf("%+v\n", items)
// i := item.Item{
// ID: "id-1",
// Kind: item.KindEvent,
// Updated: time.Now(),
// Body: "body",
// }
// if err := c.Update([]item.Item{i}); err != nil {
// fmt.Println(err)
// os.Exit(1)
// }
// items, err = c.Updated([]item.Kind{item.KindEvent}, time.Time{})
// if err != nil {
// fmt.Println(err)
// os.Exit(1)
// }
// fmt.Printf("%+v\n", items)
2024-09-11 07:50:27 +02:00
}