用 JavaScript 编写 PG 函数 Plv8js

码农软件 · 软件分类 · 其他开发相关 · 2019-10-23 21:12:33

软件介绍

plv8js 是一个 PostgreSQL 的存储过程语言的扩展,也就是说你可以用 JavaScript 来编写 PostgreSQL 的函数,使用 Google 的 V8 引擎。

示例代码:

CREATE FUNCTION to_jsontext(keys text[], vals text[]) RETURNS text AS
$$
        var o = {};
        for (var i = 0; i < keys.length; i++)
                o[keys[i]] = vals[i];
        return JSON.stringify(o);
$$
LANGUAGE plv8 IMMUTABLE STRICT;

SELECT to_jsontext(ARRAY['age', 'sex'], ARRAY['21', 'female']);
         to_jsontext         
-----------------------------
 {"age":"21","sex":"female"}
(1 row)

本文地址:https://codercto.com/soft/d/17417.html

The Golden Ticket

The Golden Ticket

Lance Fortnow / Princeton University Press / 2013-3-31 / USD 26.95

The P-NP problem is the most important open problem in computer science, if not all of mathematics. The Golden Ticket provides a nontechnical introduction to P-NP, its rich history, and its algorithmi......一起来看看 《The Golden Ticket》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器