Skip to content

essentialkaos/redy

Repository files navigation

Codebeat badge GitHub Actions CI Status GitHub Actions CodeQL Status Coverage Status

Usage exampleCI StatusLicense


redy is a tiny Redis client based on radix.v2 code base.

Usage example

package main

import (
  "fmt"
  "time"

  "github.com/essentialkaos/redy/v4"
)

func main() {
  rc := redy.Client{
    Network:     "tcp",
    Addr:        "127.0.0.1:6379",
    DialTimeout: 15 * time.Second,
  }

  err := rc.Connect()

  if err != nil {
    fmt.Printf("Connection error: %v\n", err)
    return
  }

  r := rc.Cmd("SET", "ABC", 1)

  if r.Err != nil {
    fmt.Printf("Command error: %v\n", r.Err)
    return
  }

  r = rc.Cmd("GET", "ABC")

  if r.Err != nil {
    fmt.Printf("Command error: %v\n", r.Err)
    return
  }

  val, err := r.Int()

  if err != nil {
    fmt.Printf("Parsing error: %v\n", err)
    return
  }

  fmt.Printf("ABC -> %d\n", val)
}

CI Status

Branch Status
master CI
develop CI

License

MIT