diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-12 02:52:22 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-12 02:53:52 +0300 |
commit | d05ea66f4bbcf0cc5c8908f3435c68de1b070fa1 (patch) | |
tree | 7c7a769206646f2b81a0eda0680f0be5033a4197 /pkg/model/user.go |
Начальная версияv0.0.1
Diffstat (limited to 'pkg/model/user.go')
-rw-r--r-- | pkg/model/user.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/model/user.go b/pkg/model/user.go new file mode 100644 index 0000000..ec524a8 --- /dev/null +++ b/pkg/model/user.go @@ -0,0 +1,26 @@ +package model + +import ( + "encoding/gob" + "encoding/json" + "time" + + "github.com/uptrace/bun" +) + +//nolint:gochecknoinits +func init() { + gob.Register(User{}) +} + +type User struct { + bun.BaseModel `bun:"table:users,alias:u"` + + ID int64 `bun:",pk,autoincrement"` + Email string `bun:",notnull,unique"` + Username string `bun:",notnull,unique"` + Password string `bun:",notnull"` + Meta json.RawMessage `bun:",type:jsonb"` + CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` + DeletedAt time.Time `bun:",soft_delete,nullzero"` +} |