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 }