跳转到主要内容

JSONStore是一个通过HTTP暴露的轻量级数据库,用于JSON文档。

项目描述

一个无模式的JSON文档数据库,通过REST API暴露,并使用灵活的匹配算法实现搜索。

快速入门

$ pip install jsonstore
$ jsonstore
 * Running on http://127.0.0.1:31415/

创建文档

$ curl -v http://127.0.0.1:31415/ -d '{"foo":"bar","baz":{"count":42}}'
< HTTP/1.0 201 Created
< Location: http://127.0.0.1:31415/72dcf1ee-8efd-4d7f-8ca1-2eda2bf85099
< etag: "348f16ee0c0856d853117bde8413a4270d1d3487"
{
    "foo": "bar",
    "baz": {
        "count": 42
    },
    "__id__": "72dcf1ee-8efd-4d7f-8ca1-2eda2bf85099",
    "__updated__": "2012-05-09T20:33:36.928075+00:00"
}

搜索存储

$ curl -g 'http://127.0.0.1:31415/{"baz":{"count":"GreaterThan(40)"}}'
[
    {
        "foo": "bar",
        "baz": {
            "count": 42
        },
        "__id__": "72dcf1ee-8efd-4d7f-8ca1-2eda2bf85099",
        "__updated__": "2012-05-09T20:33:36.928075+00:00"
    }
]

它还提供了一个Python API。上述代码可以这样实现

>>> from jsonstore.client import EntryManager
>>> from jsonstore.operators import GreaterThan

>>> em = EntryManager('http://127.0.0.1:31415/')
>>> em.create(foo="bar", "baz"={"count": 42})
>>> results = em.search(baz={"count": GreaterThan(40)})

或者这样,仅供娱乐

>>> from jsonstore.dsl import Store

>>> store = Store('http://127.0.0.1:31415/')
>>> { "foo": "bar", "baz": { "count": 42 } } >> store
>>> results = store | { "baz": { "count": GreaterThan(40) } }

请访问网站以获取更多示例http://code.dealmeida.net/jsonstore

项目详情


下载文件

下载您平台所需的文件。如果您不确定选择哪一个,请了解更多关于 安装包的信息

源代码发行版

jsonstore-1.3.1.tar.gz (13.4 kB 查看哈希值)

上传时间 源代码

构建发行版

jsonstore-1.3.1-py2.7.egg (35.7 kB 查看哈希值)

上传时间 源代码

由以下支持