31 lines
530 B
Go
31 lines
530 B
Go
package storage
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"errors"
|
|
)
|
|
|
|
// What kind of being a user identifies as
|
|
type Being string
|
|
|
|
const (
|
|
BEING_HUMAN = Being("human")
|
|
BEING_CAT = Being("cat")
|
|
BEING_FOX = Being("fox")
|
|
BEING_DOG = Being("dog")
|
|
BEING_ROBOT = Being("robot")
|
|
BEING_DOLL = Being("doll")
|
|
)
|
|
|
|
func (r *Being) Value() (driver.Value, error) {
|
|
return r, nil
|
|
}
|
|
|
|
func (r *Being) Scan(raw any) error {
|
|
if v, ok := raw.(string); ok {
|
|
*r = Being(v)
|
|
return nil
|
|
} else {
|
|
return errors.New("value not a string")
|
|
}
|
|
}
|