1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package model
- import (
- "git.getensh.com/common/gopkgsv2/database"
- "gorm.io/gorm"
- )
- type Ads8Model interface {
- Get(db *gorm.DB) (*Ads8, error)
- List(db *gorm.DB) ([]Ads8, error)
- }
- type Ads8 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 defaultAds8Model struct {
- tableName string
- fields string
- }
- func NewAds8Model() Ads8Model {
- return &defaultAds8Model{
- "db_adm_ads.t_adm_ads8",
- "id, vin, third_style_id, source",
- }
- }
- func (d *defaultAds8Model) Get(db *gorm.DB) (*Ads8, error) {
- var res Ads8
- err := database.Get(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return &res, err
- }
- func (d *defaultAds8Model) List(db *gorm.DB) ([]Ads8, error) {
- var res []Ads8
- err := database.List(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return res, err
- }
|