aboutsummaryrefslogtreecommitdiff
path: root/pkg/model/user.go
blob: ec524a8b27d10753736cf12db6f21099e36172ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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"`
}