Replace birthdate type with NullDate

This commit is contained in:
Melon 2024-03-12 21:42:52 +00:00
parent 20654eb70d
commit 0b4f866cd0
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
5 changed files with 9 additions and 4 deletions

View File

@ -5,11 +5,11 @@
package database
import (
"database/sql"
"time"
"github.com/1f349/tulip/database/types"
"github.com/1f349/tulip/password"
"github.com/hardfinhq/go-date"
)
type ClientStore struct {
@ -39,7 +39,7 @@ type User struct {
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Pronouns types.UserPronoun `json:"pronouns"`
Birthdate sql.NullTime `json:"birthdate"`
Birthdate date.NullDate `json:"birthdate"`
Zoneinfo types.UserZone `json:"zoneinfo"`
Locale types.UserLocale `json:"locale"`
Role types.UserRole `json:"role"`

View File

@ -7,11 +7,11 @@ package database
import (
"context"
"database/sql"
"time"
"github.com/1f349/tulip/database/types"
"github.com/1f349/tulip/password"
"github.com/hardfinhq/go-date"
)
const deleteOtp = `-- name: DeleteOtp :exec
@ -154,7 +154,7 @@ type ModifyUserParams struct {
Picture string `json:"picture"`
Website string `json:"website"`
Pronouns types.UserPronoun `json:"pronouns"`
Birthdate sql.NullTime `json:"birthdate"`
Birthdate date.NullDate `json:"birthdate"`
Zoneinfo types.UserZone `json:"zoneinfo"`
Locale types.UserLocale `json:"locale"`
UpdatedAt time.Time `json:"updated_at"`

1
go.mod
View File

@ -17,6 +17,7 @@ require (
github.com/golang-migrate/migrate/v4 v4.17.0
github.com/google/subcommands v1.2.0
github.com/google/uuid v1.6.0
github.com/hardfinhq/go-date v1.20240228.1
github.com/julienschmidt/httprouter v1.3.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e

2
go.sum
View File

@ -72,6 +72,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/hardfinhq/go-date v1.20240228.1 h1:HLOcBU8evsI2fcK4m0O6QBtJXCpgydqI0/hT5Jh5O10=
github.com/hardfinhq/go-date v1.20240228.1/go.mod h1:IsPm0dt/YUNHsj39GgFOoi2DJOdx18iLkjVNdE9BfDw=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=

View File

@ -11,6 +11,8 @@ sql:
overrides:
- column: "users.password"
go_type: "github.com/1f349/tulip/password.HashString"
- column: "users.birthdate"
go_type: "github.com/hardfinhq/go-date.NullDate"
- column: "users.role"
go_type: "github.com/1f349/tulip/database/types.UserRole"
- column: "users.pronouns"