package models import "zhiyuan/pkg/db" type MatBrand struct { ID int `json:"id"` BrandName string `json:"brand_name"` CreatedAt int `json:"created_at"` UpdatedAt int `json:"updated_at"` } func (MatBrand) TableName() string { return "zy_mat_brand" } func (o MatBrand) GetOne(where map[string]interface{}, fields []string, retVal interface{}) (*MatBrand, error) { if retVal == nil { var matBrand *MatBrand err := db.GetOne(o.TableName(), where, fields, &matBrand) return matBrand, err } else { err := db.GetOne(o.TableName(), where, fields, retVal) return nil, err } } func (o MatBrand) GetMulti(where map[string]interface{}, fields []string, retVal interface{}) ([]*MatBrand, error) { if retVal == nil { var matBrand []*MatBrand err := db.GetMulti(o.TableName(), where, fields, &matBrand) return matBrand, err } else { err := db.GetMulti(o.TableName(), where, fields, retVal) return nil, err } }