百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

graphql-lodash

> 后端框架
开源

使用 lodash 语法对 GraphQL 查询进行数据操作

1.2K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

使用 lodash 语法对 GraphQL 查询进行数据操作

GraphQL Lodash

在 GraphQL 查询中释放 lodash 的强大功能

为什么?

yarn add graphql-lodash

API

graphqlLodash(query, [operationName])

  • query (必需) - 查询字符串或查询 AST
  • operationName (可选) - 仅当查询包含多个操作时才需要

返回值

{
  query: string|object,
  transform: Function
}
  • query - 删除 @_ 指令后的原始查询
  • transform - 一个接收 response.data 作为单个参数并返回的函数 以预期的形状显示相同的数据。

使用示例

将 graphql-lodash 集成的最简单方法是为您选择的 graphql 客户端编写封装函数:

javascript
import { graphqlLodash } from 'graphql-lodash';

function lodashQuery(queryWithLodash) {
let { query, transform } = graphqlLodash(queryWithLodash);
// 使用 'query' 变量作为查询进行 GraphQL 调用
// 并将结果放入 'result' 变量中
…
result.data = transf

[](https://david-dm.org/APIs-guru/graphql-lodash)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptapifunctional-programminggraphqllodash

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架