ads23.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package model
  2. import (
  3. "git.getensh.com/common/gopkgsv2/database"
  4. "gorm.io/gorm"
  5. )
  6. type Ads23Model interface {
  7. Get(db *gorm.DB) (*Ads23, error)
  8. List(db *gorm.DB) ([]Ads23, error)
  9. }
  10. type Ads23 struct {
  11. ID int64 `gorm:"column:id" json:"id"`
  12. Vin string `gorm:"column:vin" json:"vin"`
  13. ThirdStyleId string `gorm:"column:third_style_id" json:"third_style_id"`
  14. Source string `gorm:"column:source" json:"source"`
  15. }
  16. type defaultAds23Model struct {
  17. tableName string
  18. fields string
  19. }
  20. func NewAds23Model() Ads23Model {
  21. return &defaultAds23Model{
  22. "db_adm_ads.t_adm_ads23",
  23. "id, vin, third_style_id, source",
  24. }
  25. }
  26. func (d *defaultAds23Model) Get(db *gorm.DB) (*Ads23, error) {
  27. var res Ads23
  28. err := database.Get(db, &res, database.Option{
  29. TableName: d.tableName,
  30. Fields: d.fields,
  31. })
  32. return &res, err
  33. }
  34. func (d *defaultAds23Model) List(db *gorm.DB) ([]Ads23, error) {
  35. var res []Ads23
  36. err := database.List(db, &res, database.Option{
  37. TableName: d.tableName,
  38. Fields: d.fields,
  39. })
  40. return res, err
  41. }