package model import ( "git.getensh.com/common/gopkgsv2/database" "gorm.io/gorm" ) type Ads23Model interface { Get(db *gorm.DB) (*Ads23, error) List(db *gorm.DB) ([]Ads23, error) } type Ads23 struct { ID int64 `gorm:"column:id" json:"id"` Vin string `gorm:"column:vin" json:"vin"` ThirdStyleId string `gorm:"column:third_style_id" json:"third_style_id"` Source string `gorm:"column:source" json:"source"` } type defaultAds23Model struct { tableName string fields string } func NewAds23Model() Ads23Model { return &defaultAds23Model{ "db_adm_ads.t_adm_ads23", "id, vin, third_style_id, source", } } func (d *defaultAds23Model) Get(db *gorm.DB) (*Ads23, error) { var res Ads23 err := database.Get(db, &res, database.Option{ TableName: d.tableName, Fields: d.fields, }) return &res, err } func (d *defaultAds23Model) List(db *gorm.DB) ([]Ads23, error) { var res []Ads23 err := database.List(db, &res, database.Option{ TableName: d.tableName, Fields: d.fields, }) return res, err }