package model import ( "git.getensh.com/common/gopkgsv2/database" "gorm.io/gorm" ) type Dws12Model interface { Get(db *gorm.DB) (*Dws12, error) } type Dws12 struct { ID int64 `gorm:"column:id" json:"id"` ModelNo string `gorm:"column:model_no" json:"model_no"` PlateType string `gorm:"column:plate_type" json:"plate_type"` VehicleType string `gorm:"column:vehicle_type" json:"vehicle_type"` VehicleTypeDetail string `gorm:"column:vehicle_type_detail" json:"vehicle_type_detail"` CreatedAt int64 `gorm:"column:created_at" json:"created_at"` UpdatedAt int64 `gorm:"column:updated_at" json:"updated_at"` } type defaultDws12Model struct { tableName string fields string } func NewDws12Model() Dws12Model { return &defaultDws12Model{ "t_adm_dws12", "id, model_no, plate_type, vehicle_type, vehicle_type_detail", } } func (d *defaultDws12Model) Get(db *gorm.DB) (*Dws12, error) { var res Dws12 err := database.Get(db, &res, database.Option{ TableName: d.tableName, }) return &res, err }