err:=db.DB.MysqlDB.DefaultGormDB().Table("groups").Select("groups.*, (select count(*) from group_members where group_members.group_id=groups.group_id) as num").
Where(fmt.Sprintf(" name like '%%%s%%' ",groupName)).Limit(int(showNumber)).Offset(int(showNumber*(pageNumber-1))).Find(&groups).Error
Where(" name like ? ",fmt.Sprintf("%%%s%%",groupName)).Limit(int(showNumber)).Offset(int(showNumber*(pageNumber-1))).Find(&groups).Error
err:=db.DB.MysqlDB.DefaultGormDB().Table("users").Where(" name like %?%",userName).Limit(int(showNumber)).Offset(int(showNumber*(pageNumber-1))).Find(&users).Error
err:=db.DB.MysqlDB.DefaultGormDB().Table("users").Where(" name like ?",fmt.Sprintf("%%%s%%",userName)).Limit(int(showNumber)).Offset(int(showNumber*(pageNumber-1))).Find(&users).Error
returnusers,err
}
funcGetUsersCount(nickname string)(int32,error){
funcGetUsersCount(userName string)(int32,error){
varcountint64
iferr:=db.DB.MysqlDB.DefaultGormDB().Table("users").Where(" name like '%%%s%%' ",nickname).Count(&count).Error;err!=nil{
iferr:=db.DB.MysqlDB.DefaultGormDB().Table("users").Where(" name like ? ",fmt.Sprintf("%%%s%%",userName)).Count(&count).Error;err!=nil{