Lots of work
This commit is contained in:
parent
a2a937791d
commit
3086b0e9b4
28 changed files with 1284 additions and 2 deletions
28
storage/noteTargets.go
Normal file
28
storage/noteTargets.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue