All Projects → nitishm → Go Rejson

nitishm / Go Rejson

Licence: mit
Golang client for redislabs' ReJSON module with support for multilple redis clients (redigo, go-redis)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Rejson

Redli
Redli - A humane alternative to the Redis-cli and TLS
Stars: ✭ 126 (-23.17%)
Mutual labels:  redis, redis-client
Redis web manager
Manage your Redis instance (see keys, memory used, connected client, etc...)
Stars: ✭ 139 (-15.24%)
Mutual labels:  redis, redis-client
Kangaroo
SQL client and admin tool for popular databases
Stars: ✭ 127 (-22.56%)
Mutual labels:  redis, redis-client
Radish
Desktop client for Redis (Windows, MacOS, Linux)
Stars: ✭ 117 (-28.66%)
Mutual labels:  redis, redis-client
Camellia
camellia framework by netease-im. provider: 1) redis-client; 2) redis-proxy(redis-sentinel/redis-cluster); 3) hbase-client; 4) others
Stars: ✭ 146 (-10.98%)
Mutual labels:  redis, redis-client
Cpp Bredis
Boost::ASIO low-level redis client (connector)
Stars: ✭ 117 (-28.66%)
Mutual labels:  redis, redis-client
Aioredis Py
asyncio (PEP 3156) Redis support
Stars: ✭ 2,003 (+1121.34%)
Mutual labels:  redis, redis-client
Iredis
Interactive Redis: A Terminal Client for Redis with AutoCompletion and Syntax Highlighting.
Stars: ✭ 1,661 (+912.8%)
Mutual labels:  redis, redis-client
Redis
Type-safe Redis client for Golang
Stars: ✭ 13,117 (+7898.17%)
Mutual labels:  redis, redis-client
Bricks
A standard library for microservices.
Stars: ✭ 142 (-13.41%)
Mutual labels:  json, redis
Redisearch Go
Go client for RediSearch
Stars: ✭ 116 (-29.27%)
Mutual labels:  redis, redis-client
Redisearch Py
RediSearch python client
Stars: ✭ 152 (-7.32%)
Mutual labels:  redis, redis-client
Php Redis Client
RedisClient is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0
Stars: ✭ 112 (-31.71%)
Mutual labels:  redis, redis-client
Redis Game Transaction
在大型游戏中经常使用分布式,分布式中因为游戏逻辑会经常游戏事务,借助redis特性我们可以实现分布式锁和分布式事务。很多redis集群不支持redis的事务特性。 这个框架用来解决分布式服务器下redis集群事务失效的情况下,基于分布式锁完成分布式事务。支持独占锁,共享锁,读写锁,并且支持事务提交失败情况下的回滚操作,让开发者可以有更多时间侧重游戏逻辑.
Stars: ✭ 124 (-24.39%)
Mutual labels:  redis, redis-client
Jredisbloom
Java Client for RedisBloom probabilistic module
Stars: ✭ 108 (-34.15%)
Mutual labels:  redis, redis-client
Csredis
.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
Stars: ✭ 1,714 (+945.12%)
Mutual labels:  redis, redis-client
Facil.io
Your high performance web application C framework
Stars: ✭ 1,393 (+749.39%)
Mutual labels:  json, redis-client
Fastapi Plugins
FastAPI framework plugins
Stars: ✭ 104 (-36.59%)
Mutual labels:  json, redis
Redis Client App
A redis client application on mac, windows and linux.
Stars: ✭ 140 (-14.63%)
Mutual labels:  redis, redis-client
Redisdesktopmanager Mac
Redis Desktop Manager Mac OSX DMG
Stars: ✭ 149 (-9.15%)
Mutual labels:  redis, redis-client

Go-ReJSON - a golang client for ReJSON (a JSON data type for Redis)

Go-ReJSON is a Go client for ReJSON Redis Module.

Go Reference test code-analysis codecov Go Report Card GitHub release

ReJSON 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 of ReJSON Module:

* Full support of the JSON standard
* JSONPath-like syntax for selecting element 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

Each and every feature of ReJSON Module is fully incorporated in the project.

Enjoy ReJSON with the type-safe Redis client, Go-Redis/Redis or use the print-like Redis-api client GoModule/Redigo. Go-ReJSON supports both the clients. Use any of the above two client you want, Go-ReJSON helps you out with all its features and functionalities in a more generic and standard way.

Support for mediocregopher/radix and other Redis clients is in our RoadMap. Any contributions on the support for other clients is hearty welcome.

Installation

go get github.com/nitishm/go-rejson

Example usage

package main

import (
	"encoding/json"
	"flag"
	"fmt"
	"log"

	"github.com/nitishm/go-rejson/v4"
	goredis "github.com/go-redis/redis/v8"
	"github.com/gomodule/redigo/redis"
)

// Name - student name
type Name struct {
	First  string `json:"first,omitempty"`
	Middle string `json:"middle,omitempty"`
	Last   string `json:"last,omitempty"`
}

// Student - student object
type Student struct {
	Name Name `json:"name,omitempty"`
	Rank int  `json:"rank,omitempty"`
}

func Example_JSONSet(rh *rejson.Handler) {

	student := Student{
		Name: Name{
			"Mark",
			"S",
			"Pronto",
		},
		Rank: 1,
	}
	res, err := rh.JSONSet("student", ".", student)
	if err != nil {
		log.Fatalf("Failed to JSONSet")
		return
	}

	if res.(string) == "OK" {
		fmt.Printf("Success: %s\n", res)
	} else {
		fmt.Println("Failed to Set: ")
	}

	studentJSON, err := redis.Bytes(rh.JSONGet("student", "."))
	if err != nil {
		log.Fatalf("Failed to JSONGet")
		return
	}

	readStudent := Student{}
	err = json.Unmarshal(studentJSON, &readStudent)
	if err != nil {
		log.Fatalf("Failed to JSON Unmarshal")
		return
	}

	fmt.Printf("Student read from redis : %#v\n", readStudent)
}

func main() {
	var addr = flag.String("Server", "localhost:6379", "Redis server address")

	rh := rejson.NewReJSONHandler()
	flag.Parse()

	// Redigo Client
	conn, err := redis.Dial("tcp", *addr)
	if err != nil {
		log.Fatalf("Failed to connect to redis-server @ %s", *addr)
	}
	defer func() {
		_, err = conn.Do("FLUSHALL")
		err = conn.Close()
		if err != nil {
			log.Fatalf("Failed to communicate to redis-server @ %v", err)
		}
	}()
	rh.SetRedigoClient(conn)
	fmt.Println("Executing Example_JSONSET for Redigo Client")
	Example_JSONSet(rh)

	// GoRedis Client
	cli := goredis.NewClient(&goredis.Options{Addr: *addr})
	defer func() {
		if err := cli.FlushAll().Err(); err != nil {
			log.Fatalf("goredis - failed to flush: %v", err)
		}
		if err := cli.Close(); err != nil {
			log.Fatalf("goredis - failed to communicate to redis-server: %v", err)
		}
	}()
	rh.SetGoRedisClient(cli)
	fmt.Println("\nExecuting Example_JSONSET for Redigo Client")
	Example_JSONSet(rh)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].