ads18.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package model
  2. import (
  3. "git.getensh.com/common/gopkgsv2/database"
  4. "gorm.io/gorm"
  5. )
  6. type Ads18Model interface {
  7. Get(db *gorm.DB) (*Ads18, error)
  8. }
  9. type Ads18 struct {
  10. ID int64 `gorm:"column:id" json:"id"`
  11. ModelNo string `gorm:"column:model_no" json:"model_no"`
  12. PlateType string `gorm:"column:plate_type" json:"plate_type"`
  13. VehicleType string `gorm:"column:vehicle_type" json:"vehicle_type"`
  14. VehicleTypeDetail string `gorm:"column:vehicle_type_detail" json:"vehicle_type_detail"`
  15. CreatedAt int64 `gorm:"column:created_at" json:"created_at"`
  16. UpdatedAt int64 `gorm:"column:updated_at" json:"updated_at"`
  17. }
  18. type defaultAds18Model struct {
  19. tableName string
  20. fields string
  21. }
  22. func NewAds18Model() Ads18Model {
  23. return &defaultAds18Model{
  24. "db_adm_ads.t_adm_ads18",
  25. "id, model_no, plate_type, vehicle_type, vehicle_type_detail",
  26. }
  27. }
  28. func (d *defaultAds18Model) Get(db *gorm.DB) (*Ads18, error) {
  29. var res Ads18
  30. err := database.Get(db, &res, database.Option{
  31. TableName: d.tableName,
  32. })
  33. return &res, err
  34. }