27 lines
856 B
Go
27 lines
856 B
Go
|
package types
|
||
|
|
||
|
import "gorm.io/gorm"
|
||
|
|
||
|
/*
|
||
|
drop table if exists users;
|
||
|
create table if not exists users(
|
||
|
id int unsigned auto_increment primary key,
|
||
|
username varchar(32) not null comment '',
|
||
|
passwd varchar(128) not null comment '',
|
||
|
nikename varchar(32) default '' comment '',
|
||
|
phone char(11) default '' comment '',
|
||
|
email varchar(64) default '' comment '',
|
||
|
created_at bigint default 0 comment '',
|
||
|
updated_at bigint default 0 comment '',
|
||
|
deleted_at bigint default 0 comment '',
|
||
|
unique(username)
|
||
|
);
|
||
|
*/
|
||
|
type User struct {
|
||
|
gorm.Model
|
||
|
Name string `json:"name" gorm:"type:varchar(32);unique;not null"`
|
||
|
Password string `json:"-" gorm:"type:varchar(128);not null"`
|
||
|
Nickname string `json:"nickname" gorm:"type:varchar(32)"`
|
||
|
Phone string `json:"phone" gorm:"type:char(11)"`
|
||
|
Email string `json:"email" gorm:"type:varchar(64)"`
|
||
|
}
|