浏览代码

client: change to 'NoValueOnSuccess'

Gyu-Ho Lee 9 年之前
父节点
当前提交
fb39e96862
共有 3 个文件被更改,包括 21 次插入20 次删除
  1. 2 1
      client/keys.generated.go
  2. 15 15
      client/keys.go
  3. 4 4
      client/keys_test.go

+ 2 - 1
client/keys.generated.go

@@ -8,10 +8,11 @@ package client
 import (
 import (
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
-	codec1978 "github.com/ugorji/go/codec"
 	"reflect"
 	"reflect"
 	"runtime"
 	"runtime"
 	time "time"
 	time "time"
+
+	codec1978 "github.com/ugorji/go/codec"
 )
 )
 
 
 const (
 const (

+ 15 - 15
client/keys.go

@@ -192,9 +192,9 @@ type SetOptions struct {
 	// Dir specifies whether or not this Node should be created as a directory.
 	// Dir specifies whether or not this Node should be created as a directory.
 	Dir bool
 	Dir bool
 
 
-	// NoDataOnSuccess specifies whether the response contains the current value of the Node.
+	// NoValueOnSuccess specifies whether the response contains the current value of the Node.
 	// If set, the response will only contain the current value when the request fails.
 	// If set, the response will only contain the current value when the request fails.
-	NoDataOnSuccess bool
+	NoValueOnSuccess bool
 }
 }
 
 
 type GetOptions struct {
 type GetOptions struct {
@@ -339,7 +339,7 @@ func (k *httpKeysAPI) Set(ctx context.Context, key, val string, opts *SetOptions
 		act.TTL = opts.TTL
 		act.TTL = opts.TTL
 		act.Refresh = opts.Refresh
 		act.Refresh = opts.Refresh
 		act.Dir = opts.Dir
 		act.Dir = opts.Dir
-		act.NoDataOnSuccess = opts.NoDataOnSuccess
+		act.NoValueOnSuccess = opts.NoValueOnSuccess
 	}
 	}
 
 
 	doCtx := ctx
 	doCtx := ctx
@@ -528,16 +528,16 @@ func (w *waitAction) HTTPRequest(ep url.URL) *http.Request {
 }
 }
 
 
 type setAction struct {
 type setAction struct {
-	Prefix          string
-	Key             string
-	Value           string
-	PrevValue       string
-	PrevIndex       uint64
-	PrevExist       PrevExistType
-	TTL             time.Duration
-	Refresh         bool
-	Dir             bool
-	NoDataOnSuccess bool
+	Prefix           string
+	Key              string
+	Value            string
+	PrevValue        string
+	PrevIndex        uint64
+	PrevExist        PrevExistType
+	TTL              time.Duration
+	Refresh          bool
+	Dir              bool
+	NoValueOnSuccess bool
 }
 }
 
 
 func (a *setAction) HTTPRequest(ep url.URL) *http.Request {
 func (a *setAction) HTTPRequest(ep url.URL) *http.Request {
@@ -571,8 +571,8 @@ func (a *setAction) HTTPRequest(ep url.URL) *http.Request {
 	if a.Refresh {
 	if a.Refresh {
 		form.Add("refresh", "true")
 		form.Add("refresh", "true")
 	}
 	}
-	if a.NoDataOnSuccess {
-		params.Set("noDataOnSuccess", strconv.FormatBool(a.NoDataOnSuccess))
+	if a.NoValueOnSuccess {
+		params.Set("noValueOnSuccess", strconv.FormatBool(a.NoValueOnSuccess))
 	}
 	}
 
 
 	u.RawQuery = params.Encode()
 	u.RawQuery = params.Encode()

+ 4 - 4
client/keys_test.go

@@ -407,13 +407,13 @@ func TestSetAction(t *testing.T) {
 			wantURL:  "http://example.com/foo?dir=true",
 			wantURL:  "http://example.com/foo?dir=true",
 			wantBody: "",
 			wantBody: "",
 		},
 		},
-		// DataOnFailure is set
+		// NoValueOnSuccess is set
 		{
 		{
 			act: setAction{
 			act: setAction{
-				Key:             "foo",
-				NoDataOnSuccess: true,
+				Key:              "foo",
+				NoValueOnSuccess: true,
 			},
 			},
-			wantURL:  "http://example.com/foo?noDataOnSuccess=true",
+			wantURL:  "http://example.com/foo?noValueOnSuccess=true",
 			wantBody: "value=",
 			wantBody: "value=",
 		},
 		},
 	}
 	}