高级查询:Operators

操作符的使用

i:是忽略大小写的意思,和前面的一样

Beego-Model设计-Operators

在controllers文件夹下新建一个operatos.go

注册路由:

Beego-Model设计-Operators


  • exact:查询一条信息

orm.QueryTable是获得句柄,里面可以传递表名,也可以传递user结构体的一个对象

id_ _exact : 注意是双下划线  ; One是查询一条,All是查询多条

Beego-Model设计-Operators


  • contains:包含的意思,比如把包含n的过滤出来

查询时可能查到多个用户,所以用切片

Beego-Model设计-Operators


  • gt/gte :大于          lt/lte:小于

Beego-Model设计-Operators


  • startswith/istartswith    endswith/iendswith

意思:以什么开始   /   以什么结尾

注意 name_ _startswith   有两个下划线

Beego-Model设计-Operators


  • in

要查询的id是否在xxxxx中

Beego-Model设计-Operators


  • isnull

判断是否为空

Beego-Model设计-Operators

 

相关文章:

  • 2021-12-25
  • 2021-04-01
  • 2022-02-18
  • 2022-12-23
  • 2021-04-29
  • 2022-01-23
  • 2021-08-11
猜你喜欢
  • 2021-11-11
  • 2022-02-09
  • 2021-10-13
  • 2021-05-27
  • 2022-01-03
  • 2021-07-12
  • 2022-12-23
相关资源
相似解决方案