package model import ( "git.getensh.com/common/gopkgsv2/database" "gorm.io/gorm" ) type Dws11Model interface { Get(db *gorm.DB) (*AdmDws11, error) } type AdmDws11 struct { ID int64 `gorm:"column:id" json:"id"` VinRule string `gorm:"column:vin_rule" json:"vin_rule"` ModelNo string `gorm:"column:model_no" json:"model_no"` } type defaultDws11Model struct { tableName string fields string } func NewDws11Model() Dws11Model { return &defaultDws11Model{ tableName: "db_adm_dws.t_adm_dws11", fields: "id, vin_rule, model_no", } } func (d *defaultDws11Model) Get(db *gorm.DB) (*AdmDws11, error) { var res AdmDws11 err := database.Get(db, &res, database.Option{ TableName: d.tableName, Fields: d.fields, }) return &res, err }