29 lines
444 B
Go
29 lines
444 B
Go
|
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
|
||
|
}
|