doc.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2017 The etcd Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Package v3client provides clientv3 interfaces from an etcdserver.
  15. //
  16. // Use v3client by creating an EtcdServer instance, then wrapping it with v3client.New:
  17. //
  18. // import (
  19. // "context"
  20. //
  21. // "github.com/coreos/etcd/embed"
  22. // "github.com/coreos/etcd/etcdserver/api/v3client"
  23. // )
  24. //
  25. // ...
  26. //
  27. // // create an embedded EtcdServer from the default configuration
  28. // cfg := embed.NewConfig()
  29. // cfg.Dir = "default.etcd"
  30. // e, err := embed.StartEtcd(cfg)
  31. // if err != nil {
  32. // // handle error!
  33. // }
  34. //
  35. // // wrap the EtcdServer with v3client
  36. // cli := v3client.New(e.Server)
  37. //
  38. // // use like an ordinary clientv3
  39. // resp, err := cli.Put(context.TODO(), "some-key", "it works!")
  40. // if err != nil {
  41. // // handle error!
  42. // }
  43. //
  44. package v3client