linstrom/storage/noteTargets.go

29 lines
444 B
Go
Raw Normal View History

2024-05-31 09:54:39 +00:00
package storage
import (
"database/sql/driver"
"errors"
)
type NoteTarget uint8
const (
NOTE_TARGET_PUBLIC = NoteTarget(0)
NOTE_TARGET_HOME = NoteTarget(1 << iota)
NOTE_TARGET_FOLLOWERS
NOTE_TARGET_DM
)
func (n *NoteTarget) Value() (driver.Value, error) {
return n, nil
}
func (n *NoteTarget) Scan(value any) error {
vBig, ok := value.(int64)
if !ok {
return errors.New("not an int64")
}
*n = NoteTarget(vBig)
return nil
}