package dao import ( "gorm.io/gorm" "grpc-base/common/mysql" "grpc-base/service/testuser/internal/conf" "grpc-base/service/testuser/internal/model" ) type Dao struct { db *gorm.DB } func New(c *conf.Config) (d *Dao) { d = &Dao{ db: mysql.NewDB(c.Mysql), } return } func (d *Dao) GetMemberById(uid int, col []string) (res *model.User, err error) { res = &model.User{} //d.db.Table("image2").Limit(1).Take(&res) err = d.db.Table("user"). Select(col). Where("id = ?", uid).Take(res).Error return }