framework/pkg/model/user.go

27 lines
605 B
Go
Raw Permalink Normal View History

2024-10-12 02:52:22 +03:00
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"`
}