123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package model
- import (
- "git.getensh.com/common/gopkgsv2/database"
- "gorm.io/gorm"
- )
- type Ads22Model interface {
- List(db *gorm.DB) ([]Ads22, error)
- Get(db *gorm.DB) (*Ads22, error)
- }
- type Ads22 struct {
- ID int64 `gorm:"column:id" json:"id"`
- Source string `gorm:"column:source" json:"source"`
- Standard string `gorm:"column:standard" json:"standard"`
- Type int64 `gorm:"column:type" json:"type"`
- }
- type defalutAds22Model struct {
- tableName string
- fields string
- }
- func NewAds22Model() Ads22Model {
- return &defalutAds22Model{
- tableName: "db_adm_ads.t_adm_ads22",
- fields: "id, source, standard, type",
- }
- }
- func (d *defalutAds22Model) List(db *gorm.DB) ([]Ads22, error) {
- var res []Ads22
- err := database.List(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return res, err
- }
- func (d *defalutAds22Model) Get(db *gorm.DB) (*Ads22, error) {
- var res Ads22
- err := database.Get(db, &res, database.Option{
- TableName: d.tableName,
- })
- return &res, err
- }
|