BedquiltDB PostgreSQL 扩展开源项目

我要开发同款
匿名用户2016年04月20日
48阅读
所属分类查看源码 »、数据库相关、NoSQL数据库
授权协议MIT

作品详情

BedquiltDB是一款开源的PostgreSQL扩展,专门用于支持jsonb数据类型的存储,并且提供相应的开放API。BedquiltDB旨在为开发人员提供一种功能强大的工具,在项目的早期阶段,用于处理松散结构化的数据。

优点:

简单开放的API

支持所有编程语言

支持所有SQL语句,包括约束

容易从"looseschema"模式切换到"welldefinedschema"而不需要改变数据库平台。

示例代码:

Python

import pybedquiltbq = pybedquilt.BedquiltClient(dbname='bedquilt_test')projects = bq['projects']projects.add_constraints({    'description': {'$required': 1,                    '$notnull': 1,                    '$type': 'string'},    'tags': {'$required': 1,             '$type': 'array'}})projects.insert({    '_id':   "BedquiltDB",    'description': "A ghastly hack.",    'quality': "pre-alpha",    'tags': ["json", "postgres", "api"]})early_projects = projects.find(    {'quality': 'pre-alpha'})api_projects = projects.find(    {'tags': ['api']})cool_project = projects.find_one_by_id('BedquiltDB')

Node.js

var BedquiltClient = require('bedquilt').BedquiltClient;BedquiltClient.connect('localhost', function(err, client) {  var tools = client.collection('tools');  tools.find({type: 'blunt'}, function(err, results) {    console.log(results);  });});

SQL

select bq_insert(  'orders',  '{"_id": "2001515",    "customerId": "117176",    "items": ["orange_coat", "socks", "plastic_teeth"]}');select bq_find(  'orders',  '{"customerId": "220011",    "items": ["socks"]}');select bq_remove_one(  'orders',  '{"_id": "4401515"}');
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论