26 lines
704 B
Go
26 lines
704 B
Go
|
package types
|
||
|
|
||
|
import "gorm.io/gorm"
|
||
|
|
||
|
/*
|
||
|
drop table if exists books;
|
||
|
create table if not exists books (
|
||
|
id int unsigned auto_increment primary key,
|
||
|
name varchar(32) not null comment '',
|
||
|
category int unsigned default 0 comment '',
|
||
|
avatar varchar(128) default '' comment '',
|
||
|
filename varchar(128) not null comment '',
|
||
|
created_at bigint default 0 comment '',
|
||
|
updated_at bigint default 0 comment '',
|
||
|
deleted_at bigint default 0 comment ''
|
||
|
);
|
||
|
*/
|
||
|
|
||
|
type Book struct {
|
||
|
gorm.Model
|
||
|
Name string `json:"name" gorm:"type:varchar(32)"`
|
||
|
Category uint `json:"category"`
|
||
|
Avatar string `json:"avatar" gorm:"type:varchar(128)"`
|
||
|
Filename string `json:"filename" gorm:"type:varchar(128)"`
|
||
|
}
|