Skip to content

qclaogui/kvdb

Repository files navigation

kvDB

License

key value DB

Usage

Run in Playground

package main

import (
	"fmt"
	"log"

	"github.com/qclaogui/kvdb"
)

func main() {
	m := kvdb.NewMem()
	m.Put("/app/redis/username", "qclaogui")
	m.Put("/app/redis/password", "123456789")
	m.Put("/app/port", "80")
	v, err := m.Get("/app/redis/username")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Get \t\tValue: %s\n\n", v)

	if ks, err := m.GetMany("/app/*/*"); err == nil {
		for _, v := range ks {
			fmt.Printf("GetMany \tValue: %s\n", v)
		}
	}
}
// Output:
// Get 		Value: qclaogui

// GetMany 	Value: 123456789
// GetMany 	Value: qclaogui