mirror of
https://github.com/1f349/tulip.git
synced 2024-11-09 22:42:53 +00:00
Output user pronoun database valuer
This commit is contained in:
parent
9bea6805d5
commit
69fa6a4812
@ -2,6 +2,7 @@ package types
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"database/sql/driver"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mrmelon54/pronouns"
|
"github.com/mrmelon54/pronouns"
|
||||||
@ -27,7 +28,13 @@ func (p *UserPronoun) Scan(src any) error {
|
|||||||
p.Pronoun = pro
|
p.Pronoun = pro
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *UserPronoun) Value() (driver.Value, error) {
|
||||||
|
return p.Pronoun.String(), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (p UserPronoun) MarshalJSON() ([]byte, error) { return json.Marshal(p.Pronoun.String()) }
|
func (p UserPronoun) MarshalJSON() ([]byte, error) { return json.Marshal(p.Pronoun.String()) }
|
||||||
|
|
||||||
func (p *UserPronoun) UnmarshalJSON(bytes []byte) error {
|
func (p *UserPronoun) UnmarshalJSON(bytes []byte) error {
|
||||||
var a string
|
var a string
|
||||||
err := json.Unmarshal(bytes, &a)
|
err := json.Unmarshal(bytes, &a)
|
||||||
|
Loading…
Reference in New Issue
Block a user