Some work
This commit is contained in:
7
model/timer.go
Normal file
7
model/timer.go
Normal file
@ -0,0 +1,7 @@
|
||||
package model
|
||||
|
||||
type Timer struct {
|
||||
Id UUID
|
||||
Name string
|
||||
}
|
||||
|
28
model/uuid.go
Normal file
28
model/uuid.go
Normal file
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user