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