go.etcd

command module
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

Go codecov

go.etcd

Usage

export GO111MODULE=on
go get github.com/mchirico/go.etcd
go get github.com/etcd-io/etcd 


Sample Put and Get

package main

import (
	"github.com/mchirico/go.etcd/pkg/etcdutils"
	"log"
	"time"
)

func main() {

	e, cancel := etcdutils.NewETC()
	defer cancel()

	e.DeleteWithPrefix("/testing")

	now := time.Now()

	e.Put("/testing/TestETC_Put ... more", now.String())
	e.PutWithLease("/testing/a", now.String(), 3)

	result, _ := e.GetWithPrefix("/testing/")

	if len(result.Kvs) != 2 {
		log.Printf("Number of keys: %d\n", len(result.Kvs))
	}

	for i, v := range result.Kvs {
		log.Printf("result.Kvs[%d]: %s, ver: %d,  lease: %d\n", i, v.Value, v.Version, v.Lease)
	}
}



Next version:

git tag -fa v0.0.13 -m "Describe what you did"
git push origin v0.0.13 --force


Documentation

Overview

Copyright © 2020 Mike Chirico <mchirico@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
examples
pkg

Jump to

Keyboard shortcuts

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