ent 生成的代码包含了比较完整的查询谓词

字段谓词

  • Bool:

    • =, !=
  • Numeric:
    • =, !=, >, <, >=, <=,
    • IN, NOT IN
  • Time:
    • =, !=, >, <, >=, <=
    • IN, NOT IN
  • String:
    • =, !=, >, <, >=, <=
    • IN, NOT IN
    • Contains, HasPrefix, HasSuffix
    • ContainsFold, EqualFold (SQL specific)
  • Optional fields:
    • IsNil, NotNil

edge 谓词

  • HasEdge
 client.Pet.
      Query().
      Where(user.HasOwner()).
      All(ctx)
 
  • HasEdgeWith
 client.Pet.
      Query().
      Where(user.HasOwnerWith(user.Name("a8m"))).
      All(ctx)

Not

client.Pet.
    Query().
    Where(user.Not(user.NameHasPrefix("Ari"))).
    All(ctx)

OR

client.Pet.
    Query().
    Where(
        user.Or(
            user.HasOwner(),
            user.Not(user.HasFriends()),
        )
    ).
    All(ctx)

AND

client.Pet.
    Query().
    Where(
        user.And(
            user.HasOwner(),
            user.Not(user.HasFriends()),
        )
    ).
    All(ctx)

参考资料

https://entgo.io/docs/predicates/

最新文章

  1. 错误: “WebForm_DoPostBackWithOptions”未定义
  2. .NET应用架构设计—重新认识分层架构(现代企业级应用分层架构核心设计要素)
  3. 一个页面从输入URL 到页面加载显示完成的过程中都发生了什么
  4. [BTS] BizTalk With EF
  5. Android之Activity框架
  6. Linux计划任务入门详解
  7. AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet控件在C#中的引用
  8. Dividing 多重背包 倍增DP
  9. gulp解决RequireJS
  10. 04747_Java语言程序设计(一)_第2章_运算和语句
  11. Twitter 新一代流处理工具——Heron 该纸币Storm Limitations
  12. Servle资源注射
  13. 物理dataguard 正常切换 脚色转换,switchover_status 状态改变
  14. 使用Configuration Extensions读取配置
  15. tensorflow 只恢复部分模型参数
  16. ES--01
  17. [转] 安装npm全局包提示权限不够
  18. 开源库RxJava、ButterKnife
  19. MYSQL常用函数(时间和日期函数)
  20. Cassandra内部架构

热门文章

  1. Rdlc Mail Label
  2. In-Memory:哈希索引
  3. K8S学习笔记之k8s使用ceph实现动态持久化存储
  4. 使用IDEA创建maven父子工程项目
  5. mybatis使用用stdout-logging日志显示sql语句
  6. Java自学-数字与字符串 比较字符串
  7. pat 1039到底买不买
  8. 关于银企直连中银行通信类 配置篇 EPIC_PROC
  9. Nginx配置单项SSL以及双向SSL
  10. 1. vue.js介绍