package models import "zhiyuan/pkg/db" type MatBid struct { ID int `json:"id"` PkgID int `json:"pkg_id"` ItemID int `json:"item_id"` Price float64 `json:"price"` CreatedAt int `json:"created_at"` UpdatedAt int `json:"updated_at"` } func (MatBid) TableName() string { return "zy_mat_bid" } func (o MatBid) GetOne(where map[string]interface{}, fields []string, retVal interface{}) (*MatBid, error) { if retVal == nil { var matBid *MatBid err := db.GetOne(o.TableName(), where, fields, &matBid) return matBid, err } else { err := db.GetOne(o.TableName(), where, fields, retVal) return nil, err } } func (o MatBid) GetMulti(where map[string]interface{}, fields []string, retVal interface{}) ([]*MatBid, error) { if retVal == nil { var matBid []*MatBid err := db.GetMulti(o.TableName(), where, fields, &matBid) return matBid, err } else { err := db.GetMulti(o.TableName(), where, fields, retVal) return nil, err } }