- 博客(5)
- 收藏
- 关注
原创 go-xorm 多条件组合搜索,分页,排序
关键代码:func ADGetComm(Db *xorm.Engine, model1 *model.IncentiveAd, limit, start int) (*[]model.IncentiveAd, error) { var ads []model.IncentiveAd //多条件动态查询 session := Db.Where("") if model1.AdName != "" { name := "%" + model1.AdName + "%"
2021-06-03 12:09:08 1540 1
原创 go 快速获取字符串中的网址
找到了个实用的包,无需正则就能快速获取到字符串中的网址代码示例:func TestName(t *testing.T) { s:="https://github.com/mvdan/xurls" findString := xurls.Relaxed.FindString(s) t.Log(findString) allString := xurls.Relaxed.FindAllString(s, -1) t.Log(allString) findAllStr
2021-06-03 12:05:20 521
原创 记:go 不同结构体,复制其中属性一样的方法
导入"github.com/jinzhu/copier"type TCPrase struct {}type MoreDetailResponse struct {}copier.Copy(&tcPrase, mddata)具体函数可参考:https://pkg.go.dev/github.com/jinzhu/copier
2021-06-03 11:49:32 679
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人