MyGit

v11.2.0

PostgREST/postgrest

版本发布时间: 2023-08-10 22:13:32

PostgREST/postgrest最新发布版本:devel(2024-05-05 03:36:38)

Overview

PostgREST serves a RESTful API from any existing PostgreSQL database.

v11.2.0 brings you the possibility of using PostgreSQL domains and casts to change how your data is presented to web users. We call this feature "domain representations" and it holds some advantages over views.

-- having a uuid domain and a table
create domain app_uuid as uuid;

create table profiles(
  id   app_uuid
, name text
);

-- we define a function to convert the uuid domain to base64
create or replace function json(app_uuid) returns json as $$
  select to_json(encode(uuid_send($1),'base64'));
$$ language sql immutable;

-- and use the function for an implicit cast from domain to json 
create cast (app_uuid as json) with function json(app_uuid) as implicit;

-- the format changes when requesting JSON at the API level
curl "http://localhost:3000/profiles" \
  -H "Accept: application/json"

[{"id":"hGxP/ZLOTeeNEY4pkp9OxA==","name":"John Doe"}]

-- while the data is kept as is at the database level
select * from profiles;

                  id                  |   name
--------------------------------------+----------
 846c4ffd-92ce-4de7-8d11-8e29929f4ec4 | John Doe

Domain representations also allow you to change the format of the request payload and the format of the filters values. Check the Domain Representations docs for more details.

What is new

API

Admin

Resource Embedding

Resource Representation

Tables and Views

What is fixed

Auth

API

Misc

Deprecated

Resource Embedding

New Contributors

Full Changelog: https://github.com/PostgREST/postgrest/compare/v11.1.0...v11.2.0

相关地址:原始地址 下载(tar) 下载(zip)

1、 postgrest-v11.2.0-freebsd-x64.tar.xz 5.87MB

2、 postgrest-v11.2.0-linux-static-x64.tar.xz 3.45MB

3、 postgrest-v11.2.0-macos-x64.tar.xz 2.36MB

4、 postgrest-v11.2.0-ubuntu-aarch64.tar.xz 9.55MB

5、 postgrest-v11.2.0-windows-x64.zip 12.05MB

查看:2023-08-10发行的版本