SuperAPI AI 工具集

objectstack-query

写作与研究

查看项目

更新于 10-15 19:47

技能介绍

用途:编写 ObjectQL 查询 DSL,覆盖过滤、排序、分页、聚合、关联展开和全文搜索。引擎调用约定 object 为首个参数:engine.find('task', {…}, { context })、engine.aggregate('deal', {…})、engine.count('task', {…});REST 走 findData({ object: 'task', query: {…} }),object 位于 query 之外。选项键为封闭集合,未知键会按名拒绝而非忽略。top 折叠为 limit,filter 折叠为 where。

主要能力:过滤支持隐式等值及 $eq、$ne、$gt、$gte、$lt、$lte、$in、$nin、$between、$contains、$startsWith、$endsWith、$icontains、$like、$ilike、$null、$exists 与 $and/$or/$not;可按关联记录过滤,支持跨字段比较。排序用 orderBy 数组,元素顺序即优先级,默认 asc。分页支持 offset 与 keyset。聚合支持 count、sum、avg、min、max、count_distinct、groupBy、日期分桶、having 及每度量 filter。展开 expand 读取 lookup/master_detail,需在 fields 中保留外键列,默认最大深度 3。全文搜索用 search 加 searchFields,各词以 $icontains 跨字段 OR 后 AND。

上下文:context 是 RLS/系统读取的口子,可用 { isSystem: true };读取时 context 可放查询袋或末尾参数,末尾优先。

限制:search 不跨关联,模糊、boost、operator、minScore、language、highlight 会被静默忽略;query.cursor、joins、distinct、windowFunctions 等已移除并给出替代;aggregate 不接受 fields 与 orderBy;count 不接受 timezone 与透传键;expand 路径上 limit/offset/orderBy 不生效。部分细节暂未提供。