doc.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2016 CoreOS, Inc.
  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. // clientv3 is the official Go etcd client for v3.
  15. //
  16. // Create client using `clientv3.New`:
  17. //
  18. // cli, err := clientv3.New(clientv3.Config{
  19. // Endpoints: []string{"localhost:12378", "localhost:22378", "localhost:32378"},
  20. // DialTimeout: 5 * time.Second,
  21. // })
  22. // if err != nil {
  23. // // handle error!
  24. // }
  25. // defer cli.Close()
  26. //
  27. // Make sure to close the client after using it. If the client is not closed, the
  28. // connection will have leaky goroutines.
  29. //
  30. // To specify client request timeout, pass context.WithTimeout to APIs:
  31. //
  32. // ctx, cancel := context.WithTimeout(context.Background(), timeout)
  33. // resp, err := kvc.Put(ctx, "sample_key", "sample_value")
  34. // cancel()
  35. // if err != nil {
  36. // // handle error!
  37. // }
  38. // // use the response
  39. //
  40. // TODO: document error handling
  41. //
  42. package clientv3