/upstash-go

Primary LanguageGoMIT LicenseMIT

Upstash Redis Go

An HTTP/REST based Redis client built on top of Upstash REST API.

Inspired by The official typescript client

See the list of APIs supported.

codecov

Quick Start

Error handling has been omitted for better readability.

package main

import (
	"fmt"
	"github.com/chronark/upstash-go"
)

func main() {
    // Get your url and token from https://console.upstash.com/redis/{id}
    // Or leave empty to load from environment variables
    options := upstash.Options{
        Url: "", // env: UPSTASH_REDIS_REST_URL
        Token:    "", // env: UPSTASH_REDIS_REST_TOKEN
    }

    u, _ := upstash.New(options)

    u.Set("foo", "bar")

    value, _ := u.Get("foo")

    fmt.Println(value)
    // -> "bar"

}