kvdb

package module
v0.0.0-...-8eba0c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package kvdb is go client library for dealing with Ankr KMS service. it includes a high-level API for easy store static secret information

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV

type KV struct {
	// contains filtered or unexported fields
}

func (*KV) Get

func (k *KV) Get(path string) (map[string]interface{}, error)
Example
package main

import (
	"github.com/Ankr-network/go-kms/kvdb"
)

func main() {
	kvc, err := kvdb.NewKVer("127.0.0.1", "ankr-user")
	if err != nil {
		// handle error
		return
	}

	rsp, err := kvc.Get("/")
	if err != nil {
		// handle error
		return
	}
	// handle response here
	_ = rsp
}

func (*KV) Put

func (k *KV) Put(path string, value map[string]string) error
Example
package main

import (
	"github.com/Ankr-network/go-kms/kvdb"
)

func main() {
	kvc, err := kvdb.NewKVer("127.0.0.1", "ankr-user")
	if err != nil {
		// handle error
		return
	}
	if err = kvc.Put("test", map[string]string{"hello": "world"}); err != nil {
		// handle error
		return
	}
}

type KVer

type KVer interface {
	// take secrets by specify path
	Get(path string) (map[string]interface{}, error)
	// put secrets by specify path
	Put(path string, value map[string]string) error
}

kvdb api constraint: we store anything, the data must format map, thank you know. we thought to replace map structure with []byte structure, but for extensions, we think the map is well,the map is a stable structure. think about some scenario of only take part of the secrets, we can easy handle with it.

func NewKVer

func NewKVer(kmsAddr, appRole string) (KVer, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL