Coder Social home page Coder Social logo

nthon / redisjson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redisjson/redisjson

0.0 1.0 0.0 3.56 MB

RedisJSON - a JSON data type for Redis

Home Page: https://redisjson.io

License: Other

Shell 5.31% Makefile 2.19% Python 38.24% Lua 2.13% Dockerfile 0.54% Rust 51.59%

redisjson's Introduction

GitHub issues CircleCI macos Docker Cloud Build Status Total alerts Forum Discord

RedisJSON

RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating and fetching JSON values from Redis keys (documents).

Primary features:

  • Full support of the JSON standard
  • JSONPath syntax for selecting elements inside documents
  • Documents are stored as binary data in a tree structure, allowing fast access to sub-elements
  • Typed atomic operations for all JSON values types
  • Secondary index support based on RediSearch

Quick start

docker run -p 6379:6379 --name redis-redisjson redislabs/rejson:latest

Documentation

Read the docs at http://redisjson.io

New Commands in RedisJSON

JSON.INDEX ADD <index> <field> <path>
JSON.INDEX DEL <index>
JSON.QGET <index> <query> <path>

Next Milestone

JSON.QSET <index> <query> <path> <json> [NX | XX]
JSON.QDEL <index> <query> <path>

JSON.INDEX DEL <index> <field>
JSON.INDEX INFO <index> <field>

Return value from JSON.QGET is an array of keys and values:

key
json
key
json

In a language such as Java this could be represented as a Map<String, Document>.

Examples

A query combining multiple paths:

JSON.QGET mytype "@path1:hello @path2:world" d.name
127.0.0.1:6379> json.set user1 $ '{"last":"Joe", "first":"Mc"}' INDEX person
OK
127.0.0.1:6379> json.set user2 $ '{"last":"Joan", "first":"Mc"}' INDEX person
OK
127.0.0.1:6379> json.index add person last $.last
OK
127.0.0.1:6379> JSON.QGET person Jo*
"{\"user2\":[{\"last\":\"Joan\",\"first\":\"Mc\"}],\"user1\":[{\"last\":\"Joe\",\"first\":\"Mc\"}]}"
127.0.0.1:6379> json.set user3 $ '{"last":"Joel", "first":"Dan"}' INDEX person
OK
127.0.0.1:6379> JSON.QGET person Jo*
"{\"user2\":[{\"last\":\"Joan\",\"first\":\"Mc\"}],\"user1\":[{\"last\":\"Joe\",\"first\":\"Mc\"}],\"user3\":[{\"last\":\"Joel\",\"first\":\"Dan\"}]}"
127.0.0.1:6379> json.index add person first $.first
OK
127.0.0.1:6379> JSON.QGET person Mc
"{\"user2\":[{\"last\":\"Joan\",\"first\":\"Mc\"}],\"user1\":[{\"last\":\"Joe\",\"first\":\"Mc\"}]}"
127.0.0.1:6379> JSON.QGET person Mc $.last
"{\"user2\":[\"Joan\"],\"user1\":[\"Joe\"]}"
127.0.0.1:6379> JSON.QGET person "@last:Jo* @first:Mc" $.last
"{\"user2\":[\"Joan\"],\"user1\":[\"Joe\"]}"

Build

Make sure you have Rust installed: https://www.rust-lang.org/tools/install

Then, build as usual:

cargo build --release

Run

Linux

redis-server --loadmodule ./target/release/librejson.so

Mac OS

redis-server --loadmodule ./target/release/librejson.dylib

Client libraries

Some languages have client libraries that provide support for RedisJSON's commands:

Project Language License Author Stars Package
iorejson Node.js MIT Evan Huang @evanhuang8 iorejson-stars npm
node_redis-rejson Node.js MIT Kyle Davis @stockholmux node_redis-rejson-stars npm
redis-modules-sdk Node.js BSD-3-Clause Dani Tseitlin @danitseitlin redis-modules-sdk-stars npm
JRedisJSON Java BSD-2-Clause Redis Labs JRedisJSON-stars maven
redisjson-py Python BSD-2-Clause Redis Labs rejson-py-stars pypi
go-rejson Go MIT Nitish Malhotra @nitishm go-rejson-stars
rejonson Go Apache-2.0 Daniel Krom @KromDaniel rejonson-stars
NReJSON .NET MIT/Apache-2.0 Tommy Hanks @tombatron NReJSON-stars nuget
phpredis-json PHP MIT Rafa Campoy @averias phpredis-json-stars composer
redislabs-rejson PHP MIT Mehmet Korkmaz @mkorkmaz redislabs-rejson-stars composer
rejson-rb Ruby MIT Pavan Vachhani @vachhanihpavan rejson-rb-stars rubygems

Acknowledgements

RedisJSON is developed with <3 at Redis Labs.

RedisJSON is made possible only because of the existance of this amazing open source project:

License

Redis Source Available License Agreement - see LICENSE

redisjson's People

Contributors

gkorland avatar itamarhaber avatar dvirsky avatar gavrie avatar mnunberg avatar mbusath avatar yoav-steinberg avatar yusaku avatar swilly22 avatar rafie avatar k-jo avatar leibale avatar evanhuang8 avatar srinkoth avatar emmanuelkeller avatar kromdaniel avatar datokenizer avatar wseng avatar vadimkulagin avatar tombatron avatar simonprickett avatar vachhanihpavan avatar omribahumi avatar nitishm avatar mostueve avatar stockholmux avatar emmanuel-keller avatar dextersjab avatar danni-m avatar danitseitlin avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.