mailout/pkg/models/user.go

24 lines
1.1 KiB
Go

package models
import (
"time"
"github.com/google/uuid"
)
type User struct {
ID uuid.UUID `gorm:"column:id;type:uuid;default:gen_random_uuid()" yaml:"id"`
Username string `gorm:"primaryKey;column:username;type:varchar(256);not null" yaml:"username"`
Domain string `gorm:"primaryKey;column:domain;type:varchar(256);not null" yaml:"domain"`
Password string `gorm:"column:password;type:varchar(256);not null" yaml:"password"`
Home string `gorm:"column:home;type:varchar(256);not null;default:/var/lib/vmail/null" yaml:"home"`
UID int `gorm:"column:uid;type:integer;not null;default:1000" yaml:"uid"`
GID int `gorm:"column:gid;type:integer;not null;default:1000" yaml:"gid"`
Active bool `gorm:"column:active;type:boolean;not null;default:true" yaml:"active"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;not null;autoCreateTime:nano;default:now()" yaml:"created_at"`
UpdatedAt time.Time `gorm:"column:udpated_at;type:timestamp;not null;autoUpdateTime:nano;default:now()" yaml:"updated_at"`
}
func (o *User) TableName() string {
return "users"
}