diff options
| -rw-r--r-- | lib/uuidv7/uuidv7.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/uuidv7/uuidv7.go b/lib/uuidv7/uuidv7.go index 6870b562..e35e684b 100644 --- a/lib/uuidv7/uuidv7.go +++ b/lib/uuidv7/uuidv7.go @@ -6,6 +6,7 @@ package uuidv7 import ( "crypto/rand" + "database/sql/driver" "encoding/binary" "encoding/hex" "fmt" @@ -217,3 +218,10 @@ func (id *UUIDv7) Time() time.Time { t := time.UnixMilli(int64(millis)) return t } + +// Value returns the value for sending it to the database. +// This method implements the [driver.Valuer] interface. +func (id UUIDv7) Value() (v driver.Value, err error) { + v = id.String() + return v, nil +} |
