refactor(backend/models): use pgtype for nullable fields
This commit is contained in:
parent
59eacd6bc5
commit
761babfa1a
@ -1,6 +1,10 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v5/pgtype"
|
||||||
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -13,28 +17,28 @@ type MIME struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Category struct {
|
type Category struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Color string `json:"color"`
|
Color pgtype.Text `json:"color"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type File struct {
|
type File struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name pgtype.Text `json:"name"`
|
||||||
MIME MIME `json:"mime"`
|
MIME MIME `json:"mime"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Color string `json:"color"`
|
Color pgtype.Text `json:"color"`
|
||||||
Category Category `json:"category"`
|
Category Category `json:"category"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Autotag struct {
|
type Autotag struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user