refactor sqlite db to support sqlc
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"net/mail"
|
||||
"strings"
|
||||
@@ -99,10 +100,17 @@ func CustomerIdToString(customerId CustomerId) string {
|
||||
type SessionId uuid.UUID
|
||||
type UserId uuid.UUID
|
||||
|
||||
func UserIdFromString(userId string) UserId {
|
||||
id, err := uuid.Parse(userId)
|
||||
if err != nil {
|
||||
fmt.Errorf("unable to parse user id %+v", err)
|
||||
}
|
||||
return UserId(id)
|
||||
}
|
||||
|
||||
func (s *SessionId) String() string {
|
||||
id := uuid.UUID(*s)
|
||||
return id.String()
|
||||
|
||||
}
|
||||
|
||||
type UserEmail string
|
||||
|
||||
Reference in New Issue
Block a user