supabase/pg_graphql · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈
pg_graphql
文档:https://supabase.github.io/pg_graphql
源代码:https://github.com/supabase/pg_graphql
pg_graphql 为你的 PostgreSQL 数据库添加 GraphQL 支持。
- 高性能
- 一致性
- 无服务器架构
- 开源
概述
pg_graphql 会将现有的 SQL 模式转换为 GraphQL 模式。
该扩展将模式转换与查询解析功能完整地封装在数据库服务器中。这样一来,任何能够连接 PostgreSQL 的编程语言都无需额外的服务器、进程或库,即可通过 GraphQL 对数据库进行查询。
简介
SQL 模式
create table account(
id serial primary key,
email varchar(255) not null,
created_at timestamp not null,
updated_at timestamp not null
);
create table blog(
id serial primary key,
owner_id integer not null references account(id),
name varchar(255) not null,
description varchar(255),
created_at timestamp not null,
updated_at timestamp not null
);
create type blog_post_status as enum ('PENDING', 'RELEASED');
create table blog_post(
id uuid not null default uuid_generate_v4() primary key,
blog_id integer not null references blog(id),
title varchar(255) not null,
body varchar(10000),
status blog_post_status not null,
created_at timestamp not null,
updated_at timestamp not null
);
-- This enables default inflection, which automatically renames
-- snake_case to PascalCase for type names, and snake_case to camelCase for field names.
-- See https://supabase.github.io/pg_graphql/configuration/#inflection for more details.
COMMENT ON SCHEMA public IS e'@graphql({"inflect_names": true})';
会被转换为下方显示的 GraphQL 模式。
每个表在顶层Query类型中都有一个入口点,该入口点代表一个可分页的集合,其关联关系由外键定义。同样地,这些表在Mutation模式中也拥有入口点,可用于执行插入、更新和删除等批量操作。

贡献代码
如需更多信息,请参阅 贡献文档。