diff options
Diffstat (limited to 'vendor/cloud.google.com/go/internal')
-rw-r--r-- | vendor/cloud.google.com/go/internal/optional/optional.go | 14 | ||||
-rw-r--r-- | vendor/cloud.google.com/go/internal/version/version.go | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/vendor/cloud.google.com/go/internal/optional/optional.go b/vendor/cloud.google.com/go/internal/optional/optional.go index f9102f3..4c15410 100644 --- a/vendor/cloud.google.com/go/internal/optional/optional.go +++ b/vendor/cloud.google.com/go/internal/optional/optional.go @@ -20,6 +20,7 @@ package optional import ( "fmt" "strings" + "time" ) type ( @@ -37,6 +38,9 @@ type ( // Float64 is either a float64 or nil. Float64 interface{} + + // Duration is either a time.Duration or nil. + Duration interface{} ) // ToBool returns its argument as a bool. @@ -89,6 +93,16 @@ func ToFloat64(v Float64) float64 { return x } +// ToDuration returns its argument as a time.Duration. +// It panics if its argument is nil or not a time.Duration. +func ToDuration(v Duration) time.Duration { + x, ok := v.(time.Duration) + if !ok { + doPanic("Duration", v) + } + return x +} + func doPanic(capType string, v interface{}) { panic(fmt.Sprintf("optional.%s value should be %s, got %T", capType, strings.ToLower(capType), v)) } diff --git a/vendor/cloud.google.com/go/internal/version/version.go b/vendor/cloud.google.com/go/internal/version/version.go index 33f1cdb..513afa4 100644 --- a/vendor/cloud.google.com/go/internal/version/version.go +++ b/vendor/cloud.google.com/go/internal/version/version.go @@ -26,7 +26,7 @@ import ( // Repo is the current version of the client libraries in this // repo. It should be a date in YYYYMMDD format. -const Repo = "20170404" +const Repo = "20170928" // Go returns the Go runtime version. The returned string // has no whitespace. |