summaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-04-08 23:23:23 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-04-08 23:23:23 +0200
commitc60dd3357fc84e14795f5f864e9fa9ce7150179f (patch)
treee642f70b89674b0f4ef88986a98001f8be8e24db /model
parent01e96380a4e48b5d338c71fad690382124195b17 (diff)
Some work
Diffstat (limited to 'model')
-rw-r--r--model/timer.go7
-rw-r--r--model/uuid.go28
2 files changed, 35 insertions, 0 deletions
diff --git a/model/timer.go b/model/timer.go
new file mode 100644
index 0000000..73bf7bc
--- /dev/null
+++ b/model/timer.go
@@ -0,0 +1,7 @@
+package model
+
+type Timer struct {
+ Id UUID
+ Name string
+}
+
diff --git a/model/uuid.go b/model/uuid.go
new file mode 100644
index 0000000..f072d92
--- /dev/null
+++ b/model/uuid.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ sqldriver "database/sql/driver"
+ "github.com/google/uuid"
+)
+
+type UUID struct {
+ payload uuid.UUID
+}
+
+func NewUUID() UUID {
+ id, _ := uuid.NewRandom()
+ return UUID { payload: id }
+}
+
+func (self UUID) Value() (sqldriver.Value, error) {
+ return self.payload.MarshalBinary()
+}
+
+func (self *UUID) Scan(value any) error {
+ return self.payload.Scan(value)
+}
+
+func (self UUID) String() string {
+ return self.payload.String()
+}
+