+
# Redis client for Golang
-[![Build Status](https://travis-ci.org/go-redis/redis.png?branch=master)](https://travis-ci.org/go-redis/redis)
+![build workflow](https://github.com/go-redis/redis/actions/workflows/build.yml/badge.svg)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/go-redis/redis/v8)](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc)
[![Documentation](https://img.shields.io/badge/redis-documentation-informational)](https://redis.uptrace.dev/)
[![Chat](https://discordapp.com/api/guilds/752070105847955518/widget.png)](https://discord.gg/rWtp5Aj)
-> :heart: [**Uptrace.dev** - distributed traces, logs, and errors in one place](https://uptrace.dev)
-
- Join [Discord](https://discord.gg/rWtp5Aj) to ask questions.
- [Documentation](https://redis.uptrace.dev)
- [Reference](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc)
@@ -129,10 +133,13 @@ vals, err := rdb.Eval(ctx, "return {KEYS[1],ARGV[1]}", []string{"key"}, "hello")
// custom command
res, err := rdb.Do(ctx, "set", "key", "value").Result()
```
+
## Run the test
-go-redis will start a redis-server and run the test cases.
+
+go-redis will start a redis-server and run the test cases.
The paths of redis-server bin file and redis config file are definded in `main_test.go`:
+
```
var (
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
@@ -140,13 +147,16 @@ var (
)
```
-For local testing, you can change the variables to refer to your local files, or create a soft link to the corresponding folder for redis-server and copy the config file to `testdata/redis/`:
+For local testing, you can change the variables to refer to your local files, or create a soft link
+to the corresponding folder for redis-server and copy the config file to `testdata/redis/`:
+
```
ln -s /usr/bin/redis-server ./go-redis/testdata/redis/src
cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/
```
Lastly, run:
+
```
go test
```
diff --git a/vendor/github.com/go-redis/redis/v8/cluster.go b/vendor/github.com/go-redis/redis/v8/cluster.go
index 2ce475c41..e5d49ddee 100644
--- a/vendor/github.com/go-redis/redis/v8/cluster.go
+++ b/vendor/github.com/go-redis/redis/v8/cluster.go
@@ -295,8 +295,9 @@ func (c *clusterNodes) Close() error {
func (c *clusterNodes) Addrs() ([]string, error) {
var addrs []string
+
c.mu.RLock()
- closed := c.closed
+ closed := c.closed //nolint:ifshort
if !closed {
if len(c.activeAddrs) > 0 {
addrs = c.activeAddrs
@@ -632,14 +633,14 @@ func (c *clusterStateHolder) Reload(ctx context.Context) (*clusterState, error)
return state, nil
}
-func (c *clusterStateHolder) LazyReload(ctx context.Context) {
+func (c *clusterStateHolder) LazyReload() {
if !atomic.CompareAndSwapUint32(&c.reloading, 0, 1) {
return
}
go func() {
defer atomic.StoreUint32(&c.reloading, 0)
- _, err := c.Reload(ctx)
+ _, err := c.Reload(context.Background())
if err != nil {
return
}
@@ -649,14 +650,15 @@ func (c *clusterStateHolder) LazyReload(ctx context.Context) {
func (c *clusterStateHolder) Get(ctx context.Context) (*clusterState, error) {
v := c.state.Load()
- if v != nil {
- state := v.(*clusterState)
- if time.Since(state.createdAt) > 10*time.Second {
- c.LazyReload(ctx)
- }
- return state, nil
+ if v == nil {
+ return c.Reload(ctx)
}
- return c.Reload(ctx)
+
+ state := v.(*clusterState)
+ if time.Since(state.createdAt) > 10*time.Second {
+ c.LazyReload()
+ }
+ return state, nil
}
func (c *clusterStateHolder) ReloadOrGet(ctx context.Context) (*clusterState, error) {
@@ -732,7 +734,7 @@ func (c *ClusterClient) Options() *ClusterOptions {
// ReloadState reloads cluster state. If available it calls ClusterSlots func
// to get cluster slots information.
func (c *ClusterClient) ReloadState(ctx context.Context) {
- c.state.LazyReload(ctx)
+ c.state.LazyReload()
}
// Close closes the cluster client, releasing any open resources.
@@ -793,7 +795,7 @@ func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error {
}
if isReadOnly := isReadOnlyError(lastErr); isReadOnly || lastErr == pool.ErrClosed {
if isReadOnly {
- c.state.LazyReload(ctx)
+ c.state.LazyReload()
}
node = nil
continue
@@ -1228,7 +1230,7 @@ func (c *ClusterClient) checkMovedErr(
}
if moved {
- c.state.LazyReload(ctx)
+ c.state.LazyReload()
failedCmds.Add(node, cmd)
return true
}
@@ -1414,7 +1416,7 @@ func (c *ClusterClient) cmdsMoved(
}
if moved {
- c.state.LazyReload(ctx)
+ c.state.LazyReload()
for _, cmd := range cmds {
failedCmds.Add(node, cmd)
}
@@ -1472,7 +1474,7 @@ func (c *ClusterClient) Watch(ctx context.Context, fn func(*Tx) error, keys ...s
if isReadOnly := isReadOnlyError(err); isReadOnly || err == pool.ErrClosed {
if isReadOnly {
- c.state.LazyReload(ctx)
+ c.state.LazyReload()
}
node, err = c.slotMasterNode(ctx, slot)
if err != nil {
diff --git a/vendor/github.com/go-redis/redis/v8/command.go b/vendor/github.com/go-redis/redis/v8/command.go
index 6ca06344b..f10c4781a 100644
--- a/vendor/github.com/go-redis/redis/v8/command.go
+++ b/vendor/github.com/go-redis/redis/v8/command.go
@@ -710,6 +710,13 @@ func (cmd *StringCmd) Bytes() ([]byte, error) {
return util.StringToBytes(cmd.val), cmd.err
}
+func (cmd *StringCmd) Bool() (bool, error) {
+ if cmd.err != nil {
+ return false, cmd.err
+ }
+ return strconv.ParseBool(cmd.val)
+}
+
func (cmd *StringCmd) Int() (int, error) {
if cmd.err != nil {
return 0, cmd.err
@@ -810,6 +817,55 @@ func (cmd *FloatCmd) readReply(rd *proto.Reader) (err error) {
//------------------------------------------------------------------------------
+type FloatSliceCmd struct {
+ baseCmd
+
+ val []float64
+}
+
+var _ Cmder = (*FloatSliceCmd)(nil)
+
+func NewFloatSliceCmd(ctx context.Context, args ...interface{}) *FloatSliceCmd {
+ return &FloatSliceCmd{
+ baseCmd: baseCmd{
+ ctx: ctx,
+ args: args,
+ },
+ }
+}
+
+func (cmd *FloatSliceCmd) Val() []float64 {
+ return cmd.val
+}
+
+func (cmd *FloatSliceCmd) Result() ([]float64, error) {
+ return cmd.val, cmd.err
+}
+
+func (cmd *FloatSliceCmd) String() string {
+ return cmdString(cmd, cmd.val)
+}
+
+func (cmd *FloatSliceCmd) readReply(rd *proto.Reader) error {
+ _, err := rd.ReadArrayReply(func(rd *proto.Reader, n int64) (interface{}, error) {
+ cmd.val = make([]float64, n)
+ for i := 0; i < len(cmd.val); i++ {
+ switch num, err := rd.ReadFloatReply(); {
+ case err == Nil:
+ cmd.val[i] = 0
+ case err != nil:
+ return nil, err
+ default:
+ cmd.val[i] = num
+ }
+ }
+ return nil, nil
+ })
+ return err
+}
+
+//------------------------------------------------------------------------------
+
type StringSliceCmd struct {
baseCmd
diff --git a/vendor/github.com/go-redis/redis/v8/commands.go b/vendor/github.com/go-redis/redis/v8/commands.go
index 60f06842f..37746334d 100644
--- a/vendor/github.com/go-redis/redis/v8/commands.go
+++ b/vendor/github.com/go-redis/redis/v8/commands.go
@@ -67,6 +67,11 @@ func appendArg(dst []interface{}, arg interface{}) []interface{} {
dst = append(dst, k, v)
}
return dst
+ case map[string]string:
+ for k, v := range arg {
+ dst = append(dst, k, v)
+ }
+ return dst
default:
return append(dst, arg)
}
@@ -117,6 +122,8 @@ type Cmdable interface {
Get(ctx context.Context, key string) *StringCmd
GetRange(ctx context.Context, key string, start, end int64) *StringCmd
GetSet(ctx context.Context, key string, value interface{}) *StringCmd
+ GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd
+ GetDel(ctx context.Context, key string) *StringCmd
Incr(ctx context.Context, key string) *IntCmd
IncrBy(ctx context.Context, key string, value int64) *IntCmd
IncrByFloat(ctx context.Context, key string, value float64) *FloatCmd
@@ -124,6 +131,8 @@ type Cmdable interface {
MSet(ctx context.Context, values ...interface{}) *StatusCmd
MSetNX(ctx context.Context, values ...interface{}) *BoolCmd
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
+ SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd
+ // TODO: rename to SetEx
SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
@@ -159,6 +168,7 @@ type Cmdable interface {
HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd
HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd
HVals(ctx context.Context, key string) *StringSliceCmd
+ HRandField(ctx context.Context, key string, count int, withValues bool) *StringSliceCmd
BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd
BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd
@@ -181,6 +191,7 @@ type Cmdable interface {
RPopLPush(ctx context.Context, source, destination string) *StringCmd
RPush(ctx context.Context, key string, values ...interface{}) *IntCmd
RPushX(ctx context.Context, key string, values ...interface{}) *IntCmd
+ LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd
SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd
SCard(ctx context.Context, key string) *IntCmd
@@ -224,6 +235,7 @@ type Cmdable interface {
XTrimApprox(ctx context.Context, key string, maxLen int64) *IntCmd
XInfoGroups(ctx context.Context, key string) *XInfoGroupsCmd
XInfoStream(ctx context.Context, key string) *XInfoStreamCmd
+ XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd
BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd
@@ -241,6 +253,7 @@ type Cmdable interface {
ZLexCount(ctx context.Context, key, min, max string) *IntCmd
ZIncrBy(ctx context.Context, key string, increment float64, member string) *FloatCmd
ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd
+ ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd
ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd
ZPopMin(ctx context.Context, key string, count ...int64) *ZSliceCmd
ZRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd
@@ -261,6 +274,7 @@ type Cmdable interface {
ZRevRank(ctx context.Context, key, member string) *IntCmd
ZScore(ctx context.Context, key, member string) *FloatCmd
ZUnionStore(ctx context.Context, dest string, store *ZStore) *IntCmd
+ ZRandMember(ctx context.Context, key string, count int, withScores bool) *StringSliceCmd
PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd
PFCount(ctx context.Context, keys ...string) *IntCmd
@@ -708,6 +722,33 @@ func (c cmdable) GetSet(ctx context.Context, key string, value interface{}) *Str
return cmd
}
+// An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).
+// Requires Redis >= 6.2.0.
+func (c cmdable) GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd {
+ args := make([]interface{}, 0, 4)
+ args = append(args, "getex", key)
+ if expiration > 0 {
+ if usePrecise(expiration) {
+ args = append(args, "px", formatMs(ctx, expiration))
+ } else {
+ args = append(args, "ex", formatSec(ctx, expiration))
+ }
+ } else if expiration == 0 {
+ args = append(args, "persist")
+ }
+
+ cmd := NewStringCmd(ctx, args...)
+ _ = c(ctx, cmd)
+ return cmd
+}
+
+// redis-server version >= 6.2.0.
+func (c cmdable) GetDel(ctx context.Context, key string) *StringCmd {
+ cmd := NewStringCmd(ctx, "getdel", key)
+ _ = c(ctx, cmd)
+ return cmd
+}
+
func (c cmdable) Incr(ctx context.Context, key string) *IntCmd {
cmd := NewIntCmd(ctx, "incr", key)
_ = c(ctx, cmd)
@@ -1180,6 +1221,21 @@ func (c cmdable) HVals(ctx context.Context, key string) *StringSliceCmd {
return cmd
}
+// redis-server version >= 6.2.0.
+func (c cmdable) HRandField(ctx context.Context, key string, count int, withValues bool) *StringSliceCmd {
+ args := make([]interface{}, 0, 4)
+
+ // Although count=0 is meaningless, redis accepts count=0.
+ args = append(args, "hrandfield", key, count)
+ if withValues {
+ args = append(args, "withvalues")
+ }
+
+ cmd := NewStringSliceCmd(ctx, args...)
+ _ = c(ctx, cmd)
+ return cmd
+}
+
//------------------------------------------------------------------------------
func (c cmdable) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd {
@@ -1376,6 +1432,12 @@ func (c cmdable) RPushX(ctx context.Context, key string, values ...interface{})
return cmd
}
+func (c cmdable) LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd {
+ cmd := NewStringCmd(ctx, "lmove", source, destination, srcpos, destpos)
+ _ = c(ctx, cmd)
+ return cmd
+}
+
//------------------------------------------------------------------------------
func (c cmdable) SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd {
@@ -1987,12 +2049,10 @@ func (c cmdable) ZIncrBy(ctx context.Context, key string, increment float64, mem
}
func (c cmdable) ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd {
- args := make([]interface{}, 3+len(store.Keys))
- args[0] = "zinterstore"
- args[1] = destination
- args[2] = len(store.Keys)
- for i, key := range store.Keys {
- args[3+i] = key
+ args := make([]interface{}, 0, 3+len(store.Keys))
+ args = append(args, "zinterstore", destination, len(store.Keys))
+ for _, key := range store.Keys {
+ args = append(args, key)
}
if len(store.Weights) > 0 {
args = append(args, "weights")
@@ -2009,6 +2069,18 @@ func (c cmdable) ZInterStore(ctx context.Context, destination string, store *ZSt
return cmd
}
+func (c cmdable) ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd {
+ args := make([]interface{}, 2+len(members))
+ args[0] = "zmscore"
+ args[1] = key
+ for i, member := range members {
+ args[2+i] = member
+ }
+ cmd := NewFloatSliceCmd(ctx, args...)
+ _ = c(ctx, cmd)
+ return cmd
+}
+
func (c cmdable) ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd {
args := []interface{}{
"zpopmax",
@@ -2223,12 +2295,10 @@ func (c cmdable) ZScore(ctx context.Context, key, member string) *FloatCmd {
}
func (c cmdable) ZUnionStore(ctx context.Context, dest string, store *ZStore) *IntCmd {
- args := make([]interface{}, 3+len(store.Keys))
- args[0] = "zunionstore"
- args[1] = dest
- args[2] = len(store.Keys)
- for i, key := range store.Keys {
- args[3+i] = key
+ args := make([]interface{}, 0, 3+len(store.Keys))
+ args = append(args, "zunionstore", dest, len(store.Keys))
+ for _, key := range store.Keys {
+ args = append(args, key)
}
if len(store.Weights) > 0 {
args = append(args, "weights")
@@ -2246,6 +2316,21 @@ func (c cmdable) ZUnionStore(ctx context.Context, dest string, store *ZStore) *I
return cmd
}
+// redis-server version >= 6.2.0.
+func (c cmdable) ZRandMember(ctx context.Context, key string, count int, withScores bool) *StringSliceCmd {
+ args := make([]interface{}, 0, 4)
+
+ // Although count=0 is meaningless, redis accepts count=0.
+ args = append(args, "zrandmember", key, count)
+ if withScores {
+ args = append(args, "withscores")
+ }
+
+ cmd := NewStringSliceCmd(ctx, args...)
+ _ = c(ctx, cmd)
+ return cmd
+}
+
//------------------------------------------------------------------------------
func (c cmdable) PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd {
diff --git a/vendor/github.com/go-redis/redis/v8/go.mod b/vendor/github.com/go-redis/redis/v8/go.mod
index 29182d266..938768f2b 100644
--- a/vendor/github.com/go-redis/redis/v8/go.mod
+++ b/vendor/github.com/go-redis/redis/v8/go.mod
@@ -7,7 +7,7 @@ require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
- go.opentelemetry.io/otel v0.17.0
- go.opentelemetry.io/otel/metric v0.17.0
- go.opentelemetry.io/otel/trace v0.17.0
+ go.opentelemetry.io/otel v0.19.0
+ go.opentelemetry.io/otel/metric v0.19.0
+ go.opentelemetry.io/otel/trace v0.19.0
)
diff --git a/vendor/github.com/go-redis/redis/v8/go.sum b/vendor/github.com/go-redis/redis/v8/go.sum
index 9532f045a..182608edc 100644
--- a/vendor/github.com/go-redis/redis/v8/go.sum
+++ b/vendor/github.com/go-redis/redis/v8/go.sum
@@ -18,8 +18,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
-github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
@@ -37,14 +37,14 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-go.opentelemetry.io/otel v0.17.0 h1:6MKOu8WY4hmfpQ4oQn34u6rYhnf2sWf1LXYO/UFm71U=
-go.opentelemetry.io/otel v0.17.0/go.mod h1:Oqtdxmf7UtEvL037ohlgnaYa1h7GtMh0NcSd9eqkC9s=
-go.opentelemetry.io/otel/metric v0.17.0 h1:t+5EioN8YFXQ2EH+1j6FHCKMUj+57zIDSnSGr/mWuug=
-go.opentelemetry.io/otel/metric v0.17.0/go.mod h1:hUz9lH1rNXyEwWAhIWCMFWKhYtpASgSnObJFnU26dJ0=
-go.opentelemetry.io/otel/oteltest v0.17.0 h1:TyAihUowTDLqb4+m5ePAsR71xPJaTBJl4KDArIdi9k4=
-go.opentelemetry.io/otel/oteltest v0.17.0/go.mod h1:JT/LGFxPwpN+nlsTiinSYjdIx3hZIGqHCpChcIZmdoE=
-go.opentelemetry.io/otel/trace v0.17.0 h1:SBOj64/GAOyWzs5F680yW1ITIfJkm6cJWL2YAvuL9xY=
-go.opentelemetry.io/otel/trace v0.17.0/go.mod h1:bIujpqg6ZL6xUTubIUgziI1jSaUPthmabA/ygf/6Cfg=
+go.opentelemetry.io/otel v0.19.0 h1:Lenfy7QHRXPZVsw/12CWpxX6d/JkrX8wrx2vO8G80Ng=
+go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg=
+go.opentelemetry.io/otel/metric v0.19.0 h1:dtZ1Ju44gkJkYvo+3qGqVXmf88tc+a42edOywypengg=
+go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc=
+go.opentelemetry.io/otel/oteltest v0.19.0 h1:YVfA0ByROYqTwOxqHVZYZExzEpfZor+MU1rU+ip2v9Q=
+go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA=
+go.opentelemetry.io/otel/trace v0.19.0 h1:1ucYlenXIDA1OlHVLDZKX0ObXV5RLaq06DtUKz5e5zc=
+go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
diff --git a/vendor/github.com/go-redis/redis/v8/internal/pool/conn.go b/vendor/github.com/go-redis/redis/v8/internal/pool/conn.go
index b78453043..ee064c9fc 100644
--- a/vendor/github.com/go-redis/redis/v8/internal/pool/conn.go
+++ b/vendor/github.com/go-redis/redis/v8/internal/pool/conn.go
@@ -9,7 +9,6 @@ import (
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/proto"
- "go.opentelemetry.io/otel/trace"
)
var noDeadline = time.Time{}
@@ -66,41 +65,43 @@ func (cn *Conn) RemoteAddr() net.Addr {
}
func (cn *Conn) WithReader(ctx context.Context, timeout time.Duration, fn func(rd *proto.Reader) error) error {
- return internal.WithSpan(ctx, "redis.with_reader", func(ctx context.Context, span trace.Span) error {
- if err := cn.netConn.SetReadDeadline(cn.deadline(ctx, timeout)); err != nil {
- return internal.RecordError(ctx, span, err)
- }
- if err := fn(cn.rd); err != nil {
- return internal.RecordError(ctx, span, err)
- }
- return nil
- })
+ ctx, span := internal.StartSpan(ctx, "redis.with_reader")
+ defer span.End()
+
+ if err := cn.netConn.SetReadDeadline(cn.deadline(ctx, timeout)); err != nil {
+ return internal.RecordError(ctx, span, err)
+ }
+ if err := fn(cn.rd); err != nil {
+ return internal.RecordError(ctx, span, err)
+ }
+ return nil
}
func (cn *Conn) WithWriter(
ctx context.Context, timeout time.Duration, fn func(wr *proto.Writer) error,
) error {
- return internal.WithSpan(ctx, "redis.with_writer", func(ctx context.Context, span trace.Span) error {
- if err := cn.netConn.SetWriteDeadline(cn.deadline(ctx, timeout)); err != nil {
- return internal.RecordError(ctx, span, err)
- }
+ ctx, span := internal.StartSpan(ctx, "redis.with_writer")
+ defer span.End()
- if cn.bw.Buffered() > 0 {
- cn.bw.Reset(cn.netConn)
- }
+ if err := cn.netConn.SetWriteDeadline(cn.deadline(ctx, timeout)); err != nil {
+ return internal.RecordError(ctx, span, err)
+ }
- if err := fn(cn.wr); err != nil {
- return internal.RecordError(ctx, span, err)
- }
+ if cn.bw.Buffered() > 0 {
+ cn.bw.Reset(cn.netConn)
+ }
- if err := cn.bw.Flush(); err != nil {
- return internal.RecordError(ctx, span, err)
- }
+ if err := fn(cn.wr); err != nil {
+ return internal.RecordError(ctx, span, err)
+ }
- internal.WritesCounter.Add(ctx, 1)
+ if err := cn.bw.Flush(); err != nil {
+ return internal.RecordError(ctx, span, err)
+ }
- return nil
- })
+ internal.WritesCounter.Add(ctx, 1)
+
+ return nil
}
func (cn *Conn) Close() error {
diff --git a/vendor/github.com/go-redis/redis/v8/internal/pool/pool.go b/vendor/github.com/go-redis/redis/v8/internal/pool/pool.go
index 254a18de5..74fbb37a6 100644
--- a/vendor/github.com/go-redis/redis/v8/internal/pool/pool.go
+++ b/vendor/github.com/go-redis/redis/v8/internal/pool/pool.go
@@ -228,8 +228,7 @@ func (p *ConnPool) Get(ctx context.Context) (*Conn, error) {
return nil, ErrClosed
}
- err := p.waitTurn(ctx)
- if err != nil {
+ if err := p.waitTurn(ctx); err != nil {
return nil, err
}
diff --git a/vendor/github.com/go-redis/redis/v8/internal/pool/pool_sticky.go b/vendor/github.com/go-redis/redis/v8/internal/pool/pool_sticky.go
index c3e7e7c04..3adb99bc8 100644
--- a/vendor/github.com/go-redis/redis/v8/internal/pool/pool_sticky.go
+++ b/vendor/github.com/go-redis/redis/v8/internal/pool/pool_sticky.go
@@ -172,8 +172,7 @@ func (p *StickyConnPool) Reset(ctx context.Context) error {
func (p *StickyConnPool) badConnError() error {
if v := p._badConnError.Load(); v != nil {
- err := v.(BadConnError)
- if err.wrapped != nil {
+ if err := v.(BadConnError); err.wrapped != nil {
return err
}
}
diff --git a/vendor/github.com/go-redis/redis/v8/internal/proto/reader.go b/vendor/github.com/go-redis/redis/v8/internal/proto/reader.go
index 0fbc51e9a..0ab8c9d2f 100644
--- a/vendor/github.com/go-redis/redis/v8/internal/proto/reader.go
+++ b/vendor/github.com/go-redis/redis/v8/internal/proto/reader.go
@@ -83,7 +83,7 @@ func (r *Reader) readLine() ([]byte, error) {
return nil, err
}
- full = append(full, b...)
+ full = append(full, b...) //nolint:makezero
b = full
}
if len(b) <= 2 || b[len(b)-1] != '\n' || b[len(b)-2] != '\r' {
diff --git a/vendor/github.com/go-redis/redis/v8/internal/proto/scan.go b/vendor/github.com/go-redis/redis/v8/internal/proto/scan.go
index c2c3ed17d..7d7183c32 100644
--- a/vendor/github.com/go-redis/redis/v8/internal/proto/scan.go
+++ b/vendor/github.com/go-redis/redis/v8/internal/proto/scan.go
@@ -10,7 +10,6 @@ import (
)
// Scan parses bytes `b` to `v` with appropriate type.
-// nolint: gocyclo
func Scan(b []byte, v interface{}) error {
switch v := v.(type) {
case nil:
diff --git a/vendor/github.com/go-redis/redis/v8/internal/util.go b/vendor/github.com/go-redis/redis/v8/internal/util.go
index 4d7921bf3..1a648fe63 100644
--- a/vendor/github.com/go-redis/redis/v8/internal/util.go
+++ b/vendor/github.com/go-redis/redis/v8/internal/util.go
@@ -11,17 +11,18 @@ import (
)
func Sleep(ctx context.Context, dur time.Duration) error {
- return WithSpan(ctx, "time.Sleep", func(ctx context.Context, span trace.Span) error {
- t := time.NewTimer(dur)
- defer t.Stop()
+ _, span := StartSpan(ctx, "time.Sleep")
+ defer span.End()
- select {
- case <-t.C:
- return nil
- case <-ctx.Done():
- return ctx.Err()
- }
- })
+ t := time.NewTimer(dur)
+ defer t.Stop()
+
+ select {
+ case <-t.C:
+ return nil
+ case <-ctx.Done():
+ return ctx.Err()
+ }
}
func ToLower(s string) string {
@@ -54,15 +55,11 @@ func isLower(s string) bool {
var tracer = otel.Tracer("github.com/go-redis/redis")
-func WithSpan(ctx context.Context, name string, fn func(context.Context, trace.Span) error) error {
+func StartSpan(ctx context.Context, name string) (context.Context, trace.Span) {
if span := trace.SpanFromContext(ctx); !span.IsRecording() {
- return fn(ctx, span)
+ return ctx, span
}
-
- ctx, span := tracer.Start(ctx, name)
- defer span.End()
-
- return fn(ctx, span)
+ return tracer.Start(ctx, name)
}
func RecordError(ctx context.Context, span trace.Span, err error) error {
diff --git a/vendor/github.com/go-redis/redis/v8/options.go b/vendor/github.com/go-redis/redis/v8/options.go
index 7a0200240..0fd8e880a 100644
--- a/vendor/github.com/go-redis/redis/v8/options.go
+++ b/vendor/github.com/go-redis/redis/v8/options.go
@@ -14,8 +14,7 @@ import (
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/pool"
- "go.opentelemetry.io/otel/label"
- "go.opentelemetry.io/otel/trace"
+ "go.opentelemetry.io/otel/attribute"
)
// Limiter is the interface of a rate limiter or a circuit breaker.
@@ -292,20 +291,21 @@ func getUserPassword(u *url.URL) (string, string) {
func newConnPool(opt *Options) *pool.ConnPool {
return pool.NewConnPool(&pool.Options{
Dialer: func(ctx context.Context) (net.Conn, error) {
- var conn net.Conn
- err := internal.WithSpan(ctx, "redis.dial", func(ctx context.Context, span trace.Span) error {
- span.SetAttributes(
- label.String("db.connection_string", opt.Addr),
- )
+ ctx, span := internal.StartSpan(ctx, "redis.dial")
+ defer span.End()
- var err error
- conn, err = opt.Dialer(ctx, opt.Network, opt.Addr)
- if err != nil {
- _ = internal.RecordError(ctx, span, err)
- }
- return err
- })
- return conn, err
+ if span.IsRecording() {
+ span.SetAttributes(
+ attribute.String("db.connection_string", opt.Addr),
+ )
+ }
+
+ cn, err := opt.Dialer(ctx, opt.Network, opt.Addr)
+ if err != nil {
+ return nil, internal.RecordError(ctx, span, err)
+ }
+
+ return cn, nil
},
PoolSize: opt.PoolSize,
MinIdleConns: opt.MinIdleConns,
diff --git a/vendor/github.com/go-redis/redis/v8/redis.go b/vendor/github.com/go-redis/redis/v8/redis.go
index 712579d4c..7995c4365 100644
--- a/vendor/github.com/go-redis/redis/v8/redis.go
+++ b/vendor/github.com/go-redis/redis/v8/redis.go
@@ -10,8 +10,7 @@ import (
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/proto"
- "go.opentelemetry.io/otel/label"
- "go.opentelemetry.io/otel/trace"
+ "go.opentelemetry.io/otel/attribute"
)
// Nil reply returned by Redis when key does not exist.
@@ -214,10 +213,7 @@ func (c *baseClient) _getConn(ctx context.Context) (*pool.Conn, error) {
return cn, nil
}
- err = internal.WithSpan(ctx, "redis.init_conn", func(ctx context.Context, span trace.Span) error {
- return c.initConn(ctx, cn)
- })
- if err != nil {
+ if err := c.initConn(ctx, cn); err != nil {
c.connPool.Remove(ctx, cn, err)
if err := errors.Unwrap(err); err != nil {
return nil, err
@@ -241,6 +237,9 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
return nil
}
+ ctx, span := internal.StartSpan(ctx, "redis.init_conn")
+ defer span.End()
+
connPool := pool.NewSingleConnPool(c.connPool, cn)
conn := newConn(ctx, c.opt, connPool)
@@ -288,43 +287,45 @@ func (c *baseClient) releaseConn(ctx context.Context, cn *pool.Conn, err error)
func (c *baseClient) withConn(
ctx context.Context, fn func(context.Context, *pool.Conn) error,
) error {
- return internal.WithSpan(ctx, "redis.with_conn", func(ctx context.Context, span trace.Span) error {
- cn, err := c.getConn(ctx)
- if err != nil {
- return err
+ ctx, span := internal.StartSpan(ctx, "redis.with_conn")
+ defer span.End()
+
+ cn, err := c.getConn(ctx)
+ if err != nil {
+ return err
+ }
+
+ if span.IsRecording() {
+ if remoteAddr := cn.RemoteAddr(); remoteAddr != nil {
+ span.SetAttributes(attribute.String("net.peer.ip", remoteAddr.String()))
}
+ }
- if span.IsRecording() {
- if remoteAddr := cn.RemoteAddr(); remoteAddr != nil {
- span.SetAttributes(label.String("net.peer.ip", remoteAddr.String()))
- }
- }
+ defer func() {
+ c.releaseConn(ctx, cn, err)
+ }()
- defer func() {
- c.releaseConn(ctx, cn, err)
- }()
+ done := ctx.Done() //nolint:ifshort
- done := ctx.Done()
- if done == nil {
- err = fn(ctx, cn)
- return err
- }
+ if done == nil {
+ err = fn(ctx, cn)
+ return err
+ }
- errc := make(chan error, 1)
- go func() { errc <- fn(ctx, cn) }()
+ errc := make(chan error, 1)
+ go func() { errc <- fn(ctx, cn) }()
- select {
- case <-done:
- _ = cn.Close()
- // Wait for the goroutine to finish and send something.
- <-errc
+ select {
+ case <-done:
+ _ = cn.Close()
+ // Wait for the goroutine to finish and send something.
+ <-errc
- err = ctx.Err()
- return err
- case err = <-errc:
- return err
- }
- })
+ err = ctx.Err()
+ return err
+ case err = <-errc:
+ return err
+ }
}
func (c *baseClient) process(ctx context.Context, cmd Cmder) error {
@@ -332,47 +333,50 @@ func (c *baseClient) process(ctx context.Context, cmd Cmder) error {
for attempt := 0; attempt <= c.opt.MaxRetries; attempt++ {
attempt := attempt
- var retry bool
- err := internal.WithSpan(ctx, "redis.process", func(ctx context.Context, span trace.Span) error {
- if attempt > 0 {
- if err := internal.Sleep(ctx, c.retryBackoff(attempt)); err != nil {
- return err
- }
- }
-
- retryTimeout := uint32(1)
- err := c.withConn(ctx, func(ctx context.Context, cn *pool.Conn) error {
- err := cn.WithWriter(ctx, c.opt.WriteTimeout, func(wr *proto.Writer) error {
- return writeCmd(wr, cmd)
- })
- if err != nil {
- return err
- }
-
- err = cn.WithReader(ctx, c.cmdTimeout(cmd), cmd.readReply)
- if err != nil {
- if cmd.readTimeout() == nil {
- atomic.StoreUint32(&retryTimeout, 1)
- }
- return err
- }
-
- return nil
- })
- if err == nil {
- return nil
- }
- retry = shouldRetry(err, atomic.LoadUint32(&retryTimeout) == 1)
- return err
- })
+ retry, err := c._process(ctx, cmd, attempt)
if err == nil || !retry {
return err
}
+
lastErr = err
}
return lastErr
}
+func (c *baseClient) _process(ctx context.Context, cmd Cmder, attempt int) (bool, error) {
+ if attempt > 0 {
+ if err := internal.Sleep(ctx, c.retryBackoff(attempt)); err != nil {
+ return false, err
+ }
+ }
+
+ retryTimeout := uint32(1)
+ err := c.withConn(ctx, func(ctx context.Context, cn *pool.Conn) error {
+ err := cn.WithWriter(ctx, c.opt.WriteTimeout, func(wr *proto.Writer) error {
+ return writeCmd(wr, cmd)
+ })
+ if err != nil {
+ return err
+ }
+
+ err = cn.WithReader(ctx, c.cmdTimeout(cmd), cmd.readReply)
+ if err != nil {
+ if cmd.readTimeout() == nil {
+ atomic.StoreUint32(&retryTimeout, 1)
+ }
+ return err
+ }
+
+ return nil
+ })
+ if err == nil {
+ return false, nil
+ }
+
+ retry := shouldRetry(err, atomic.LoadUint32(&retryTimeout) == 1)
+ return retry, err
+}
+
func (c *baseClient) retryBackoff(attempt int) time.Duration {
return internal.RetryBackoff(attempt, c.opt.MinRetryBackoff, c.opt.MaxRetryBackoff)
}
diff --git a/vendor/github.com/go-redis/redis/v8/sentinel.go b/vendor/github.com/go-redis/redis/v8/sentinel.go
index 3e8afb745..efa2a41d7 100644
--- a/vendor/github.com/go-redis/redis/v8/sentinel.go
+++ b/vendor/github.com/go-redis/redis/v8/sentinel.go
@@ -625,7 +625,7 @@ func parseSlaveAddrs(addrs []interface{}, keepDisconnected bool) []string {
func (c *sentinelFailover) trySwitchMaster(ctx context.Context, addr string) {
c.mu.RLock()
- currentAddr := c._masterAddr
+ currentAddr := c._masterAddr //nolint:ifshort
c.mu.RUnlock()
if addr == currentAddr {
@@ -666,15 +666,22 @@ func (c *sentinelFailover) discoverSentinels(ctx context.Context) {
}
for _, sentinel := range sentinels {
vals := sentinel.([]interface{})
+ var ip, port string
for i := 0; i < len(vals); i += 2 {
key := vals[i].(string)
- if key == "name" {
- sentinelAddr := vals[i+1].(string)
- if !contains(c.sentinelAddrs, sentinelAddr) {
- internal.Logger.Printf(ctx, "sentinel: discovered new sentinel=%q for master=%q",
- sentinelAddr, c.opt.MasterName)
- c.sentinelAddrs = append(c.sentinelAddrs, sentinelAddr)
- }
+ switch key {
+ case "ip":
+ ip = vals[i+1].(string)
+ case "port":
+ port = vals[i+1].(string)
+ }
+ }
+ if ip != "" && port != "" {
+ sentinelAddr := net.JoinHostPort(ip, port)
+ if !contains(c.sentinelAddrs, sentinelAddr) {
+ internal.Logger.Printf(ctx, "sentinel: discovered new sentinel=%q for master=%q",
+ sentinelAddr, c.opt.MasterName)
+ c.sentinelAddrs = append(c.sentinelAddrs, sentinelAddr)
}
}
}
diff --git a/vendor/github.com/go-redis/redis/v8/universal.go b/vendor/github.com/go-redis/redis/v8/universal.go
index 5f0e1e33a..bb5f8b616 100644
--- a/vendor/github.com/go-redis/redis/v8/universal.go
+++ b/vendor/github.com/go-redis/redis/v8/universal.go
@@ -53,6 +53,7 @@ type UniversalOptions struct {
// The sentinel master name.
// Only failover clients.
+
MasterName string
}
@@ -168,9 +169,9 @@ func (o *UniversalOptions) Simple() *Options {
// --------------------------------------------------------------------
// UniversalClient is an abstract client which - based on the provided options -
-// can connect to either clusters, or sentinel-backed failover instances
-// or simple single-instance servers. This can be useful for testing
-// cluster-specific applications locally.
+// represents either a ClusterClient, a FailoverClient, or a single-node Client.
+// This can be useful for testing cluster-specific applications locally or having different
+// clients in different environments.
type UniversalClient interface {
Cmdable
Context() context.Context
@@ -190,12 +191,12 @@ var (
_ UniversalClient = (*Ring)(nil)
)
-// NewUniversalClient returns a new multi client. The type of client returned depends
-// on the following three conditions:
+// NewUniversalClient returns a new multi client. The type of the returned client depends
+// on the following conditions:
//
-// 1. if a MasterName is passed a sentinel-backed FailoverClient will be returned
-// 2. if the number of Addrs is two or more, a ClusterClient will be returned
-// 3. otherwise, a single-node redis Client will be returned.
+// 1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned.
+// 2. if the number of Addrs is two or more, a ClusterClient is returned.
+// 3. Otherwise, a single-node Client is returned.
func NewUniversalClient(opts *UniversalOptions) UniversalClient {
if opts.MasterName != "" {
return NewFailoverClient(opts.Failover())
diff --git a/vendor/github.com/go-sql-driver/mysql/.travis.yml b/vendor/github.com/go-sql-driver/mysql/.travis.yml
deleted file mode 100644
index 56fcf25f2..000000000
--- a/vendor/github.com/go-sql-driver/mysql/.travis.yml
+++ /dev/null
@@ -1,129 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.10.x
- - 1.11.x
- - 1.12.x
- - 1.13.x
- - master
-
-before_install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
-
-before_script:
- - echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB" | sudo tee -a /etc/mysql/my.cnf
- - sudo service mysql restart
- - .travis/wait_mysql.sh
- - mysql -e 'create database gotest;'
-
-matrix:
- include:
- - env: DB=MYSQL8
- sudo: required
- dist: trusty
- go: 1.10.x
- services:
- - docker
- before_install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- - docker pull mysql:8.0
- - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
- mysql:8.0 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
- - cp .travis/docker.cnf ~/.my.cnf
- - .travis/wait_mysql.sh
- before_script:
- - export MYSQL_TEST_USER=gotest
- - export MYSQL_TEST_PASS=secret
- - export MYSQL_TEST_ADDR=127.0.0.1:3307
- - export MYSQL_TEST_CONCURRENT=1
-
- - env: DB=MYSQL57
- sudo: required
- dist: trusty
- go: 1.10.x
- services:
- - docker
- before_install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- - docker pull mysql:5.7
- - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
- mysql:5.7 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
- - cp .travis/docker.cnf ~/.my.cnf
- - .travis/wait_mysql.sh
- before_script:
- - export MYSQL_TEST_USER=gotest
- - export MYSQL_TEST_PASS=secret
- - export MYSQL_TEST_ADDR=127.0.0.1:3307
- - export MYSQL_TEST_CONCURRENT=1
-
- - env: DB=MARIA55
- sudo: required
- dist: trusty
- go: 1.10.x
- services:
- - docker
- before_install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- - docker pull mariadb:5.5
- - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
- mariadb:5.5 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
- - cp .travis/docker.cnf ~/.my.cnf
- - .travis/wait_mysql.sh
- before_script:
- - export MYSQL_TEST_USER=gotest
- - export MYSQL_TEST_PASS=secret
- - export MYSQL_TEST_ADDR=127.0.0.1:3307
- - export MYSQL_TEST_CONCURRENT=1
-
- - env: DB=MARIA10_1
- sudo: required
- dist: trusty
- go: 1.10.x
- services:
- - docker
- before_install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- - docker pull mariadb:10.1
- - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
- mariadb:10.1 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
- - cp .travis/docker.cnf ~/.my.cnf
- - .travis/wait_mysql.sh
- before_script:
- - export MYSQL_TEST_USER=gotest
- - export MYSQL_TEST_PASS=secret
- - export MYSQL_TEST_ADDR=127.0.0.1:3307
- - export MYSQL_TEST_CONCURRENT=1
-
- - os: osx
- osx_image: xcode10.1
- addons:
- homebrew:
- packages:
- - mysql
- update: true
- go: 1.12.x
- before_install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- before_script:
- - echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB\nlocal_infile=1" >> /usr/local/etc/my.cnf
- - mysql.server start
- - mysql -uroot -e 'CREATE USER gotest IDENTIFIED BY "secret"'
- - mysql -uroot -e 'GRANT ALL ON *.* TO gotest'
- - mysql -uroot -e 'create database gotest;'
- - export MYSQL_TEST_USER=gotest
- - export MYSQL_TEST_PASS=secret
- - export MYSQL_TEST_ADDR=127.0.0.1:3306
- - export MYSQL_TEST_CONCURRENT=1
-
-script:
- - go test -v -covermode=count -coverprofile=coverage.out
- - go vet ./...
- - .travis/gofmt.sh
-after_script:
- - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
diff --git a/vendor/github.com/go-sql-driver/mysql/AUTHORS b/vendor/github.com/go-sql-driver/mysql/AUTHORS
index ad5989800..50afa2c85 100644
--- a/vendor/github.com/go-sql-driver/mysql/AUTHORS
+++ b/vendor/github.com/go-sql-driver/mysql/AUTHORS
@@ -13,11 +13,15 @@
Aaron Hopkins
Achille Roussel
+Alex Snast
Alexey Palazhchenko
Andrew Reid
+Animesh Ray
Arne Hormann
+Ariel Mashraki
Asta Xie
Bulat Gaifullin
+Caine Jette
Carlos Nieto
Chris Moos
Craig Wilson
@@ -52,6 +56,7 @@ Julien Schmidt
Justin Li
Justin Nuß
Kamil Dziedzic
+Kei Kamikawa
Kevin Malachowski
Kieron Woodhouse
Lennart Rudolph
@@ -74,20 +79,26 @@ Reed Allman
Richard Wilkes
Robert Russell
Runrioter Wung
+Sho Iizuka
+Sho Ikeda
Shuode Li
Simon J Mudd
Soroush Pour
Stan Putrya
Stanley Gunawan
Steven Hartland
+Tan Jinhua <312841925 at qq.com>
Thomas Wodarek
Tim Ruffles
Tom Jenkinson
Vladimir Kovpak
+Vladyslav Zhelezniak
Xiangyu Hu
Xiaobing Jiang
Xiuming Chen
+Xuehong Chan
Zhenye Xie
+Zhixin Wen
# Organizations
@@ -103,3 +114,4 @@ Multiplay Ltd.
Percona LLC
Pivotal Inc.
Stripe Inc.
+Zendesk Inc.
diff --git a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
index 9cb97b38d..72a738ed5 100644
--- a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
+++ b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
@@ -1,3 +1,29 @@
+## Version 1.6 (2021-04-01)
+
+Changes:
+
+ - Migrate the CI service from travis-ci to GitHub Actions (#1176, #1183, #1190)
+ - `NullTime` is deprecated (#960, #1144)
+ - Reduce allocations when building SET command (#1111)
+ - Performance improvement for time formatting (#1118)
+ - Performance improvement for time parsing (#1098, #1113)
+
+New Features:
+
+ - Implement `driver.Validator` interface (#1106, #1174)
+ - Support returning `uint64` from `Valuer` in `ConvertValue` (#1143)
+ - Add `json.RawMessage` for converter and prepared statement (#1059)
+ - Interpolate `json.RawMessage` as `string` (#1058)
+ - Implements `CheckNamedValue` (#1090)
+
+Bugfixes:
+
+ - Stop rounding times (#1121, #1172)
+ - Put zero filler into the SSL handshake packet (#1066)
+ - Fix checking cancelled connections back into the connection pool (#1095)
+ - Fix remove last 0 byte for mysql_old_password when password is empty (#1133)
+
+
## Version 1.5 (2020-01-07)
Changes:
diff --git a/vendor/github.com/go-sql-driver/mysql/README.md b/vendor/github.com/go-sql-driver/mysql/README.md
index d2627a41a..0b13154fc 100644
--- a/vendor/github.com/go-sql-driver/mysql/README.md
+++ b/vendor/github.com/go-sql-driver/mysql/README.md
@@ -35,7 +35,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
* Supports queries larger than 16MB
* Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support.
* Intelligent `LONG DATA` handling in prepared statements
- * Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support
+ * Secure `LOAD DATA LOCAL INFILE` support with file allowlisting and `io.Reader` support
* Optional `time.Time` parsing
* Optional placeholder interpolation
@@ -56,15 +56,37 @@ Make sure [Git is installed](https://git-scm.com/downloads) on your machine and
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](https://golang.org/pkg/database/sql/) API then.
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
+
```go
-import "database/sql"
-import _ "github.com/go-sql-driver/mysql"
+import (
+ "database/sql"
+ "time"
+
+ _ "github.com/go-sql-driver/mysql"
+)
+
+// ...
db, err := sql.Open("mysql", "user:password@/dbname")
+if err != nil {
+ panic(err)
+}
+// See "Important settings" section.
+db.SetConnMaxLifetime(time.Minute * 3)
+db.SetMaxOpenConns(10)
+db.SetMaxIdleConns(10)
```
[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
+### Important settings
+
+`db.SetConnMaxLifetime()` is required to ensure connections are closed by the driver safely before connection is closed by MySQL server, OS, or other middlewares. Since some middlewares close idle connections by 5 minutes, we recommend timeout shorter than 5 minutes. This setting helps load balancing and changing system variables too.
+
+`db.SetMaxOpenConns()` is highly recommended to limit the number of connection used by the application. There is no recommended limit number because it depends on application and MySQL server.
+
+`db.SetMaxIdleConns()` is recommended to be set same to (or greater than) `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed very frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15.
+
### DSN (Data Source Name)
@@ -122,7 +144,7 @@ Valid Values: true, false
Default: false
```
-`allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files.
+`allowAllFiles=true` disables the file allowlist for `LOAD DATA LOCAL INFILE` and allows *all* files.
[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
##### `allowCleartextPasswords`
@@ -133,7 +155,7 @@ Valid Values: true, false
Default: false
```
-`allowCleartextPasswords=true` allows using the [cleartext client side plugin](http://dev.mysql.com/doc/en/cleartext-authentication-plugin.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
+`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
##### `allowNativePasswords`
@@ -230,7 +252,7 @@ Default: false
If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`.
-*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are blacklisted as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
+*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are rejected as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
##### `loc`
@@ -376,7 +398,7 @@ Rules:
Examples:
* `autocommit=1`: `SET autocommit=1`
* [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'`
- * [`tx_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation): `SET tx_isolation='REPEATABLE-READ'`
+ * [`transaction_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_transaction_isolation): `SET transaction_isolation='REPEATABLE-READ'`
#### Examples
@@ -445,7 +467,7 @@ For this feature you need direct access to the package. Therefore you must chang
import "github.com/go-sql-driver/mysql"
```
-Files must be whitelisted by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the Whitelist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
+Files must be explicitly allowed by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the allowlist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::` then. Choose different names for different handlers and `DeregisterReaderHandler` when you don't need it anymore.
@@ -459,8 +481,6 @@ However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` v
**Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes).
-Alternatively you can use the [`NullTime`](https://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`.
-
### Unicode support
Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default.
@@ -477,7 +497,7 @@ To run the driver tests you may need to adjust the configuration. See the [Testi
Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated.
If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls).
-See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/CONTRIBUTING.md) for details.
+See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/.github/CONTRIBUTING.md) for details.
---------------------------------------
@@ -498,4 +518,3 @@ Please read the [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) if you
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
![Go Gopher and MySQL Dolphin](https://raw.github.com/wiki/go-sql-driver/mysql/go-mysql-driver_m.jpg "Golang Gopher transporting the MySQL Dolphin in a wheelbarrow")
-
diff --git a/vendor/github.com/go-sql-driver/mysql/auth.go b/vendor/github.com/go-sql-driver/mysql/auth.go
index fec7040d4..b2f19e8f0 100644
--- a/vendor/github.com/go-sql-driver/mysql/auth.go
+++ b/vendor/github.com/go-sql-driver/mysql/auth.go
@@ -15,6 +15,7 @@ import (
"crypto/sha256"
"crypto/x509"
"encoding/pem"
+ "fmt"
"sync"
)
@@ -136,10 +137,6 @@ func pwHash(password []byte) (result [2]uint32) {
// Hash password using insecure pre 4.1 method
func scrambleOldPassword(scramble []byte, password string) []byte {
- if len(password) == 0 {
- return nil
- }
-
scramble = scramble[:8]
hashPw := pwHash([]byte(password))
@@ -247,6 +244,9 @@ func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) {
if !mc.cfg.AllowOldPasswords {
return nil, ErrOldPassword
}
+ if len(mc.cfg.Passwd) == 0 {
+ return nil, nil
+ }
// Note: there are edge cases where this should work but doesn't;
// this is currently "wontfix":
// https://github.com/go-sql-driver/mysql/issues/184
@@ -372,7 +372,10 @@ func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error {
return err
}
- block, _ := pem.Decode(data[1:])
+ block, rest := pem.Decode(data[1:])
+ if block == nil {
+ return fmt.Errorf("No Pem data found, data: %s", rest)
+ }
pkix, err := x509.ParsePKIXPublicKey(block.Bytes)
if err != nil {
return err
diff --git a/vendor/github.com/go-sql-driver/mysql/collations.go b/vendor/github.com/go-sql-driver/mysql/collations.go
index 8d2b55676..326a9f7fa 100644
--- a/vendor/github.com/go-sql-driver/mysql/collations.go
+++ b/vendor/github.com/go-sql-driver/mysql/collations.go
@@ -247,7 +247,7 @@ var collations = map[string]byte{
"utf8mb4_0900_ai_ci": 255,
}
-// A blacklist of collations which is unsafe to interpolate parameters.
+// A denylist of collations which is unsafe to interpolate parameters.
// These multibyte encodings may contains 0x5c (`\`) in their trailing bytes.
var unsafeCollations = map[string]bool{
"big5_chinese_ci": true,
diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go
index e4bb59e67..835f89729 100644
--- a/vendor/github.com/go-sql-driver/mysql/connection.go
+++ b/vendor/github.com/go-sql-driver/mysql/connection.go
@@ -12,6 +12,7 @@ import (
"context"
"database/sql"
"database/sql/driver"
+ "encoding/json"
"io"
"net"
"strconv"
@@ -46,9 +47,10 @@ type mysqlConn struct {
// Handles parameters set in DSN after the connection is established
func (mc *mysqlConn) handleParams() (err error) {
+ var cmdSet strings.Builder
for param, val := range mc.cfg.Params {
switch param {
- // Charset
+ // Charset: character_set_connection, character_set_client, character_set_results
case "charset":
charsets := strings.Split(val, ",")
for i := range charsets {
@@ -62,12 +64,25 @@ func (mc *mysqlConn) handleParams() (err error) {
return
}
- // System Vars
+ // Other system vars accumulated in a single SET command
default:
- err = mc.exec("SET " + param + "=" + val + "")
- if err != nil {
- return
+ if cmdSet.Len() == 0 {
+ // Heuristic: 29 chars for each other key=value to reduce reallocations
+ cmdSet.Grow(4 + len(param) + 1 + len(val) + 30*(len(mc.cfg.Params)-1))
+ cmdSet.WriteString("SET ")
+ } else {
+ cmdSet.WriteByte(',')
}
+ cmdSet.WriteString(param)
+ cmdSet.WriteByte('=')
+ cmdSet.WriteString(val)
+ }
+ }
+
+ if cmdSet.Len() > 0 {
+ err = mc.exec(cmdSet.String())
+ if err != nil {
+ return
}
}
@@ -230,47 +245,21 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
if v.IsZero() {
buf = append(buf, "'0000-00-00'"...)
} else {
- v := v.In(mc.cfg.Loc)
- v = v.Add(time.Nanosecond * 500) // To round under microsecond
- year := v.Year()
- year100 := year / 100
- year1 := year % 100
- month := v.Month()
- day := v.Day()
- hour := v.Hour()
- minute := v.Minute()
- second := v.Second()
- micro := v.Nanosecond() / 1000
-
- buf = append(buf, []byte{
- '\'',
- digits10[year100], digits01[year100],
- digits10[year1], digits01[year1],
- '-',
- digits10[month], digits01[month],
- '-',
- digits10[day], digits01[day],
- ' ',
- digits10[hour], digits01[hour],
- ':',
- digits10[minute], digits01[minute],
- ':',
- digits10[second], digits01[second],
- }...)
-
- if micro != 0 {
- micro10000 := micro / 10000
- micro100 := micro / 100 % 100
- micro1 := micro % 100
- buf = append(buf, []byte{
- '.',
- digits10[micro10000], digits01[micro10000],
- digits10[micro100], digits01[micro100],
- digits10[micro1], digits01[micro1],
- }...)
+ buf = append(buf, '\'')
+ buf, err = appendDateTime(buf, v.In(mc.cfg.Loc))
+ if err != nil {
+ return "", err
}
buf = append(buf, '\'')
}
+ case json.RawMessage:
+ buf = append(buf, '\'')
+ if mc.status&statusNoBackslashEscapes == 0 {
+ buf = escapeBytesBackslash(buf, v)
+ } else {
+ buf = escapeBytesQuotes(buf, v)
+ }
+ buf = append(buf, '\'')
case []byte:
if v == nil {
buf = append(buf, "NULL"...)
@@ -480,6 +469,10 @@ func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
// BeginTx implements driver.ConnBeginTx interface
func (mc *mysqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
+ if mc.closed.IsSet() {
+ return nil, driver.ErrBadConn
+ }
+
if err := mc.watchCancel(ctx); err != nil {
return nil, err
}
@@ -649,3 +642,9 @@ func (mc *mysqlConn) ResetSession(ctx context.Context) error {
mc.reset = true
return nil
}
+
+// IsValid implements driver.Validator interface
+// (From Go 1.15)
+func (mc *mysqlConn) IsValid() bool {
+ return !mc.closed.IsSet()
+}
diff --git a/vendor/github.com/go-sql-driver/mysql/dsn.go b/vendor/github.com/go-sql-driver/mysql/dsn.go
index 75c8c2489..93f3548cb 100644
--- a/vendor/github.com/go-sql-driver/mysql/dsn.go
+++ b/vendor/github.com/go-sql-driver/mysql/dsn.go
@@ -375,7 +375,7 @@ func parseDSNParams(cfg *Config, params string) (err error) {
// cfg params
switch value := param[1]; param[0] {
- // Disable INFILE whitelist / enable all files
+ // Disable INFILE allowlist / enable all files
case "allowAllFiles":
var isBool bool
cfg.AllowAllFiles, isBool = readBool(value)
diff --git a/vendor/github.com/go-sql-driver/mysql/fields.go b/vendor/github.com/go-sql-driver/mysql/fields.go
index e1e2ece4b..ed6c7a37d 100644
--- a/vendor/github.com/go-sql-driver/mysql/fields.go
+++ b/vendor/github.com/go-sql-driver/mysql/fields.go
@@ -106,7 +106,7 @@ var (
scanTypeInt64 = reflect.TypeOf(int64(0))
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
- scanTypeNullTime = reflect.TypeOf(NullTime{})
+ scanTypeNullTime = reflect.TypeOf(nullTime{})
scanTypeUint8 = reflect.TypeOf(uint8(0))
scanTypeUint16 = reflect.TypeOf(uint16(0))
scanTypeUint32 = reflect.TypeOf(uint32(0))
diff --git a/vendor/github.com/go-sql-driver/mysql/fuzz.go b/vendor/github.com/go-sql-driver/mysql/fuzz.go
new file mode 100644
index 000000000..fa75adf6a
--- /dev/null
+++ b/vendor/github.com/go-sql-driver/mysql/fuzz.go
@@ -0,0 +1,24 @@
+// Go MySQL Driver - A MySQL-Driver for Go's database/sql package.
+//
+// Copyright 2020 The Go-MySQL-Driver Authors. All rights reserved.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this file,
+// You can obtain one at http://mozilla.org/MPL/2.0/.
+
+// +build gofuzz
+
+package mysql
+
+import (
+ "database/sql"
+)
+
+func Fuzz(data []byte) int {
+ db, err := sql.Open("mysql", string(data))
+ if err != nil {
+ return 0
+ }
+ db.Close()
+ return 1
+}
diff --git a/vendor/github.com/go-sql-driver/mysql/infile.go b/vendor/github.com/go-sql-driver/mysql/infile.go
index 273cb0ba5..60effdfc2 100644
--- a/vendor/github.com/go-sql-driver/mysql/infile.go
+++ b/vendor/github.com/go-sql-driver/mysql/infile.go
@@ -23,7 +23,7 @@ var (
readerRegisterLock sync.RWMutex
)
-// RegisterLocalFile adds the given file to the file whitelist,
+// RegisterLocalFile adds the given file to the file allowlist,
// so that it can be used by "LOAD DATA LOCAL INFILE ".
// Alternatively you can allow the use of all local files with
// the DSN parameter 'allowAllFiles=true'
@@ -45,7 +45,7 @@ func RegisterLocalFile(filePath string) {
fileRegisterLock.Unlock()
}
-// DeregisterLocalFile removes the given filepath from the whitelist.
+// DeregisterLocalFile removes the given filepath from the allowlist.
func DeregisterLocalFile(filePath string) {
fileRegisterLock.Lock()
delete(fileRegister, strings.Trim(filePath, `"`))
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime.go b/vendor/github.com/go-sql-driver/mysql/nulltime.go
index afa8a89e9..651723a96 100644
--- a/vendor/github.com/go-sql-driver/mysql/nulltime.go
+++ b/vendor/github.com/go-sql-driver/mysql/nulltime.go
@@ -28,11 +28,11 @@ func (nt *NullTime) Scan(value interface{}) (err error) {
nt.Time, nt.Valid = v, true
return
case []byte:
- nt.Time, err = parseDateTime(string(v), time.UTC)
+ nt.Time, err = parseDateTime(v, time.UTC)
nt.Valid = (err == nil)
return
case string:
- nt.Time, err = parseDateTime(v, time.UTC)
+ nt.Time, err = parseDateTime([]byte(v), time.UTC)
nt.Valid = (err == nil)
return
}
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go b/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
index c392594dd..453b4b394 100644
--- a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
+++ b/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
@@ -28,4 +28,13 @@ import (
// }
//
// This NullTime implementation is not driver-specific
+//
+// Deprecated: NullTime doesn't honor the loc DSN parameter.
+// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
+// Use sql.NullTime instead.
type NullTime sql.NullTime
+
+// for internal use.
+// the mysql package uses sql.NullTime if it is available.
+// if not, the package uses mysql.NullTime.
+type nullTime = sql.NullTime // sql.NullTime is available
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go b/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
index 86d159d44..9f7ae27a8 100644
--- a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
+++ b/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
@@ -32,3 +32,8 @@ type NullTime struct {
Time time.Time
Valid bool // Valid is true if Time is not NULL
}
+
+// for internal use.
+// the mysql package uses sql.NullTime if it is available.
+// if not, the package uses mysql.NullTime.
+type nullTime = NullTime // sql.NullTime is not available
diff --git a/vendor/github.com/go-sql-driver/mysql/packets.go b/vendor/github.com/go-sql-driver/mysql/packets.go
index 82ad7a200..6664e5ae5 100644
--- a/vendor/github.com/go-sql-driver/mysql/packets.go
+++ b/vendor/github.com/go-sql-driver/mysql/packets.go
@@ -13,6 +13,7 @@ import (
"crypto/tls"
"database/sql/driver"
"encoding/binary"
+ "encoding/json"
"errors"
"fmt"
"io"
@@ -348,6 +349,12 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
return errors.New("unknown collation")
}
+ // Filler [23 bytes] (all 0x00)
+ pos := 13
+ for ; pos < 13+23; pos++ {
+ data[pos] = 0
+ }
+
// SSL Connection Request Packet
// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest
if mc.cfg.tls != nil {
@@ -366,12 +373,6 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
mc.buf.nc = tlsConn
}
- // Filler [23 bytes] (all 0x00)
- pos := 13
- for ; pos < 13+23; pos++ {
- data[pos] = 0
- }
-
// User [null terminated string]
if len(mc.cfg.User) > 0 {
pos += copy(data[pos:], mc.cfg.User)
@@ -777,7 +778,7 @@ func (rows *textRows) readRow(dest []driver.Value) error {
case fieldTypeTimestamp, fieldTypeDateTime,
fieldTypeDate, fieldTypeNewDate:
dest[i], err = parseDateTime(
- string(dest[i].([]byte)),
+ dest[i].([]byte),
mc.cfg.Loc,
)
if err == nil {
@@ -1003,6 +1004,9 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
continue
}
+ if v, ok := arg.(json.RawMessage); ok {
+ arg = []byte(v)
+ }
// cache types and values
switch v := arg.(type) {
case int64:
@@ -1112,7 +1116,10 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
if v.IsZero() {
b = append(b, "0000-00-00"...)
} else {
- b = v.In(mc.cfg.Loc).AppendFormat(b, timeFormat)
+ b, err = appendDateTime(b, v.In(mc.cfg.Loc))
+ if err != nil {
+ return err
+ }
}
paramValues = appendLengthEncodedInteger(paramValues,
diff --git a/vendor/github.com/go-sql-driver/mysql/statement.go b/vendor/github.com/go-sql-driver/mysql/statement.go
index f7e370939..18a3ae498 100644
--- a/vendor/github.com/go-sql-driver/mysql/statement.go
+++ b/vendor/github.com/go-sql-driver/mysql/statement.go
@@ -10,6 +10,7 @@ package mysql
import (
"database/sql/driver"
+ "encoding/json"
"fmt"
"io"
"reflect"
@@ -43,6 +44,11 @@ func (stmt *mysqlStmt) ColumnConverter(idx int) driver.ValueConverter {
return converter{}
}
+func (stmt *mysqlStmt) CheckNamedValue(nv *driver.NamedValue) (err error) {
+ nv.Value, err = converter{}.ConvertValue(nv.Value)
+ return
+}
+
func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) {
if stmt.mc.closed.IsSet() {
errLog.Print(ErrInvalidConn)
@@ -129,6 +135,8 @@ func (stmt *mysqlStmt) query(args []driver.Value) (*binaryRows, error) {
return rows, err
}
+var jsonType = reflect.TypeOf(json.RawMessage{})
+
type converter struct{}
// ConvertValue mirrors the reference/default converter in database/sql/driver
@@ -146,12 +154,17 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
if err != nil {
return nil, err
}
- if !driver.IsValue(sv) {
- return nil, fmt.Errorf("non-Value type %T returned from Value", sv)
+ if driver.IsValue(sv) {
+ return sv, nil
}
- return sv, nil
+ // A value returend from the Valuer interface can be "a type handled by
+ // a database driver's NamedValueChecker interface" so we should accept
+ // uint64 here as well.
+ if u, ok := sv.(uint64); ok {
+ return u, nil
+ }
+ return nil, fmt.Errorf("non-Value type %T returned from Value", sv)
}
-
rv := reflect.ValueOf(v)
switch rv.Kind() {
case reflect.Ptr:
@@ -170,11 +183,14 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
case reflect.Bool:
return rv.Bool(), nil
case reflect.Slice:
- ek := rv.Type().Elem().Kind()
- if ek == reflect.Uint8 {
+ switch t := rv.Type(); {
+ case t == jsonType:
+ return v, nil
+ case t.Elem().Kind() == reflect.Uint8:
return rv.Bytes(), nil
+ default:
+ return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, t.Elem().Kind())
}
- return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, ek)
case reflect.String:
return rv.String(), nil
}
diff --git a/vendor/github.com/go-sql-driver/mysql/utils.go b/vendor/github.com/go-sql-driver/mysql/utils.go
index 9552e80b5..d6545f5be 100644
--- a/vendor/github.com/go-sql-driver/mysql/utils.go
+++ b/vendor/github.com/go-sql-driver/mysql/utils.go
@@ -106,27 +106,136 @@ func readBool(input string) (value bool, valid bool) {
* Time related utils *
******************************************************************************/
-func parseDateTime(str string, loc *time.Location) (t time.Time, err error) {
- base := "0000-00-00 00:00:00.0000000"
- switch len(str) {
+func parseDateTime(b []byte, loc *time.Location) (time.Time, error) {
+ const base = "0000-00-00 00:00:00.000000"
+ switch len(b) {
case 10, 19, 21, 22, 23, 24, 25, 26: // up to "YYYY-MM-DD HH:MM:SS.MMMMMM"
- if str == base[:len(str)] {
- return
+ if string(b) == base[:len(b)] {
+ return time.Time{}, nil
}
- t, err = time.Parse(timeFormat[:len(str)], str)
+
+ year, err := parseByteYear(b)
+ if err != nil {
+ return time.Time{}, err
+ }
+ if year <= 0 {
+ year = 1
+ }
+
+ if b[4] != '-' {
+ return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[4])
+ }
+
+ m, err := parseByte2Digits(b[5], b[6])
+ if err != nil {
+ return time.Time{}, err
+ }
+ if m <= 0 {
+ m = 1
+ }
+ month := time.Month(m)
+
+ if b[7] != '-' {
+ return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[7])
+ }
+
+ day, err := parseByte2Digits(b[8], b[9])
+ if err != nil {
+ return time.Time{}, err
+ }
+ if day <= 0 {
+ day = 1
+ }
+ if len(b) == 10 {
+ return time.Date(year, month, day, 0, 0, 0, 0, loc), nil
+ }
+
+ if b[10] != ' ' {
+ return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[10])
+ }
+
+ hour, err := parseByte2Digits(b[11], b[12])
+ if err != nil {
+ return time.Time{}, err
+ }
+ if b[13] != ':' {
+ return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[13])
+ }
+
+ min, err := parseByte2Digits(b[14], b[15])
+ if err != nil {
+ return time.Time{}, err
+ }
+ if b[16] != ':' {
+ return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[16])
+ }
+
+ sec, err := parseByte2Digits(b[17], b[18])
+ if err != nil {
+ return time.Time{}, err
+ }
+ if len(b) == 19 {
+ return time.Date(year, month, day, hour, min, sec, 0, loc), nil
+ }
+
+ if b[19] != '.' {
+ return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[19])
+ }
+ nsec, err := parseByteNanoSec(b[20:])
+ if err != nil {
+ return time.Time{}, err
+ }
+ return time.Date(year, month, day, hour, min, sec, nsec, loc), nil
default:
- err = fmt.Errorf("invalid time string: %s", str)
- return
+ return time.Time{}, fmt.Errorf("invalid time bytes: %s", b)
}
+}
- // Adjust location
- if err == nil && loc != time.UTC {
- y, mo, d := t.Date()
- h, mi, s := t.Clock()
- t, err = time.Date(y, mo, d, h, mi, s, t.Nanosecond(), loc), nil
+func parseByteYear(b []byte) (int, error) {
+ year, n := 0, 1000
+ for i := 0; i < 4; i++ {
+ v, err := bToi(b[i])
+ if err != nil {
+ return 0, err
+ }
+ year += v * n
+ n = n / 10
}
+ return year, nil
+}
- return
+func parseByte2Digits(b1, b2 byte) (int, error) {
+ d1, err := bToi(b1)
+ if err != nil {
+ return 0, err
+ }
+ d2, err := bToi(b2)
+ if err != nil {
+ return 0, err
+ }
+ return d1*10 + d2, nil
+}
+
+func parseByteNanoSec(b []byte) (int, error) {
+ ns, digit := 0, 100000 // max is 6-digits
+ for i := 0; i < len(b); i++ {
+ v, err := bToi(b[i])
+ if err != nil {
+ return 0, err
+ }
+ ns += v * digit
+ digit /= 10
+ }
+ // nanoseconds has 10-digits. (needs to scale digits)
+ // 10 - 6 = 4, so we have to multiple 1000.
+ return ns * 1000, nil
+}
+
+func bToi(b byte) (int, error) {
+ if b < '0' || b > '9' {
+ return 0, errors.New("not [0-9]")
+ }
+ return int(b - '0'), nil
}
func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Value, error) {
@@ -167,6 +276,64 @@ func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Va
return nil, fmt.Errorf("invalid DATETIME packet length %d", num)
}
+func appendDateTime(buf []byte, t time.Time) ([]byte, error) {
+ year, month, day := t.Date()
+ hour, min, sec := t.Clock()
+ nsec := t.Nanosecond()
+
+ if year < 1 || year > 9999 {
+ return buf, errors.New("year is not in the range [1, 9999]: " + strconv.Itoa(year)) // use errors.New instead of fmt.Errorf to avoid year escape to heap
+ }
+ year100 := year / 100
+ year1 := year % 100
+
+ var localBuf [len("2006-01-02T15:04:05.999999999")]byte // does not escape
+ localBuf[0], localBuf[1], localBuf[2], localBuf[3] = digits10[year100], digits01[year100], digits10[year1], digits01[year1]
+ localBuf[4] = '-'
+ localBuf[5], localBuf[6] = digits10[month], digits01[month]
+ localBuf[7] = '-'
+ localBuf[8], localBuf[9] = digits10[day], digits01[day]
+
+ if hour == 0 && min == 0 && sec == 0 && nsec == 0 {
+ return append(buf, localBuf[:10]...), nil
+ }
+
+ localBuf[10] = ' '
+ localBuf[11], localBuf[12] = digits10[hour], digits01[hour]
+ localBuf[13] = ':'
+ localBuf[14], localBuf[15] = digits10[min], digits01[min]
+ localBuf[16] = ':'
+ localBuf[17], localBuf[18] = digits10[sec], digits01[sec]
+
+ if nsec == 0 {
+ return append(buf, localBuf[:19]...), nil
+ }
+ nsec100000000 := nsec / 100000000
+ nsec1000000 := (nsec / 1000000) % 100
+ nsec10000 := (nsec / 10000) % 100
+ nsec100 := (nsec / 100) % 100
+ nsec1 := nsec % 100
+ localBuf[19] = '.'
+
+ // milli second
+ localBuf[20], localBuf[21], localBuf[22] =
+ digits01[nsec100000000], digits10[nsec1000000], digits01[nsec1000000]
+ // micro second
+ localBuf[23], localBuf[24], localBuf[25] =
+ digits10[nsec10000], digits01[nsec10000], digits10[nsec100]
+ // nano second
+ localBuf[26], localBuf[27], localBuf[28] =
+ digits01[nsec100], digits10[nsec1], digits01[nsec1]
+
+ // trim trailing zeros
+ n := len(localBuf)
+ for n > 0 && localBuf[n-1] == '0' {
+ n--
+ }
+
+ return append(buf, localBuf[:n]...), nil
+}
+
// zeroDateTime is used in formatBinaryDateTime to avoid an allocation
// if the DATE or DATETIME has the zero value.
// It must never be changed.
diff --git a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate.go b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate.go
index 1d2a3e9fb..5f4b8598f 100644
--- a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate.go
+++ b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate.go
@@ -24,5 +24,6 @@ type Generate struct {
Server *generate.Server `command:"server"`
Spec *generate.SpecFile `command:"spec"`
Client *generate.Client `command:"client"`
+ Cli *generate.Cli `command:"cli"`
Markdown *generate.Markdown `command:"markdown"`
}
diff --git a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/cli.go b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/cli.go
new file mode 100644
index 000000000..a3d9d7e2a
--- /dev/null
+++ b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/cli.go
@@ -0,0 +1,23 @@
+package generate
+
+import "github.com/go-swagger/go-swagger/generator"
+
+type Cli struct {
+ // generate a cli includes all client code
+ Client
+}
+
+func (c Cli) apply(opts *generator.GenOpts) {
+ c.Client.apply(opts)
+ opts.IncludeCLi = true
+ opts.CliPackage = "cli" // hardcoded for now, can be exposed via cmd opt later
+}
+
+func (c *Cli) generate(opts *generator.GenOpts) error {
+ return c.Client.generate(opts)
+}
+
+// Execute runs this command
+func (c *Cli) Execute(args []string) error {
+ return createSwagger(c)
+}
diff --git a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
index d88f348c1..7fc4d48d1 100644
--- a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
+++ b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
@@ -22,8 +22,9 @@ import (
)
type serverOptions struct {
- ServerPackage string `long:"server-package" short:"s" description:"the package to save the server specific code" default:"restapi"`
- MainTarget string `long:"main-package" short:"" description:"the location of the generated main. Defaults to cmd/{name}-server" default:""`
+ ServerPackage string `long:"server-package" short:"s" description:"the package to save the server specific code" default:"restapi"`
+ MainTarget string `long:"main-package" short:"" description:"the location of the generated main. Defaults to cmd/{name}-server" default:""`
+ ImplementationPackage string `long:"implementation-package" short:"" description:"the location of the backend implementation of the server, which will be autowired with api" default:""`
}
func (cs serverOptions) apply(opts *generator.GenOpts) {
@@ -82,6 +83,8 @@ func (s Server) apply(opts *generator.GenOpts) {
opts.Name = s.Name
opts.MainPackage = s.MainTarget
+
+ opts.ImplementationPackage = s.ImplementationPackage
}
func (s *Server) generate(opts *generator.GenOpts) error {
diff --git a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go
index ae122ea5d..242d133a6 100644
--- a/vendor/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go
+++ b/vendor/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go
@@ -120,6 +120,9 @@ It aims to represent the contract of your API with a language agnostic descripti
case "markdown":
cmd.ShortDescription = "generate a markdown representation from the swagger spec"
cmd.LongDescription = cmd.ShortDescription
+ case "cli":
+ cmd.ShortDescription = "generate a command line client tool from the swagger spec"
+ cmd.LongDescription = cmd.ShortDescription
}
}
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/bindata.go b/vendor/github.com/go-swagger/go-swagger/generator/bindata.go
index 22c332eb3..8f6945d18 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/bindata.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/bindata.go
@@ -1,9 +1,16 @@
// Code generated by go-bindata. DO NOT EDIT.
// sources:
+// templates/cli/cli.gotmpl (4.991kB)
+// templates/cli/main.gotmpl (536B)
+// templates/cli/modelcli.gotmpl (384B)
+// templates/cli/operation.gotmpl (7.937kB)
+// templates/cli/registerflag.gotmpl (3.239kB)
+// templates/cli/retrieveflag.gotmpl (1.386kB)
+// templates/cli/schema.gotmpl (4.211kB)
// templates/client/client.gotmpl (5.319kB)
// templates/client/facade.gotmpl (3.83kB)
// templates/client/parameter.gotmpl (15.048kB)
-// templates/client/response.gotmpl (10.424kB)
+// templates/client/response.gotmpl (10.428kB)
// templates/contrib/stratoscale/client/client.gotmpl (3.591kB)
// templates/contrib/stratoscale/client/facade.gotmpl (2.078kB)
// templates/contrib/stratoscale/server/configureapi.gotmpl (7.309kB)
@@ -12,7 +19,7 @@
// templates/header.gotmpl (432B)
// templates/markdown/docs.gotmpl (14.106kB)
// templates/model.gotmpl (700B)
-// templates/schema.gotmpl (6.259kB)
+// templates/schema.gotmpl (6.529kB)
// templates/schemabody.gotmpl (14.007kB)
// templates/schemaembedded.gotmpl (1.006kB)
// templates/schemapolymorphic.gotmpl (2.125kB)
@@ -26,11 +33,12 @@
// templates/serializers/schemaserializer.gotmpl (679B)
// templates/serializers/subtypeserializer.gotmpl (6.461kB)
// templates/serializers/tupleserializer.gotmpl (2.34kB)
+// templates/server/autoconfigureapi.gotmpl (8.584kB)
// templates/server/builder.gotmpl (18.855kB)
// templates/server/configureapi.gotmpl (7.308kB)
// templates/server/doc.gotmpl (1.52kB)
// templates/server/main.gotmpl (6.138kB)
-// templates/server/operation.gotmpl (3.752kB)
+// templates/server/operation.gotmpl (3.756kB)
// templates/server/parameter.gotmpl (29.44kB)
// templates/server/responses.gotmpl (12.038kB)
// templates/server/server.gotmpl (23.073kB)
@@ -113,6 +121,146 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil
}
+var _templatesCliCliGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6f\xdb\x36\x10\xc0\x9f\xcd\x4f\x71\x15\xd6\xc2\x0a\x1c\x69\x7f\xde\x3c\xe4\x21\x75\xba\x2e\xdb\x9a\x04\x4b\xd6\x3d\x14\x05\xca\x48\x27\x99\x8d\x44\x0a\x24\x65\xd7\x13\xf4\xdd\x07\xfe\x91\x25\x39\x71\xec\x62\x1b\xf6\xe4\x88\x3c\x1d\xef\x8e\x77\xbf\x3b\x25\x8e\x61\x21\x52\x84\x1c\x39\x4a\xaa\x31\x85\xfb\x0d\xe4\xe2\x54\xad\x69\x9e\xa3\xfc\x11\x2e\xae\xe1\xea\xfa\x0e\xde\x5c\x5c\xde\x45\x84\x90\xa6\x01\x96\x41\xb4\x10\xd5\x46\xb2\x7c\xa9\xe1\xb4\x6d\xe3\x18\x9a\x06\x12\x51\x96\xc8\xf5\xce\x5e\xd3\x00\xf2\x14\xda\x96\x10\x52\xd1\xe4\x81\xe6\x68\x84\xa3\xb7\xc8\xaf\x2b\xad\xa2\x45\xc1\x6e\xfc\xb2\x91\x89\x63\xb8\x5b\x32\x05\x19\x2b\x10\xd6\x54\x8d\xed\xd2\x4b\x04\x6f\x18\x68\x21\x8a\xc8\xc8\xbf\x49\x99\x66\x3c\x07\xbd\x7d\xaf\xb4\x87\x57\x52\xac\x10\xb2\x5a\x5b\x55\x4b\xe4\xb0\x11\x35\x48\x3c\x95\x35\x1f\x69\xea\x8e\xb0\x1e\x50\x9e\x12\xc2\xca\x4a\x48\x0d\x53\x02\x00\xc6\x5a\xf7\xac\x20\xba\xc0\x8c\xd6\x85\xbe\xf4\xcf\x6d\xfb\x48\x62\xb0\x65\xf7\x82\x9c\xe9\x65\x7d\x1f\x25\xa2\x8c\x55\x95\x7d\xf7\x43\x9c\x88\x7b\x49\x03\x32\x19\xee\xe4\xe2\x54\x54\xc8\x69\xc5\x62\x59\x73\xcd\x4a\xdc\x2f\x60\xcc\x0e\xc8\x64\xa9\x75\xa5\x25\xe5\xca\x9a\xfa\xbc\xb2\x38\x29\x18\x72\x1d\x90\xd0\x46\x38\xc5\xfb\x3a\x87\xac\xa0\x39\x30\x9e\xb2\x84\xfa\xf8\x51\x0d\x49\xc1\x40\x2d\x45\x5d\xa4\x20\x6a\x5d\xd5\xda\x0b\x17\x22\x57\x64\x45\xa5\x7f\xbc\x17\xa2\xb0\xaa\x0a\x91\x5f\x98\x95\x0c\xd6\x92\x69\x54\xbd\x38\x68\x01\x4a\xa7\xa2\xd6\x24\xab\x79\xd2\x4b\x4e\x33\x21\x4b\xaa\x41\x69\xc9\x78\x3e\x83\x15\x44\x51\xc4\xb8\x46\x99\xd1\x04\x9b\x36\x84\x86\x4c\x58\x06\x2f\xac\xaa\x86\x4c\x26\x12\x75\x2d\x39\x99\xb4\x64\x52\x88\x3c\xba\x91\x8c\xeb\x4e\xcd\x0c\x56\x51\x14\x85\xc4\xe5\x4e\x49\x1f\x70\x61\x7d\x85\x44\x70\xa5\x65\x9d\x68\x05\x14\x9c\xff\x20\xee\x3f\x63\xe2\xed\xe9\x45\xa7\x49\x99\xc2\x89\xbd\x96\x68\xe1\x52\x60\x06\x54\xe6\x0a\x3e\x7c\x74\x46\x86\x30\x3d\x71\x2a\xa2\xa6\x81\x8a\xaa\x84\x16\xec\x2f\x84\xe8\x8a\x96\x26\x6f\x67\x80\x52\x0a\x69\x2d\x5f\x0a\xa5\x39\x2d\xd1\xae\xc1\xfc\x0c\x92\x32\x8d\x7e\x2a\x68\xae\xa6\x61\xf4\x16\xf5\xad\xd5\x38\x0d\x3a\xb9\x20\xb4\xde\x1a\xe1\x17\x67\xc0\x59\x01\xbd\xcb\xe6\xd1\xea\xb1\xbe\xab\x64\x89\x87\xf5\x3a\xa9\xa3\xb5\x92\x89\x55\x36\xca\xa6\xe8\x0a\xd7\xd3\xde\x0f\xef\xb9\xcf\xfd\xd7\x54\xe1\x0d\xd5\xcb\xd9\x36\x3a\x8d\x3b\xb2\x0d\xc9\x84\x4c\x9a\xe6\x14\xe2\x13\xa8\x15\x4a\x5f\x87\x29\x66\x8c\x23\x24\xb5\xd2\xa2\x84\x12\x53\x46\xf5\xa6\x42\xf8\xf2\xe5\x4b\xfc\x59\x09\x0e\x94\xa7\xa6\x1e\x25\x02\x53\xc0\x05\x48\xcc\x99\xd2\x28\x31\x05\xc1\x51\x99\x44\x5a\x52\x9e\x16\x18\xc1\x49\xdc\xb6\x64\x12\xc7\xa0\x50\x77\x1a\x2b\x29\xd2\x3a\x41\x69\xf5\x98\x5b\xaf\x4b\x8b\x07\x63\x83\xad\xf3\xd4\x19\x6e\x95\x19\x03\x41\x52\x9e\xa3\xe1\x94\x95\xb5\xb5\x3a\x19\xac\x9f\x17\xc5\x2d\x4a\x66\xaf\x58\xfa\x5d\xeb\x17\xcb\x7c\xd2\x2e\x04\xd7\x94\x71\x05\xd1\x3b\xe3\xce\x9d\x71\x27\x30\xbe\x04\x4e\x5a\x76\xba\xa5\xfa\x10\x18\xda\xf5\x62\x6d\x1b\x7c\x84\x33\xf0\x85\x19\xfd\x72\x7b\x7d\xd5\xc9\x4e\xc3\xee\x20\x2c\x14\x3a\x4d\x71\x0c\x6b\x2a\x39\xe3\xf9\xbc\xf3\x4d\xc1\xae\x46\x17\x37\x0d\xaa\xae\xcc\xf5\xed\x32\xdc\x16\xf5\x06\xf5\x56\xbb\xe3\xf1\xf8\xa1\xe7\xf4\x20\x12\x37\x2e\xb4\xaa\x17\xff\x17\x43\xe4\x95\x1f\x15\xa2\x4e\xf6\x50\x88\xaa\xce\xe0\xff\x36\x44\xa4\xf3\x35\xba\xc5\xa4\x96\x4c\x6f\x2e\x4c\x92\x33\xcd\x04\x77\xd1\xa0\xb5\xa9\x10\x5f\xa9\x06\x35\xe7\xb5\x5e\x5e\xf2\x4c\xfc\x69\x30\x29\x0d\x72\x8e\xae\x7b\xd9\x95\x9e\xd1\x81\x5c\x5b\x60\x0b\x0e\x67\x60\x4e\x19\x5d\x1d\xad\xaa\x45\xc1\x2c\x1d\x5c\xd1\x9a\x4a\x96\x33\x73\x27\x59\xb9\x2d\xe1\xd0\x72\xd4\xd3\x38\xb8\x45\xb9\x42\x09\xb5\x2c\xe6\xf0\x72\x35\x8f\xe3\x97\xab\x60\x06\x1d\x6c\x3a\x0c\x84\xa4\xb3\xcd\x9d\x31\x33\x36\x7a\xea\xbe\xa3\x0f\xf8\xbb\x10\x7a\x51\xa6\xe0\x84\x94\x2d\x3c\x29\x84\x36\x98\x72\xc0\x1d\x48\x4d\x2d\x50\xc7\xc0\xed\x09\x2a\xbd\xaa\xf9\x19\xbc\x1a\x09\x99\x00\xfd\xa1\x70\x6e\xda\xaa\xb9\x60\x4f\xdf\x60\x66\xc3\x14\xc7\x5b\x72\xc0\x3d\x55\x2c\xb1\x1d\x4e\x6d\xf5\x45\x37\x28\x95\xd9\xe6\xba\xc3\xe6\x23\x16\xef\xc2\xee\x67\xa1\xf4\x0c\xb6\xfb\x20\x32\x37\x39\xa0\x5c\xb1\xc4\x42\xf6\xb0\x72\x0f\xe4\x5d\xd5\xb7\x76\x59\x7d\xf8\xf6\xe3\x0c\xcc\xdd\xdc\x56\xae\xad\x05\x8b\xa5\x10\x0a\x21\x93\xa2\x34\x17\xb2\xef\xc5\x30\x24\xd6\xe7\x44\xf0\x8c\xe5\xb5\xc4\x41\x5b\x7f\xce\xac\xd7\x42\x14\xef\xa9\x9c\xbe\xb2\xe2\x33\x08\xec\x6f\x30\x83\x8c\x16\x0a\x67\x10\x3c\xea\xfb\x81\x3f\x69\x1b\x5d\xe5\x93\xbe\x0b\xf0\xa1\x62\x18\x80\x63\x9f\xc8\x24\x3e\x81\xa6\x89\x2e\x50\x25\x92\x55\x66\xbd\x6d\x4f\x62\xb2\x85\x4a\x74\xa9\x5e\x9b\x3b\x35\x25\x60\x5f\x38\x1c\xf7\x5a\xc9\x60\x06\xfd\x0f\xca\xae\xdd\x1e\x7e\xb7\x5a\xa7\xe6\xa5\xee\x87\x2a\xb5\x16\x32\x0d\x42\x3b\xd2\xf5\xfc\x71\x86\x9d\xdf\x5c\xfe\x8a\x9b\xaf\xb0\xac\x69\x6c\xea\x9a\xcc\x85\x80\x0b\x6e\x92\xe3\xd3\xae\xf7\x9f\x9e\x3e\xec\xda\x9c\xf3\x3d\xf8\x36\xb8\x05\x9f\x5f\x3e\x92\x72\xbd\x62\xc7\x0d\x33\xc2\x6e\x1f\x86\xc8\x8b\x63\xa0\x69\x0a\xb4\x28\x40\x54\x66\x48\x36\xdc\xc9\xa5\xa8\x2b\x45\x06\xb7\x7a\xdd\xed\xbd\xb5\x5b\x66\xee\x77\xb7\xfe\x8d\x18\xed\x2c\xca\xf4\x3d\x95\xb6\x6c\xe7\x67\xe0\x12\x1e\x82\xb1\xcc\xcb\xd5\xa2\x4c\x03\x98\xee\x4c\x59\x61\x87\xe0\xfd\x2a\xfd\x1c\xd6\x11\x77\x6c\xd4\x93\x73\x9b\x45\xd1\xd1\x18\xf6\xf7\x7a\x9e\xa6\x9e\x47\xd3\x03\xe6\x84\x64\x80\x66\xaf\xd2\x6b\xd9\xe2\xf3\x40\xed\xb8\x71\x6a\x23\xea\x4d\x4d\xf9\x1c\x24\xae\x85\x7c\x70\x9f\x3a\x8a\xf1\x04\x41\x55\x68\x66\xd9\x4d\x37\x66\x95\x75\xa1\x59\x55\xa0\xed\x0d\x9e\xe2\x2a\x02\x32\x31\x77\xcf\x11\x53\x3b\x4f\xa5\xa8\x31\xd1\xb0\x5e\xb2\x64\x69\xe6\x22\x37\xaf\x99\x3c\xc7\x14\x24\x35\xd3\x98\xf9\x1e\xe0\xfd\xed\x5b\xf0\x95\x91\x1d\xc0\xfc\xa0\x3d\x6e\x69\x86\xfc\x92\xe1\x0a\x95\x41\xbe\x43\xc3\x76\x24\xb3\x83\x38\x18\x7d\xc6\x2a\xc6\x33\xe1\xbe\x17\x64\x3f\x8b\x3f\x6e\x90\x3b\x33\x79\x08\xd3\x6e\x24\x70\x73\xfb\xf8\x8d\x41\x07\x71\xe9\x7c\x80\x38\x7b\x80\xb3\x8f\x37\xc3\x62\x73\xdd\xc5\xb9\xe2\x0a\x6e\x83\xc7\x15\xdd\xf3\xe4\x78\xc0\xcd\xa1\xe9\xbe\x47\xc7\xf1\x79\xeb\xd6\xc6\x13\x7e\x7f\xf2\x0e\x8e\x9a\x26\xba\xe4\xf6\xcf\x07\xdc\x84\x2e\x4d\x9f\xb0\x7c\x0f\x86\xe8\x90\x42\xc7\x04\x65\x3c\xcb\x0d\xcd\x1f\x1d\xfc\x04\xa6\x46\xa0\x22\xfd\xcc\xfa\x14\x8b\xb6\x49\x76\x2c\x13\x9e\x1b\x4f\xfe\x07\xae\x7d\xd5\x28\x34\xf9\x4d\x98\xab\x30\x1d\x05\x86\xf9\x0d\x6d\xfb\xc9\x4e\x4a\x4f\xc4\xaa\xef\xd3\xbd\x19\x07\x9c\x3a\xde\x9f\x23\x10\xdd\x34\x03\x35\xfe\xff\x41\xf6\x7f\x47\xff\x90\xd9\x07\xe2\xba\x97\xe5\x07\x31\x7e\xb0\x11\x39\xbc\x6f\x5f\x84\xa6\x89\x4f\x76\x5a\xa8\x61\xe9\xdf\x01\x00\x00\xff\xff\x4d\xd5\xf7\x02\x7f\x13\x00\x00")
+
+func templatesCliCliGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliCliGotmpl,
+ "templates/cli/cli.gotmpl",
+ )
+}
+
+func templatesCliCliGotmpl() (*asset, error) {
+ bytes, err := templatesCliCliGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/cli.gotmpl", size: 4991, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x59, 0xe, 0xf5, 0x2, 0x22, 0x69, 0xd, 0x70, 0xe1, 0x58, 0x86, 0x7, 0x56, 0x68, 0x61, 0xd3, 0x7e, 0x5, 0x2a, 0xe0, 0xe1, 0x99, 0x3a, 0xe2, 0x9f, 0x9, 0x5c, 0x5f, 0x25, 0x5a, 0x91, 0xd}}
+ return a, nil
+}
+
+var _templatesCliMainGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x90\xbf\x6e\xdb\x30\x10\xc6\x67\xdd\x53\x7c\xf5\x24\x01\xb1\x84\xae\x0e\x3c\xd9\x1e\x32\xb4\x29\x0a\xbf\x00\x2b\x9d\x64\x36\xe2\x9d\x41\x9d\x9a\x18\x02\xdf\xbd\x90\xe2\x06\xb5\xb3\x91\xfc\xfe\xe1\xc7\xaa\xc2\x4e\x1b\x46\xc7\xc2\xd1\x19\x37\xf8\x75\x41\xa7\xeb\xe1\xd5\x75\x1d\xc7\x47\xec\x9f\xf1\xfd\xf9\x88\xc3\xfe\xe9\x58\x12\xd1\x34\xc1\xb7\x28\x77\x7a\xbe\x44\xdf\x9d\x0c\xeb\x94\xaa\x0a\xd3\x84\x5a\x43\x60\xb1\x3b\x6d\x9a\xc0\xd2\x20\x25\x22\x3a\xbb\xfa\xc5\x75\x8c\xe0\xbc\x10\xf9\x70\xd6\x68\xc8\x29\x5b\xb1\xd4\xda\x78\xe9\xaa\xdf\x83\xca\x8a\x00\xcc\x85\xef\x86\x01\xe5\x9e\x5b\x37\xf6\xf6\x74\xbd\xa7\xf4\xc9\xf1\x9f\x54\x10\x55\x15\x8e\x27\x3f\xa0\xf5\x3d\xe3\xd5\x0d\xb7\x70\x76\x62\x5c\xe9\x60\xaa\x7d\x39\xfb\x0f\x8d\x37\x2f\x1d\xec\x23\x17\x16\x82\x73\xd4\x3f\x8c\x76\xb4\xa5\xea\xc4\x82\x8b\x8e\x88\xbc\x8e\xa3\xdc\x34\xfd\x9b\x58\xbe\xc1\x49\x43\xd4\x8e\x52\x2f\xa8\x79\x81\x89\xb2\xa8\x6a\xbb\xd0\x3c\x70\x8c\xd8\x6c\x51\xf7\xbe\xfc\xe6\x5e\xf8\xe7\xfb\x73\x5e\x50\xe6\x5b\xcc\xe2\x97\x2d\xc4\xf7\x73\x24\x6b\x83\x95\x3f\xa2\x17\xeb\x25\x5f\xed\x42\x83\x5a\x65\xb0\x38\xd6\xe6\x55\x66\xb3\xc6\x0d\x56\x0f\xf3\xa9\xa0\x2c\xd3\xa1\x3c\xbc\x79\xcb\xbf\x16\x94\x25\xca\x3e\x1a\x37\x5b\x5c\xd7\xcb\xc3\x1b\xd7\xa3\x71\x5e\x3c\xde\x6f\xdd\x86\xd3\xdf\x00\x00\x00\xff\xff\xde\xfb\x8a\xb2\x18\x02\x00\x00")
+
+func templatesCliMainGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliMainGotmpl,
+ "templates/cli/main.gotmpl",
+ )
+}
+
+func templatesCliMainGotmpl() (*asset, error) {
+ bytes, err := templatesCliMainGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/main.gotmpl", size: 536, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x37, 0xbe, 0xdf, 0x69, 0x98, 0x2a, 0xe8, 0x6a, 0x64, 0x8b, 0x4, 0xc7, 0x9b, 0x5b, 0x8, 0x76, 0x75, 0x5a, 0xaf, 0x37, 0x11, 0x2f, 0xba, 0xfe, 0xa7, 0xf4, 0xd0, 0x73, 0xdb, 0xb4, 0xeb, 0xa0}}
+ return a, nil
+}
+
+var _templatesCliModelcliGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x90\xbd\x6e\xc3\x30\x10\x83\xe7\xdc\x53\x10\x9e\xda\x21\x16\x8a\x8e\x1d\x93\x0c\x59\x9a\x25\x2f\xa0\xc8\x67\x59\xa8\x7e\x0c\xf9\xdc\x20\x10\xf4\xee\x85\x8d\xb4\x48\x3a\x12\xa4\xc8\x4f\xa7\x14\x76\xa9\x63\x58\x8e\x9c\xb5\x70\x87\xcb\x0d\x36\x6d\xa7\xab\xb6\x96\xf3\x07\xf6\x27\x7c\x9e\xce\x38\xec\x8f\xe7\x96\x88\x4a\x81\xeb\xd1\xee\xd2\x78\xcb\xce\x0e\x82\x6d\xad\x4a\xa1\x14\x98\x14\x02\x47\xf9\xe7\x95\x02\x8e\x1d\x6a\x25\xa2\x51\x9b\x2f\x6d\x19\xc6\x3b\x22\xa5\x70\x1e\xdc\x84\xde\x79\xc6\x55\x4f\xcf\x04\x32\x30\xee\x08\x90\x94\x7c\xbb\xe4\x0f\x9d\x13\x17\x2d\xe4\xef\x5d\x58\x67\xc6\x9c\xbe\x19\xfd\x2c\x6b\xd5\xc0\x11\xb7\x34\x23\xf3\x36\xcf\xf1\xa9\xe9\x77\x62\x65\xd5\xb1\x23\x22\x17\xc6\x94\x05\x2f\xb4\x59\x7e\xb6\x8a\x09\xed\x9e\x7b\x3d\x7b\x39\xde\x75\xad\x04\x00\x8f\x89\x07\x6b\xd3\x58\x27\xc3\x7c\x69\x4d\x0a\x6a\x1a\xfb\xb7\x77\x65\xd2\x25\xeb\x86\x5e\xd7\x7b\x09\x87\xd1\x2f\xab\x4d\x48\x1d\xfb\xc9\x0c\x1c\xb4\xf1\xae\x41\x5b\xeb\x4f\x00\x00\x00\xff\xff\x2e\xaa\x8d\x88\x80\x01\x00\x00")
+
+func templatesCliModelcliGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliModelcliGotmpl,
+ "templates/cli/modelcli.gotmpl",
+ )
+}
+
+func templatesCliModelcliGotmpl() (*asset, error) {
+ bytes, err := templatesCliModelcliGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/modelcli.gotmpl", size: 384, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x13, 0x36, 0xaa, 0xee, 0x83, 0xa6, 0x29, 0x4e, 0xeb, 0x7e, 0x9d, 0x1a, 0xb3, 0x91, 0x72, 0xe9, 0xd, 0x81, 0xde, 0xe, 0x13, 0x93, 0xb7, 0x70, 0x61, 0xf7, 0x75, 0xcc, 0xef, 0x76, 0x54, 0xa1}}
+ return a, nil
+}
+
+var _templatesCliOperationGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x59\x4b\x73\xe3\x36\x12\x3e\x8b\xbf\xa2\xa3\x72\xa6\x44\x95\x86\xaa\xad\xbd\x39\x35\x87\x89\xed\x9d\xf5\x61\x6c\xd7\x78\x92\xc3\xa6\x52\x1b\x88\x6c\x52\x58\x93\x00\x03\x80\xd2\x28\x2c\xfe\xf7\xad\x06\xc0\x97\x44\x79\x3c\x8f\xdd\x93\x4d\x3c\xba\x1b\xdd\x5f\x3f\xb5\x5e\xc3\x95\x4c\x10\x32\x14\xa8\x98\xc1\x04\x36\x07\xc8\xe4\x6b\xbd\x67\x59\x86\xea\x27\xb8\xbe\x87\xbb\xfb\x8f\x70\x73\x7d\xfb\x31\x0a\x82\xa0\xae\x81\xa7\x10\x5d\xc9\xf2\xa0\x78\xb6\x35\xf0\xba\x69\xd6\x6b\xa8\x6b\x88\x65\x51\xa0\x30\x47\x7b\x75\x0d\x28\x12\x68\x1a\xba\xfa\x1a\xd6\xcb\x8f\xf7\xd7\xf7\x97\x90\x48\x10\xd2\xc0\x96\xa9\x24\x26\xf6\x71\xce\xa1\x7c\xca\x96\xeb\xa6\x09\x4a\x16\x3f\xb1\xcc\xae\x05\xc1\x7a\x0d\x1f\xb7\x5c\x43\xca\x73\x84\x3d\xd3\x63\x41\xcd\x16\xc1\x4b\x0a\x46\xca\x3c\xa2\xf3\x37\x09\x37\x5c\x64\x60\xba\x7b\x85\x95\xa6\x54\x72\x87\x90\x56\xc6\x92\xda\xa2\x80\x83\xac\x40\xe1\x6b\x55\x89\x11\xa5\x96\x85\x7d\x12\x13\x49\x10\xf0\xa2\x94\xca\xc0\x22\x00\x00\x7a\xab\xfb\xd6\x10\x5d\x63\xca\xaa\xdc\xdc\xfa\xef\xa6\x39\x39\x31\xd8\xb2\x7b\xf3\x8c\x9b\x6d\xb5\x89\x62\x59\xac\x75\x99\xfe\xed\xef\xeb\x58\x6e\x14\x9b\x07\xb3\xe1\x4e\x26\x5f\xcb\x12\x05\x2b\xf9\x5a\x55\xc2\xf0\x02\xcf\x1f\x20\xb1\xe7\xc1\x6c\x6b\x4c\x69\x14\x13\xda\x8a\xfa\x3c\xb1\x75\x9c\x73\x14\x66\x1e\x84\x56\xc3\x05\x7b\xc2\xfb\x92\xde\xcc\xa5\xa8\xeb\x92\xe9\x98\xe5\xfc\x2f\x84\xe8\xc1\xd9\xc2\xda\x71\xb0\x7c\xc7\x0a\x84\xa6\xb9\x2a\x12\x50\x68\x2a\x25\x34\x30\x88\x8b\x04\x8c\x84\x2d\x13\x49\x8e\x20\x5b\x7a\x16\x1b\xac\xc0\xd1\xcd\x20\xad\x44\xfc\x2d\x7c\x17\x21\x2c\x96\x56\x73\xd1\x95\xb3\xd2\x0a\x50\x29\xa9\x42\xa8\x83\x19\x89\x72\xf9\x06\x5e\x8d\x0e\xd4\xc1\x6c\xf6\x8b\xc6\x4b\x32\x42\x5d\x77\xc4\xe6\xab\x60\x36\x7b\xdc\x4a\x65\x2e\xe1\x0f\x82\xab\x8e\x59\x89\x3f\xb3\xf8\xc9\xf0\xf8\xc9\xda\x58\xc7\x8a\x97\x24\x63\xd3\xfc\x41\xa7\x3f\x54\xe2\xe6\x12\x54\x25\xbe\x46\xf8\x55\x30\x6b\x82\x60\xc6\x53\x92\x97\xa4\x54\x98\x71\x6d\x50\x7d\x0d\xb1\x07\xa6\x58\xf1\x8f\x9c\x65\x7a\x11\x17\x49\xf8\x93\xa5\xf9\xc3\x1b\x10\x3c\xa7\xe7\x3a\xe3\xd0\x97\xd5\x8e\xe3\xec\x17\xe3\x22\x59\xd1\x4e\x60\x5d\x13\x2e\x3a\x83\xbd\x53\xb2\x2a\x49\xb0\x96\x37\xd9\x6b\x74\xc2\x6e\xb6\x96\x1c\xed\x3c\x3c\x65\x6f\x73\xce\xf4\xf0\xba\x5b\x68\x1a\x42\xda\x39\x9d\x1d\x73\x3f\x7a\xee\x80\x75\xd3\x40\xa5\x51\x5b\xb4\xa5\xf4\x70\xc2\x5c\xcc\xf2\x9c\xe2\x4c\x29\xb9\x30\xc0\x4a\xee\xf0\xf5\x3d\xb8\x91\x5e\xe1\x18\x69\x4c\x65\x1a\x7e\xfb\x5d\x1b\xc5\x45\x16\x3a\xe0\xd5\xc1\x8c\x95\xe5\x55\xce\x57\xad\x61\x09\xde\x57\xd6\xd1\x16\x56\xd9\x74\x2b\xec\x2c\xef\xac\x04\x03\x33\x79\x0b\xcd\x48\x4f\x68\x14\x47\x0a\x57\x39\xcb\x60\xc7\xf2\x0a\x35\xa4\x4a\x16\xf6\xdd\x4c\x24\x14\xd8\x72\x28\xc9\xfc\x3a\x98\xb9\xbf\xc4\x93\x80\x7d\xa4\xf7\xe8\x0e\xf7\xa7\xe0\xf1\xd8\xd1\x8b\xd0\x06\x66\xc5\x44\x66\xd1\x66\x09\x35\x4d\x2b\xe6\x0a\xfe\xed\x30\xea\xe4\xf9\x66\x75\x4e\xa2\x98\x00\xbc\x70\x6f\x58\xc1\x7c\xbe\x82\x67\xb0\xec\x95\x44\x32\xbb\xc4\x02\x75\xbd\x5e\x3a\xb9\x6d\xfa\x98\xf9\x80\x06\x0a\xff\xac\x50\x1b\xab\x2d\x43\xe1\xbe\x54\x84\x0e\x85\xba\xca\x8d\xcf\x46\x2d\xc2\x9d\x25\x81\x6b\x9b\x08\x7a\x81\x05\x2b\xd0\x51\xed\xfd\xd5\xd1\xf9\x1a\x6f\xfd\x60\x59\x2f\x1c\x4c\x22\x92\xe0\xf4\x2a\x19\x6c\xf2\xb2\x57\x10\xd0\x35\x4a\xc1\x6f\x2b\xb3\x95\x8a\xff\x85\x49\xd3\x58\x47\xee\x52\x6d\xf8\x19\xdd\x0d\xc2\x82\x73\xfe\xf5\x92\xdc\x85\x1e\x63\xbd\x89\x8c\x8d\x7c\x87\x80\x2c\xde\x42\xca\x31\x4f\x40\xa6\x1e\x6c\x56\x1b\x93\x88\x71\x2e\xf7\xbf\x07\x4a\x01\xcb\xe9\x98\x73\xac\xb9\x11\xbd\x07\x0f\xaf\xb8\x48\x1e\x14\xa6\xfc\x93\xb7\xb9\x5d\x39\x72\xf0\x10\x16\xd6\xa5\x57\x1b\x29\xf3\xb0\xb6\x0a\x7b\x9b\x24\x68\x93\x4a\xca\x72\x8d\xc1\x8c\x54\x70\x41\xde\xf9\x68\xd4\x28\x1e\xf6\x3b\xbf\x92\xdb\xfe\xca\xec\xb6\xc5\x4c\x0a\xf3\x1f\x77\x76\x75\x0e\x8b\x71\x4e\x0c\xed\xd5\x99\x43\xa5\x14\xf9\x01\x34\x1a\x0b\x46\xab\x76\xb2\x78\xa5\x51\x75\xab\x44\xbf\x03\x66\x5c\x24\x91\x4b\x02\x61\x74\xb5\x25\xbb\x24\x0b\x4a\x71\x9d\x7c\x4d\x33\xb7\x79\xb1\xc5\xce\xad\x7e\x50\xbc\xe0\x86\x8c\xec\xf9\x82\xc1\xa2\xcc\xa9\xea\x99\x97\xed\x5e\x6b\x4c\x35\x87\xa8\x7b\x1a\xe6\x1a\x3d\x91\xb7\x4a\xb1\x43\xeb\x82\xae\xb0\x63\x49\x02\xac\x75\x27\x23\xa1\x12\x05\x53\x7a\x4b\xf1\x99\x0b\x23\x81\xd1\x15\x27\x38\x39\xea\x9e\x29\xc1\x45\x76\x09\x83\x84\xec\xce\x80\x39\x94\x08\x75\x1d\xbd\x93\x1f\x0f\x25\x36\x0d\x39\x27\xd5\x8c\xba\x2a\xa9\xc2\x39\xae\x54\x6d\x09\x79\x40\x73\x22\xe4\x7b\x56\xc2\xb3\xec\x0a\x56\x7e\x1f\x66\x14\x68\xa2\x5b\xfd\xb3\x4c\x0e\x16\x6d\x10\x3d\xc6\x5b\x2c\x18\x0c\x6d\xab\xdd\x52\xc9\x0e\xb9\x64\x09\xc4\x4c\xc0\x86\x8c\xac\x35\x26\xc0\x85\x8b\xef\xba\xd7\x21\x11\xdd\xa2\x42\x92\xa8\x57\x26\xda\x52\xab\x90\x09\xe6\x74\xb0\x8a\x5d\x98\x63\xc6\xb0\x78\xeb\x08\x0d\xdc\xd5\xbe\xfd\x03\xb2\x04\xc6\xa0\x68\x79\x8c\x12\x4b\xc7\xc4\xc1\x62\x8c\xe4\xa6\x79\x34\xaa\x4b\x70\x43\xdc\xbd\x43\xf3\x68\xa9\x9d\x22\x2f\x98\x4d\xe4\xbc\x41\x4c\x5a\xb5\x3e\x35\x73\x6a\x5a\x2f\xef\xa4\x41\x60\x42\x8a\x43\x21\x2b\x0d\x1b\x99\x1c\xc0\x2b\xce\x1b\xc6\x66\x7a\x54\xfe\x79\x13\x72\xba\x64\x48\x10\x78\x78\xca\x28\x9c\x18\xe9\x23\xac\xb5\xbb\x5b\x8d\xea\x1a\x45\x42\xbb\x9d\xe5\xeb\xa6\x17\xf7\xf2\x0d\xfc\x47\x4b\x11\xfd\xd2\xaa\x64\xf1\xdb\xef\x9b\x83\xc1\xc5\xb4\x5e\xc2\x15\xbc\x9a\xd8\x71\xd1\xb8\x0f\xc6\xed\xcb\xd3\xc2\x44\x37\x14\x66\xd2\xc5\x3c\x66\x82\x5e\xd5\xe9\xfe\x8c\xa1\xb8\x18\x82\xf4\x12\x7e\xdc\xcd\xad\x31\xc2\xb1\x0a\x0b\x8a\x83\xd1\xed\x35\xdd\x7c\x03\xbd\xd3\xdf\x55\x79\xce\x36\x39\xa1\xfe\x55\x9f\x40\x27\x44\x1e\xe0\x7a\xc2\x75\xbe\xd2\x4b\xfa\x6c\x4d\xff\x66\xd2\x39\x5d\xcc\xb4\xcf\xb0\x4d\x17\x9f\xce\x3a\xd2\x82\xb8\xb5\x81\x27\xec\x3e\xdf\xb3\x32\x1c\xb8\x18\xbc\x4d\x46\xb5\x61\x69\x2a\x85\x2e\x8f\x69\x52\x21\xd1\x8d\xe0\x36\x85\x52\xe1\x8e\xcb\x4a\xe7\x07\xbb\xd6\x7a\x12\xb5\x99\xb1\x14\xee\xcb\x39\x53\xef\x79\x64\x86\x8d\x3f\x4c\xe9\x83\x0c\x6a\xab\x0b\x85\x95\x46\xd7\x47\xda\x8b\x2b\x90\x66\x8b\x6a\xcf\x35\xf6\xd4\x80\x09\xc0\xa2\x34\x07\x57\xd3\xb5\x1c\x8d\xb4\xf5\x5c\x04\xff\x24\x4f\xb7\xe4\x5d\xda\x75\xaf\x90\x3b\x54\x7b\xc5\x0d\x6a\xe2\x36\x8a\x02\x03\x51\x7c\x99\x18\x41\xe7\x14\x3e\x0f\xbd\xa7\x30\x71\x92\x87\xec\xea\x30\x0f\x8d\x40\x10\x7a\x14\x1c\x51\x70\x7e\x35\xc0\x97\xcd\x3f\x64\xef\xe8\x56\xff\x0b\x95\x5c\x4c\x5c\xa1\x0c\x3a\x49\xea\x25\xd8\xfc\x3a\x0f\xee\xc1\x70\x4f\xb9\xd4\xc5\x45\x6b\x9c\xcd\xc0\xd0\x5d\x94\xec\xd2\xab\x8f\xc3\x5a\x16\xbe\xf4\x26\xb3\x90\x6e\xed\x4a\x6f\x18\x1d\x0d\x94\xbc\x5e\xda\xb4\x37\x7f\x35\x27\x43\x8e\x5f\x69\xe7\x0c\xdc\xb4\x9e\x22\xda\x57\x6e\x30\x66\x2d\x5e\xba\x62\xbf\x40\xb3\x95\x09\xb0\x7c\xcf\x0e\x1a\xf0\x53\x89\xb1\xa1\x54\xe0\x83\x9d\x37\xac\x8d\x98\xac\x2d\x47\xda\xcb\xa3\xca\x67\x91\x28\x59\xb6\x05\xa5\x57\x4c\xe8\xeb\x27\xbd\xb0\x4a\xf5\xae\xd3\xaa\xdd\x6a\xdd\x6b\xf2\xc4\x50\x2b\xdb\x30\x77\x40\x39\x47\xdd\x17\xee\x47\x1d\xce\xb8\xfe\xec\x02\x95\x43\x8e\x7b\x46\xed\x63\x56\x74\x7b\xed\x51\x71\x22\x42\x6f\xd2\x0b\xb2\xc2\x35\x6e\xaa\xec\x04\xd2\x76\xf5\xe7\x83\x41\xfd\x02\x5c\x8f\xc8\xd0\x1b\x87\x11\xff\xbd\x8f\xf7\x9d\x54\x2f\x7f\x55\x2e\x33\x4b\x36\xa5\x44\xe8\x83\xb0\xcf\xf6\x3e\x60\x3b\x77\x5d\x4c\x08\x11\x86\xc3\x58\x19\x8c\xfa\xf7\xb6\x06\x0d\x9e\x6b\x7e\xa8\xc7\xfe\xc6\xf6\xc4\xdd\xd7\x20\x2b\x53\x56\x36\x34\x69\x93\xc8\xca\x8c\xe6\x77\x7e\xc8\x53\x54\xb9\xe1\x65\x8e\xa0\xab\x38\x46\xad\xa9\xb9\x2a\xa5\xd0\x83\xb0\x6e\xbb\x82\x6f\xed\x98\xda\x30\xf1\xe8\xd8\x7c\x68\xb9\xd8\x5b\xae\x11\xb9\xe0\x2b\xb8\xd8\xd9\x4a\xfc\xe8\x14\x35\x06\x56\xb0\xba\xbe\xe0\x4d\x43\xdd\xc3\xc5\xae\xe7\x1b\x8d\x3a\x94\x9d\x6f\x8e\x57\xc3\x18\xd4\x69\x9b\xa8\xdc\x28\xd5\x4e\x9a\xda\xbe\x9f\xa7\xdd\xce\xa0\xc2\x71\xfa\xb2\x67\xc8\xfd\x65\xea\x12\x5e\xe2\x46\x86\xae\x78\xb3\x69\x68\x8f\xb6\x0c\x8c\x99\x36\xab\x61\xa7\xea\x62\x83\x2e\x87\xb1\x66\xcf\xcd\xb6\x1b\x3b\x0e\xf4\x40\x89\xc1\xcf\x66\x7d\xae\xb4\x6b\x3b\xa6\x80\xd3\x31\xb0\x11\x24\x65\x31\xd6\xe4\x61\x5e\xdc\x60\x36\x4b\x7a\x52\x2b\x90\x4f\xa4\x40\x7b\x21\x5a\x2c\xeb\xba\xef\x51\x86\xea\x9a\xb0\x93\xaf\xf1\x7e\x90\x4f\xa3\xe2\xae\x67\xe3\xab\xaa\x01\xb7\xe8\xc1\x97\xc0\x83\xca\xa8\xd0\x54\xf0\xac\xa6\x3c\x71\xe2\x26\x31\x3d\xf5\xca\x71\xb7\xeb\x38\xcf\xa8\xd6\x7a\x20\xa5\xe6\x62\xe1\xdd\xcf\xf1\x0a\xc3\x81\xb8\xd4\x10\xfb\x0b\xd4\x4c\x77\xe5\x0f\xd5\x3f\x77\x52\xb4\x25\x28\x61\xfb\xb2\x2d\x88\xa8\x1e\x72\x90\x39\xa9\x86\x5a\x3a\xde\x99\x47\xff\x1f\x2b\xc8\x17\x3f\x2f\xc1\x72\x30\x65\x69\x0f\x41\x07\xf1\x23\xd5\xba\xf8\x7a\x5e\xb5\xa7\x17\x4f\x4a\xf6\xa3\x8a\xdd\x6b\xe9\x59\xad\xb6\x2f\x9e\x2c\x22\x45\xaf\xcd\x2e\x64\x9c\x57\xe4\x74\x59\x19\x8d\x55\x3a\xf8\x77\x3c\xdf\xb0\xe3\xb4\x67\x46\xac\x5f\x32\x95\xe8\xe7\xad\x1d\x4d\x0d\xd4\xdc\xba\x42\x4d\x20\x26\xae\x35\x1b\x8e\xe7\xfc\x60\xe4\xbb\x8b\x30\x31\x9a\xf4\x31\x09\xea\x67\x87\x7a\x9f\x9d\x3a\x7f\xd9\xa0\xe6\xd9\xb1\xf4\x97\x8e\xf3\xa6\xa6\x53\xad\xac\xd0\x8f\xa9\x52\xa9\x06\xe3\x29\x5b\xd6\xdb\xdf\x7b\x3a\xc9\x3e\x3b\xa7\xfa\xff\x3c\xff\x65\xe3\xa6\x36\x91\x7c\xf1\x7c\x86\x1e\xa1\x98\x91\xdd\x84\xa6\x0d\x0d\x1f\xf0\xcf\x8a\x2b\x4c\xfa\xd4\xd0\xdf\x57\x7e\xef\xcc\xf5\xde\xa1\x5e\x30\xda\x38\x95\xce\xe6\x35\x87\x7c\xfb\xe2\x33\x5c\xa6\x2e\x4c\x1f\x5d\x2f\xe1\xda\xfd\x5c\x58\x30\xf5\xe4\x8b\x70\xaa\xcd\x99\x86\xf6\x29\x2b\xd0\x5c\xc4\xae\x9c\xe6\x22\xe1\x3b\x9e\x70\x96\xfb\x12\x5e\xaa\x61\x4b\xb5\x27\xcf\xdc\xa0\x2f\x3d\x35\x12\x67\x83\xf9\xc1\x57\xd7\xe7\x1b\xdf\xb6\x63\xa5\xde\xc7\x15\xbd\xf0\x25\xb1\xea\x2c\xc4\x07\x1b\x6e\x16\x2b\x95\x2b\x0e\x34\xa5\x4b\x2e\x86\xe3\x9c\x55\xff\xe3\xa4\xd9\x22\x57\x1d\x8e\xad\x85\x46\xbf\x1a\xe8\xde\x5b\x8e\x7d\xe1\xe6\x93\x51\xcc\x19\x50\xb7\xb1\xf3\xc8\x1e\x2e\x38\xc7\x39\xf7\x86\xf0\x42\xda\xff\xd6\x4b\xf0\xf3\x8a\x4e\x18\xdf\x46\xb9\xc1\xa5\xb5\x84\x6d\x98\xb4\xe7\xc1\x14\x82\xdc\x0b\xa7\x9d\x2e\xe0\x6f\x2a\x43\x5d\x97\x5d\x1c\x0d\x97\xd7\x4b\x98\x0e\x5f\xae\x1d\x7c\x1e\x7a\x43\xc9\x07\x27\x7d\x77\x33\xac\x9d\x2d\xb7\xff\x06\x00\x00\xff\xff\xd3\x86\x94\x63\x01\x1f\x00\x00")
+
+func templatesCliOperationGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliOperationGotmpl,
+ "templates/cli/operation.gotmpl",
+ )
+}
+
+func templatesCliOperationGotmpl() (*asset, error) {
+ bytes, err := templatesCliOperationGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/operation.gotmpl", size: 7937, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb7, 0x92, 0x54, 0xc7, 0x93, 0x8c, 0x38, 0xe2, 0x27, 0x5f, 0x72, 0x4c, 0xe6, 0xf4, 0x4d, 0x9b, 0xef, 0xbc, 0x45, 0xcb, 0x9, 0x5d, 0x43, 0xf7, 0xa4, 0xd4, 0x46, 0x82, 0x7c, 0x44, 0x9d, 0x84}}
+ return a, nil
+}
+
+var _templatesCliRegisterflagGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\x5d\x6f\xec\x34\x10\x7d\x6e\x7f\xc5\x21\xdc\xa2\xdd\xaa\x37\x2b\x01\xe2\xa1\x68\x85\x84\x2a\xae\x78\x80\x56\xb4\xe2\x05\x21\xee\x34\x9e\x64\xcd\x26\x76\xae\xed\xec\xde\x25\xca\x7f\x47\x76\x3e\x36\xfb\xad\x4a\xf0\x98\xc9\x78\x3c\x3e\x73\xce\xcc\xd4\xf5\xec\xb6\x72\x32\x47\x5a\xa9\xc4\x49\xad\x2c\x9c\x86\xa9\x14\xb4\x81\xe1\x4c\x5a\xc7\x06\x49\x21\x90\xe6\x94\xd9\xdb\x59\xd3\x5c\x5f\xd7\x35\x04\xa7\x52\x31\x22\x6f\x15\x6c\x13\x23\x4b\x7f\x7a\x45\x26\x42\xd3\x5c\x03\x40\x5d\xbf\xc7\xbb\xb4\xca\xf3\x87\xed\x7f\xdc\xcf\x31\x61\x9b\x50\xc9\x3f\x52\xb2\x74\x32\x59\x5a\xc4\x23\x87\xe9\xf8\xb4\x4c\x11\xff\xc6\x9f\x2a\x69\x58\x74\xe6\x93\x81\xe7\x28\x8d\x54\x2e\x45\xd4\x9f\x88\x71\xb3\x8a\x0e\x1c\x47\xe1\x59\x89\xe1\x6b\x76\xbb\x77\x2b\x89\x47\x95\x6f\xde\x72\x6b\x7b\xe2\x0d\xb7\x22\xa0\xd9\xda\x91\x50\xc1\xb9\xfc\x87\x11\xff\x4a\x05\xa3\x69\xf6\x50\xfb\x58\xd7\x87\xd7\x37\xcd\x47\x5f\x0c\x56\x02\x47\xea\xa2\xa8\xe0\xc3\x82\xe4\x94\xf9\x1b\x7e\x27\xe3\xc3\xf6\xe9\xdf\xac\x7e\xea\x7e\x44\x98\xec\xe6\x32\x94\x64\x45\x06\x21\x8b\x51\x88\xa6\x81\x75\x46\xaa\x2c\x78\xc8\xd4\x53\xe5\xc9\x70\x2a\x3f\x63\x3e\x47\x14\xa1\x1e\x01\x78\x70\x74\x8e\xa8\xae\x87\x17\x47\xc1\xb5\xe1\xdc\xf2\x85\x53\x69\xe1\xe2\xe7\x36\xf5\x49\x74\xb3\x8a\xc7\x41\xee\xb6\x29\x4c\xdb\x80\x67\x20\x12\x9c\x52\x95\xbb\x5d\x94\xf0\xae\x33\x1f\xc5\xe8\xa1\xfd\x77\x19\xa6\x6d\x90\xa6\xf1\x86\xf8\x83\x7e\xd9\x94\x3e\x47\xff\xe5\x59\xd6\x85\x42\xd3\xcc\xbd\x69\xb8\xe7\xcb\x55\x34\xfe\x39\xa4\x8f\x13\x2f\x31\x1d\xe3\x5b\xbd\x1a\x72\xba\x7d\xce\x95\x4c\xc1\x26\xbc\x21\x29\x44\xfc\x0b\x99\xe5\x13\x1b\xeb\x35\xad\x9c\x7f\x4b\x2f\x95\xc9\x31\x02\xf6\x84\x98\x7e\x1f\x82\x7c\x31\x87\x92\x79\x7d\x7d\x75\x65\xd8\x55\x46\x79\xe3\xf5\xd5\x1e\xb8\xb3\x5b\x48\xe5\x58\x09\x16\xbe\x8f\xbc\x32\x2a\xcb\x02\x5a\x79\x96\x54\x89\xc3\x07\x56\xcf\xc9\x82\x0b\xc2\x5a\xba\x05\xe2\x9f\xed\x93\x91\x85\x74\x72\xc5\xad\x1c\x46\xcf\x2a\xfb\x3f\xfb\xef\x1a\x29\x55\x1b\x4c\xf8\xd3\x80\x6d\x24\x95\xfb\xee\xdb\x68\x7a\x60\xfc\xe6\xeb\x7d\x63\x4b\xdb\x7d\x6b\x9a\x6b\x3a\x12\x21\x98\x0f\x63\xbc\x6a\x9d\x47\x43\xe1\x3b\xf6\x38\x2e\xca\x9c\xdc\x89\xe6\x18\x9f\xf5\x1e\x24\x7b\xde\x6d\x4c\xdb\x1d\xcf\xbf\xd0\x96\x7a\xb7\xcc\x76\x32\xf5\x12\x29\xc9\x26\xd4\x96\x78\xa0\xe2\xd9\xca\xdf\x1d\x6d\x4c\x23\x11\x04\x87\x23\x3a\x18\x37\xf4\x6d\xe3\xcb\x2d\xfb\x92\xed\x15\xc1\x6b\xf9\x81\x1c\xbf\x48\xdf\x7b\x82\x38\x66\xb7\x30\x4c\x02\x64\xbb\xe6\xb2\xed\x94\xff\x1b\xc6\xa7\x91\x7b\x0e\x29\x5c\x00\x2a\x8a\xde\x8e\xc5\xe8\xf6\xd9\x0c\x6b\x32\x4a\xaa\xec\x1e\x03\xed\x51\xd7\x21\x4a\xc0\x64\xd4\x3d\xa4\x85\xd2\x0e\xb6\x2a\x4b\x6d\x1c\x0b\xbc\x6e\x90\xe9\xf7\x76\x4d\x59\xe6\x87\x75\x2e\xb1\x61\x37\x1e\x38\x68\x4e\x35\xc1\x42\x0b\xce\xf7\xf4\xd5\x57\xa0\x1b\xfe\x84\xe0\x84\x54\x72\x2e\xe0\x16\xe4\xb0\x20\x0b\x82\x6d\x85\x3c\x9e\x62\x97\x90\xee\x83\xee\xb2\x71\x84\xa6\xbd\x80\x73\x52\x88\xe9\x41\xcb\x61\x4a\x16\x78\xd5\x62\x83\x92\x0c\x15\xec\xb3\xce\xd8\x85\x1c\x5b\xfe\xf8\x6c\x7c\x43\x92\xaa\xac\x1c\xfe\xb6\x5a\xc1\xd0\x7a\x87\x5d\xfb\xa0\x84\x50\xad\xc3\xf1\xfe\x73\xf1\xb1\x21\xb7\x97\xc7\x87\xc7\x7b\x14\xb4\x79\x65\xb8\x05\x83\x3f\x53\x51\xe6\xdc\x5f\xdd\xd5\xb2\xef\xe0\x3f\xe0\x59\x17\xdc\x42\x6d\x21\x74\x5b\xe8\x85\x5e\xa3\x2a\x61\xa5\x4a\x18\x05\x99\x25\x07\x6d\xe8\x42\xfa\x14\xdc\x66\xa8\x40\x17\xbc\xae\x0f\xc1\x7d\x76\xe6\xae\x9b\x05\xfe\xf9\x7e\x18\xd8\x05\xe5\x93\xaf\xea\xda\x8f\xa2\xa7\x65\xe6\x07\x8d\xd3\x4f\x94\x2c\x29\xe3\x70\xaa\xb5\xc6\x75\x1d\x76\x96\x9d\x11\x56\x37\xd3\x7e\xe2\x6f\x87\xc3\x68\xd8\x8f\x66\x44\x3b\x83\xff\x23\x8d\xed\x4c\xfe\xc7\xa0\x2a\xca\xdb\x82\xf6\xa5\xd6\x06\x7f\x8c\x16\x82\x3f\xa1\x53\x6f\x2c\xd0\x2d\x0a\xbb\x0b\x54\x74\xd7\x1d\x9c\x9c\x07\x6f\x3a\x9d\x9e\x93\x50\x60\xcb\x25\x1d\x05\xa7\x73\x0a\x9a\xcd\x40\xa2\x5b\xb5\xc3\x43\x02\xa9\xc3\x8e\x6e\x19\x99\x86\xf3\xe8\x93\x0d\x4c\x0a\x9c\x2e\xc3\xa2\x13\xe3\x65\xc1\x86\x5b\x36\x21\xd3\x5a\x60\x4d\x1b\x4f\x78\xe1\xc5\x50\xf8\x3c\xfd\x11\x6d\x64\x26\x3d\x60\xd6\x19\x24\xe4\xfb\xb1\x82\x2d\x39\x09\x19\x8c\xd6\x85\xa3\x3a\x9d\x08\xa3\xcb\x8e\x1f\x3d\x15\xa6\x83\x6e\xa3\x71\xf1\x4e\xb9\xb6\xdb\xd9\xce\x46\x71\x8e\x34\x03\xe0\xff\x06\x00\x00\xff\xff\x4a\xaf\x91\x38\xa7\x0c\x00\x00")
+
+func templatesCliRegisterflagGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliRegisterflagGotmpl,
+ "templates/cli/registerflag.gotmpl",
+ )
+}
+
+func templatesCliRegisterflagGotmpl() (*asset, error) {
+ bytes, err := templatesCliRegisterflagGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/registerflag.gotmpl", size: 3239, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6a, 0xa3, 0x3c, 0xc, 0x9d, 0xf9, 0x79, 0xf1, 0xb4, 0x75, 0x73, 0x36, 0x49, 0xed, 0x2a, 0x30, 0xde, 0xf, 0x98, 0xbd, 0xdf, 0x2, 0xb9, 0x6f, 0x53, 0xd, 0xc3, 0xb2, 0x12, 0xf2, 0xe4, 0x73}}
+ return a, nil
+}
+
+var _templatesCliRetrieveflagGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x54\x4f\x8f\xd3\x3e\x14\x3c\x6f\x3f\xc5\xfc\xa2\x1f\x28\x59\x6d\x53\x09\x10\x87\xa2\x9e\x40\x54\x2b\xa1\x1e\xd8\xb2\x17\xc4\xc1\x4d\x5f\xb2\x96\x1c\x3b\xd8\x2f\x29\x25\xf2\x77\x47\x4e\x9a\xd0\x7f\x5c\x40\x9b\x53\x34\xf6\x1b\x8f\x67\x46\x6e\xdb\xd9\x6d\xcd\x52\x21\xaf\x75\xc6\xd2\x68\x07\x36\xb0\xc4\x56\x52\x43\xc8\x95\x28\xdc\xed\xcc\xfb\xc9\xa4\x6d\xb1\xa5\x5c\x6a\x42\x54\x59\x59\x4a\x96\x0d\x0d\xfb\x6c\x04\xef\x27\x00\xd0\xb6\x53\xfc\x1f\xa6\x1e\x85\xaa\xe9\x51\x58\xcc\x17\xa8\xac\xd4\x9c\x23\x7a\xd1\x7c\x1c\x56\x22\xc4\x99\x28\x49\xc9\x9f\x84\x74\x25\x4a\x4a\x2e\x18\x02\x7a\x95\x20\x2c\x5c\xcc\x23\x39\x9a\x97\x39\x8c\x45\x4c\xdf\x91\x2e\xcd\x7a\x5f\x11\x22\xa9\xf9\xed\x9b\x28\xb9\x00\x5f\xbf\x3a\x07\x1d\x5b\xa9\x8b\x73\x34\x57\x46\x5c\x61\xe8\xe0\x4b\x8e\x8d\x31\x2a\x1a\xaf\xd4\xcb\x02\x53\x59\x29\xc1\xdd\x94\x28\xb4\x28\xa9\x11\x36\x42\x7a\xb6\xed\xd4\x3e\xef\xef\x40\xb6\x73\x21\x2b\xb7\x69\xb8\xbf\x8b\x93\x74\x49\xdc\xb6\x95\x70\x99\xe8\x2d\xe8\x0f\xf6\x3e\x1e\x08\x06\xf7\xbc\x4f\x46\x72\x99\x77\x54\xff\x2d\xa0\xa5\x6a\x47\x38\x7c\x96\xb8\xb6\x3a\x2c\xdf\x21\x17\xca\xd1\xb8\x7a\xac\x6d\x8a\xd9\x2d\x2c\x65\x5d\xe6\xd8\xec\x91\x19\xdd\x90\x0e\xbd\x81\x74\x28\x91\x1b\x8b\xf7\x9f\xee\xd1\x55\x66\x98\x2b\xd3\xb6\xc5\x91\xd6\x2e\x2e\xef\xb1\x18\xb2\x4a\xef\xdd\xaa\x56\x4a\x6c\x54\xc0\x5f\x06\x94\xf4\x16\xde\x5f\x71\x63\xcc\x98\x94\xa3\xee\x46\xa7\xd1\xe5\x25\xa7\x1f\x04\xd3\x5a\x86\x92\x78\x8f\xd0\xf0\x25\x71\x57\x65\x34\x81\x08\xc2\xa1\x0f\xf9\x0e\xfc\x44\x1a\x95\xb0\x81\x8b\x4f\x54\xff\x7d\x60\x0f\x6c\xff\x94\xd9\x43\x77\xec\xf3\x86\x74\xa1\x27\xe8\x38\x38\xb3\xa2\xdd\x60\x4e\x9c\x4c\x6e\x6e\x0e\x87\xcd\x17\xd7\xe6\xd2\x2f\xba\x14\xd6\x3d\x09\xb5\xa6\x1f\x1c\x7f\xfd\xb6\xd9\x33\xc5\xd7\x2f\x9c\x24\xef\xfe\x51\x76\xfa\x99\x32\x0a\x6f\x4a\x30\xc5\xfb\xe7\xeb\xcc\x51\x78\xb3\x19\x76\xc2\x6a\xa9\x8b\x39\xc6\x47\x2d\x68\xe9\x35\x84\xbf\x43\xb5\xbc\x0f\x05\xd7\x86\xe1\xea\xaa\x32\x96\x69\x1b\xfa\x5f\x98\xa9\xdb\x89\xa2\x20\x8b\x4c\x49\xec\x89\x7f\x9f\xd5\xa9\x09\xcf\x66\xff\xf7\x2b\x00\x00\xff\xff\x82\xbc\xd6\x39\x6a\x05\x00\x00")
+
+func templatesCliRetrieveflagGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliRetrieveflagGotmpl,
+ "templates/cli/retrieveflag.gotmpl",
+ )
+}
+
+func templatesCliRetrieveflagGotmpl() (*asset, error) {
+ bytes, err := templatesCliRetrieveflagGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/retrieveflag.gotmpl", size: 1386, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa9, 0x1d, 0x75, 0x5e, 0x98, 0x0, 0x3d, 0xce, 0xa2, 0x95, 0x31, 0x80, 0x4a, 0xfe, 0x86, 0x4d, 0xdf, 0x29, 0x99, 0xe0, 0x5a, 0x7a, 0xf9, 0x9b, 0xd6, 0x3, 0x62, 0xc3, 0x65, 0xd4, 0xc0, 0xbb}}
+ return a, nil
+}
+
+var _templatesCliSchemaGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x57\x4b\x6f\xdb\x46\x10\x3e\x5b\xbf\x62\x2a\x24\xa8\x65\xc8\xd4\xdd\x85\x0f\x86\x83\x04\x3d\xb4\x16\xd2\x20\xf7\x15\x39\xa4\xb6\x5a\xee\xb2\xb3\x4b\x29\x2a\xc3\xff\x5e\xcc\x2e\x9f\x7a\xd9\x71\x83\x20\x3a\x89\x9c\xdd\x79\xcf\xf7\x0d\xab\x6a\x71\x53\x3a\xa9\x20\x2d\x75\xec\xa4\xd1\x16\x9c\x81\x0c\x35\x92\x70\x08\x84\x99\xb4\x0e\x09\x84\x4e\x80\xd0\x91\xc4\x2d\x0e\xce\xa6\x86\x40\x40\x6e\x12\x54\x37\x8b\xba\x9e\x4c\xaa\x0a\x12\x4c\xa5\x46\x98\xfa\xb7\x36\x5e\x63\x2e\x62\x25\xa7\x50\xd7\x13\x00\x00\xb6\x68\x4d\x8e\x90\x95\x82\x12\x6f\xae\x20\xdc\xa2\x76\x40\xa8\x13\x24\xa9\x33\x28\xb5\x2d\x8b\xc2\x90\xc3\x24\x68\xb7\xe0\xf6\x05\xda\x08\x3e\x3d\xbd\x7b\xba\x03\xc2\xdc\x6c\x11\xdc\x5a\xda\xa0\xc7\x5b\x0f\xea\x65\x0a\x86\x20\xfa\xdd\x2e\x49\xe6\xd2\xc9\x2d\xf2\xc3\xa3\xc9\x0b\x85\x5f\x9e\x56\x7f\x63\xec\x5a\x5f\xc2\x05\x70\x98\x17\x8a\xc3\x3d\xf0\x59\x6a\x87\xa4\x85\x9a\x42\xd4\x7b\x0f\xa8\x2c\x0e\x15\x2c\x16\xfc\x36\xfa\x60\x3e\xed\x0b\x16\x3c\x9b\x34\x41\x08\xda\xb4\xe1\x62\x02\xab\x3d\x64\xe6\xd6\xee\x44\x96\x21\x41\xac\x64\x67\x4a\x27\x6c\xa9\xff\x77\x3e\xbf\xbd\xaf\x75\xed\x73\x5c\xda\xa0\xd9\x1f\x0b\x97\x24\xdb\xf7\x5e\x49\x0d\x85\x20\x91\xdb\x41\xed\xaa\xea\x16\xde\xf8\xc7\x3f\x45\x8e\x70\x77\x0f\x91\xff\xc3\x66\x17\x8b\x3e\xaa\x54\x89\xcc\x97\x2d\x36\x79\x2e\x74\x32\xe1\xc8\x3a\x71\x55\x15\xc2\xc6\x42\xc9\x7f\x31\xdc\xaf\xeb\xf7\x7c\xe1\x3a\xce\x93\x25\x61\x2a\xbf\x80\x75\x5c\xe3\x39\xc4\x79\x02\x37\xb1\x59\x91\x88\x1e\x83\xaa\x19\x20\x91\x21\xa8\x26\x57\x55\x05\x24\x74\x86\x10\x3d\x28\xf5\x94\xb6\x09\x5f\x2c\x40\xf8\xe7\xaa\x6a\xb4\x83\xb4\x3e\x9b\x7d\xc3\xb4\xe9\xec\xf3\x09\x7b\x74\x07\x39\x6d\x9e\x1a\x1b\x4b\x32\x05\x92\x93\x68\x5b\x99\x4c\xd9\x17\xce\x42\x1f\x19\xf4\xa1\x0d\x12\x55\xd7\x23\x49\x9b\xb4\x3e\x60\x1f\xe9\xec\x37\xaf\xef\x97\x7b\xd0\x52\x55\x5d\xf3\x10\xba\x92\x34\x8b\xfc\xab\xfa\x84\x97\xcd\x11\x2d\xd5\xc4\x37\xc0\xe2\xa6\x2f\xc5\x68\x10\x51\xc4\x6b\x48\x25\xaa\xc4\x72\x81\xfd\x70\x84\xea\x37\xf5\x3d\x1d\xed\x41\xf9\x5e\x19\xe4\xf3\x55\xad\x06\x23\x77\xcb\xf9\x1d\x8d\xe8\x60\xa0\x8e\xa6\xb2\x68\x4f\x05\x2f\x49\x38\x43\x83\x99\x3c\x54\xfb\x11\xff\x29\x25\xcf\xd5\x81\xfc\x48\x2f\x35\x07\x8f\xd5\x5e\x5d\x1d\xd7\xa1\x35\xe1\xe7\x3f\xb8\xff\x40\x24\xf6\x83\xd6\xdc\x09\xd2\x52\x67\x77\x83\xee\x1c\x43\x83\xf0\x17\x18\xca\xce\xb7\xed\xa8\x6b\xe1\x9c\xe9\x3f\x44\xf1\x2d\x86\x73\x51\x7c\x8b\xd9\x63\xab\x0d\xaa\x70\x99\xcb\xd8\x41\x2c\x2c\x42\x07\xba\xe7\xb1\xf4\xe7\xa8\x58\x78\x75\x75\xe5\x23\xc8\x05\x6d\xa0\x55\x14\x60\xd0\x8f\x8f\x5b\xa3\xc7\xb6\x3e\xac\xd1\xe4\x75\xaa\x7d\x1e\xfa\x11\xea\x78\x2f\x4c\xcb\x72\x93\x31\x68\x4c\x3b\x1c\x0e\x13\xb8\x93\x4a\x41\x69\x11\x3e\xa0\x7e\xd7\x61\xf1\xaf\x16\x96\x22\xde\x88\x0c\xc3\xdc\xce\x3d\x38\xb3\x66\xe1\xa1\x3a\xa0\x7b\x7f\x99\x95\xfb\x83\x3c\xdf\x84\xd6\xa8\x2d\x26\x5c\xe2\x96\x17\x53\xa9\x13\x10\xb0\x42\xc7\xf0\xb0\xe3\x5e\x63\x36\x77\x50\x6c\x32\xd0\x22\xc7\x16\x09\x64\x0a\x6b\x61\x83\xae\x08\xa6\x8d\x17\xd3\x1e\x18\xfb\x68\xee\x21\x6a\xc4\x0d\x15\x0d\xf8\xef\xe8\xe0\x26\x1b\xf1\x55\x27\xf7\x7d\xc8\x94\xd2\xb5\x64\xe0\x94\x96\x1c\x3d\xa7\xa4\x64\xf2\x96\x55\x6c\xc8\x85\x45\x07\x5b\xa1\x4a\xe4\x88\xbd\xa6\x08\x3e\x86\xb2\x38\x2a\xfd\x30\x08\xbd\x0f\x75\x93\x96\x11\xaa\xa1\xbd\xd2\x22\x71\xf0\x29\xe7\x2e\xd4\xc0\x47\x1b\xb5\x78\x17\x2c\x0f\xe9\x6a\x04\x77\x81\xb4\x72\xb8\xf1\x0b\x45\x17\x24\xe3\xe0\xe0\x21\xaa\x2a\xd4\x09\xbf\x6c\x02\xab\x6b\x8f\x80\x2f\xc0\xc4\x6b\x0f\x8a\x73\x58\x19\xa3\x66\x50\xb5\x0d\xf7\x90\x24\x98\x70\xa6\x52\xa1\x2c\x9e\xe5\xc1\x1f\x47\x84\xfc\x43\xa2\x39\x1f\x8a\x45\x8e\x23\xfc\xef\xbc\x7d\x36\x9f\x47\x7b\x41\x9f\xe3\x41\xc6\x02\x55\x76\x76\x1b\x12\x3e\x24\xcd\x31\x71\xce\x9b\x54\xb5\x92\x7a\x48\xae\xc1\xc1\xfb\xfe\xef\xd7\xaf\xe7\x03\xb9\x48\xbe\xf3\x4e\x47\xa0\xe1\x8b\x64\xfa\xfa\x64\xbc\xb8\xe1\x86\x83\xf5\xbd\xbb\xae\x05\xce\x37\x3c\x57\xec\xdf\x67\xe1\x57\xa1\x82\xa4\x76\x29\x4c\xdf\x6e\xdf\x37\x82\x29\x5c\x8f\x73\x39\xeb\x7b\xaa\xb9\xff\x99\xc7\xf7\xa4\x02\x2f\xb9\xa4\x61\xec\x40\x5d\x7b\x0f\x73\x17\xfd\x15\xf4\x5c\x4f\xdf\x6e\x23\xe6\xb9\x26\x85\xd3\x41\x16\x66\xed\x16\x17\xe7\x49\x14\x72\x3b\x8b\x1e\xd7\x5c\xb3\xe4\xfa\x58\x73\x9b\x0b\xf8\x7f\xeb\x49\xa8\xfb\x29\xaa\x1b\xf4\x22\x03\xd7\x8b\x36\x8a\x63\x72\xef\x42\x1d\x6e\x12\x63\xa6\x7f\x2d\xc1\x1f\xad\x15\x97\xac\x77\xeb\xc4\xf7\xb4\x7d\xf8\x89\x16\x3e\x15\xfb\x7d\xa3\x25\xb9\xfe\xd3\xcf\x94\x0e\x4c\x0a\x6d\x59\x67\xb0\x52\x26\xde\xcc\xc1\x4a\x1d\x23\xec\x10\x76\x42\x3b\x66\x01\xc2\xb8\x24\xeb\xbf\x67\x05\x25\x0a\xad\xe5\x7b\x9e\x35\x2c\xba\xd1\x1e\xd3\xf6\x46\xd7\xb6\xa1\xed\xaa\xaa\x67\xc1\x68\x00\xf7\xd5\x01\x4a\x8a\x4b\x88\x38\xfa\x20\x3a\x61\x68\x7e\xa2\xe7\x7f\x08\x24\x8a\x0e\xfe\xe0\x60\x67\xba\x08\x83\xe3\x9d\xa8\x18\xef\x44\x63\x61\xf8\x6a\x65\xc1\x7f\x01\x00\x00\xff\xff\x87\x2a\xa1\x40\x73\x10\x00\x00")
+
+func templatesCliSchemaGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesCliSchemaGotmpl,
+ "templates/cli/schema.gotmpl",
+ )
+}
+
+func templatesCliSchemaGotmpl() (*asset, error) {
+ bytes, err := templatesCliSchemaGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/cli/schema.gotmpl", size: 4211, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xda, 0xaf, 0x33, 0x67, 0xe6, 0xf0, 0x3c, 0xc6, 0x1f, 0x5c, 0xb9, 0xc2, 0xd, 0x4f, 0x90, 0x4c, 0x84, 0x65, 0xf4, 0xe4, 0x7e, 0x25, 0xb7, 0x68, 0x92, 0xb3, 0x37, 0x17, 0x1b, 0x3e, 0xa5, 0x6b}}
+ return a, nil
+}
+
var _templatesClientClientGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x58\x4d\x6f\xdb\x38\x13\x3e\x47\xbf\x62\x5e\xbf\x69\x61\x1b\x8a\xb4\x7b\xd5\x22\x87\x20\xe9\xa2\x39\x34\x09\x6a\x63\x7b\x2c\x68\x69\x24\x11\x91\x48\x95\xa4\xec\xba\x82\xfe\xfb\x82\x1f\x92\x25\xcb\x4e\xba\xd8\xdd\x62\x0f\xbd\xc4\x12\x67\x38\x1f\xcf\xcc\x33\x22\x13\x86\x70\xcb\x13\x84\x0c\x19\x0a\xa2\x30\x81\xcd\x1e\x32\x7e\x25\x77\x24\xcb\x50\xfc\x06\x77\x8f\xf0\xf0\xb8\x86\x77\x77\xf7\xeb\xc0\xf3\xbc\xa6\x01\x9a\x42\x70\xcb\xab\xbd\xa0\x59\xae\xe0\xaa\x6d\xc3\x10\x9a\x06\x62\x5e\x96\xc8\xd4\x91\xac\x69\x00\x59\x02\x6d\xeb\x79\x5e\x45\xe2\x67\x92\xa1\x56\x0e\x1e\x48\x89\x66\x35\x0c\x61\x9d\x53\x09\x29\x2d\x10\x76\x44\x8e\x23\x51\x39\x82\x0b\x05\x14\xe7\x45\xa0\xf5\xdf\x25\x54\x51\x96\x81\xea\xf7\x95\xc6\x5d\x25\xf8\x16\x21\xad\x95\x31\x95\x23\x83\x3d\xaf\x41\xe0\x95\xa8\xd9\xc8\x52\xe7\xc2\xc4\x4c\x58\xe2\x79\xb4\xac\xb8\x50\x30\xf7\x00\x66\x69\xa9\x66\xfa\x97\x72\xf3\xc3\x50\x85\xb9\x52\xd5\xcc\xd3\x6f\x19\x55\x79\xbd\x09\x62\x5e\x86\x19\xbf\xe2\x15\x32\x52\xd1\x10\x85\xe0\x42\xce\xce\x2b\x88\x9a\x29\x5a\xe2\x0b\x1a\x52\x89\xce\xf1\x19\x85\x1d\xc9\x5e\x10\x6f\x49\x41\x13\xa2\xd0\x84\xa9\xab\x64\x32\x92\x10\xdc\x61\x4a\xea\x42\xdd\xbb\xf7\xb6\x3d\x92\x0f\x04\x0b\x53\x8e\x07\xdc\x41\x2c\x90\x28\x94\x40\x80\xe1\x4e\xab\xe7\x75\x49\x18\xfd\x86\x7d\xe5\xe0\xe6\xe9\x1e\xe2\x82\x22\x53\x81\x97\xd6\x2c\xd6\xfb\xe6\x4a\x10\x26\x0d\x94\x2e\xe3\xe0\xd6\xa8\xac\xbb\x75\x1f\x52\x2e\x4a\xa2\x24\xd8\x84\x83\x8f\x98\x51\xa9\xc4\x7e\x01\x56\x73\x85\x62\x4b\x63\x84\xc6\x03\x10\xa8\x6a\xc1\xe0\xad\x95\x34\xbd\xf1\x08\xd4\xc4\x5e\xd4\x3d\xb4\x9e\xee\xaa\xa5\x67\x37\x81\x6b\xd8\x55\x5d\x96\x44\xec\xc1\x74\xe4\xf8\x4d\x8b\xef\x50\xc6\x82\x56\x8a\x72\x66\xba\xb2\x69\x60\x53\xf0\xf8\xb9\x6f\xea\xb1\x42\xdf\xd5\xfa\xa1\x90\x78\x6c\xc3\x08\x5e\x33\xa0\xf7\xb5\x6d\xca\xc5\x59\x7c\x0f\xe4\x59\x86\x9e\xda\x57\xe8\x30\xd2\xd8\xd5\xb1\x32\x18\xbd\x8a\xb8\x07\xe7\x20\xf7\x2c\xfd\xac\xfe\xa3\x0d\x8d\x4a\xc3\x14\x6e\xdf\x74\x70\xce\x65\x89\x2a\xe7\x89\x1c\x86\xe1\xb6\xe8\xe2\xcf\x97\x63\xef\x8f\x95\x26\x18\xe5\x6c\x31\x70\xd1\x95\xd6\xf9\xa0\x4c\xa1\x48\x49\x8c\xaf\xb8\xe9\xb7\xf5\xfa\x8d\x77\xd1\x34\x20\x08\xcb\x10\x82\xde\x95\x69\x61\x2d\xa8\x88\x8c\x49\x31\x04\x73\x5e\x11\x41\x4a\x09\xcb\x93\xd2\x27\x23\x74\x9d\x70\x53\xab\x9c\x0b\xfa\x0d\x35\xee\x3e\x90\x5a\xe5\xf7\x2c\xe5\x47\xe8\xde\xb8\xe5\x4f\x82\x2a\x14\x4d\x83\x2c\xe9\x7b\xe9\x3d\x91\x2b\x25\x90\x94\x94\x65\x1f\x51\x56\x9c\x99\x42\xfb\xb0\x33\xca\x40\x79\xd0\x6d\x73\xe5\xf5\x35\xde\x12\x82\x20\x18\x02\xbb\x38\xf4\x6e\x1c\xa3\x94\x03\x5b\xf3\x43\xfa\x47\x42\x0d\xc2\xe9\x2c\x7d\x18\x75\xad\x79\x30\x73\xeb\xac\x97\xc5\xa1\xff\x2e\x06\x73\xfc\x62\x85\x87\xee\x7a\x9d\xf1\x0b\xcf\xf2\xe9\x64\xb9\xc2\xa5\x9d\x46\xd3\x70\x4f\x12\xb7\x2a\x6a\x61\xd4\x7e\xa7\x42\xaa\x4f\x5c\x24\x30\x3f\x30\xc7\xa9\x2e\xce\xd3\xda\xf8\xfa\x41\xc4\xfe\x2e\x52\x9b\xc1\x39\x27\xb0\xb4\xa0\x2d\x4e\x63\xf1\xb3\x7d\xff\x5e\xfb\x9a\x41\xa9\x0f\x1a\x8f\x77\x8f\x11\xfc\xe1\xbe\x94\x66\x08\x39\x64\x37\x98\x72\x81\x20\x91\x25\x94\x65\x1e\x68\x93\x4e\x74\x7d\x0d\x8c\x16\xc6\x04\xf4\x6b\xfa\x63\xf7\x42\x31\xe6\x0b\x0f\x40\x7f\x68\x79\x05\xd1\x35\xbc\x3d\x33\x1c\xad\xcd\xfb\xbb\xc8\x94\x5d\x50\xa6\x52\x98\xbd\xf9\x32\x3b\x24\x6d\x14\x3e\x98\x99\x38\x55\xb2\xeb\xbd\xda\x13\x51\xf9\x13\x51\x0a\x05\x9b\xea\x6a\xe1\x41\x53\xf0\xa4\x8e\x51\x7e\xc0\x84\x92\xf5\xbe\x42\x39\xde\xf0\xff\xad\xde\x31\x51\xea\xf7\xdf\x72\x26\xeb\xf2\x95\xfd\x53\xa5\x7e\xff\x2a\xce\xb1\x3c\xb9\xc9\x49\x06\x39\x69\x38\x23\x87\xbb\x5d\xfb\x88\x24\x41\x11\xc1\xdb\x93\x05\xb0\xd2\xa6\x3f\x15\x90\xc0\x3d\x7e\x5f\x7b\x47\xee\xb7\xef\x9d\xd6\x3f\xc5\x2c\x13\x48\xc7\xa2\xa8\xa7\x99\x6f\xb7\x39\xf9\x2d\x67\x0a\xbf\xaa\x2e\xfa\xc0\xbd\x3b\x0c\x4d\x2b\xf4\xb2\xf7\xeb\xf5\x93\x5d\xf2\x4d\xeb\x5c\xe8\x6f\xe2\x67\xc3\x2c\xdd\x41\x96\x2d\x86\x66\x8d\x77\x71\xc1\x2b\x35\xe7\xd5\xc2\xbb\x70\x87\xb9\xcb\x02\x59\xa6\x72\xad\x59\x20\x3b\xc9\x2a\x77\xea\x3b\xc9\x14\x81\xb2\x2e\x54\xd3\xe8\xc9\xd5\xb6\x9f\x07\xc4\x46\x21\xb4\x51\x12\xf4\x63\x3e\x58\xd5\x9b\x92\x5a\xf7\x86\x26\x5a\xe5\x7f\x43\x8e\xb8\x53\xdb\x59\x6f\xa6\x6c\xc9\xaa\x16\x82\xd7\x2c\x81\x19\xa3\xc5\xcc\xfd\xfd\xa5\xcf\x64\x44\x78\x14\xc2\xf1\xa9\x69\xae\xce\x58\x35\xae\x9d\x18\xbf\xf4\x76\x7e\xb5\x22\x69\xf5\x7d\xe0\xcf\x06\x4e\x93\x70\x30\x3f\x1a\x35\x47\x56\xbb\x96\x72\x89\xf2\xe7\x71\x82\x9d\x4d\x46\x0b\x17\x5d\x18\x42\xcd\xf0\x6b\x85\xb1\xbe\xbe\x38\xb9\x76\x66\xcc\x99\xbd\x87\x14\xdc\xb9\x7c\x04\x4c\xb8\xd4\x22\x02\x89\x95\xf5\x5b\xf5\x91\x49\xdf\x6e\x68\x82\x89\xaf\xaf\x3c\x85\xbd\xfc\x10\x96\x74\xd1\x10\x06\x66\x1c\xc2\x32\x34\x19\x1f\x02\x71\x59\xbd\x90\xf7\x51\x28\xc3\xbc\x9d\x75\x46\x0b\xbf\xff\x86\x3c\xe0\xee\xe6\xe9\xfe\x9d\xf6\x36\x9f\xbd\x90\x70\x04\xb1\xee\x78\xa6\x80\x6c\x09\x2d\xc8\xa6\x40\x20\xf2\x44\x72\x2e\xf4\x99\x3f\x8d\xfa\xc4\x52\xa0\x2f\xac\xf3\xc5\x62\x80\xa7\xfb\xe4\xda\x12\x48\x92\x62\x56\x13\x91\x44\xc0\x34\xf5\x8b\x62\xef\x03\xd9\x48\x13\xc8\xc4\xbb\x76\xf0\xcc\xf8\x8e\x4d\xc2\x97\x13\x68\xc9\x86\x6f\x31\x02\xc9\x2d\xfa\xba\x00\x10\xf3\x04\x33\xd4\x07\x67\x59\xeb\x12\x97\x32\xd3\x48\xeb\x73\xf6\xca\xce\xb6\x17\x31\x02\x77\xfe\xef\x30\x8f\xec\xbd\x8a\x33\x25\x48\xac\x80\x71\x05\xc8\x52\x2e\x62\x7b\x1f\x96\x28\xb6\x28\x82\xee\xb4\xdc\x9b\x55\x1c\x32\x54\x7d\xa4\x3e\x6c\x6a\x05\x19\x57\x11\xbc\x59\xcf\x7c\x57\x77\x8d\x58\x45\x18\x8d\xe7\xa5\xcc\x46\xf0\xb1\x64\xc8\xa0\xfe\x00\x13\x2e\x41\xe2\x16\x05\x29\xa0\xe2\x52\x52\x5d\xc0\x29\x4a\xae\xe1\xe4\x8e\xaa\x38\x87\x2d\x29\x6a\x1c\xf6\x9a\x3e\xc9\x2f\x1c\x73\xac\x7d\x3b\xcc\x2e\xa9\x0f\x97\x5b\xad\x79\x66\x5c\xc5\x44\xe2\xd1\x91\xe7\x72\xdb\xe3\x74\x34\x6a\x46\x13\xc5\xc4\xd0\xcd\x94\x4b\x3a\x1a\x2a\x96\xad\x93\xcc\xdb\x1f\xcb\xce\x57\x27\xc5\x3f\x4b\xdf\xef\x1e\xb9\x3f\x29\xfe\xef\x51\xfc\xf2\x3f\xc5\xf1\xee\x75\x8c\xed\x61\xdc\x7b\x23\xbd\xd6\x1b\xbc\xe8\x1b\xfd\xf0\x0e\x08\x71\xae\x19\x6d\x6f\xf5\x87\xfb\x20\xb7\xff\x74\xb3\xff\x23\x9a\xde\x74\xfe\xe2\x2d\xd2\x4c\x90\xc1\x39\x04\xae\x0f\xae\xbc\xf6\xcf\x00\x00\x00\xff\xff\x1b\x29\x6e\xa6\xc7\x14\x00\x00")
func templatesClientClientGotmplBytes() ([]byte, error) {
@@ -173,7 +321,7 @@ func templatesClientParameterGotmpl() (*asset, error) {
return a, nil
}
-var _templatesClientResponseGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x3a\x4b\x73\xdc\xb6\xfd\xe7\x3f\x3e\xc5\x2f\x1c\x5b\xb3\xd4\x7f\xc5\x4d\x7a\x54\x46\x87\x58\x52\x9c\x3d\xc4\xf6\x48\xae\x7b\xc8\x64\x32\x10\x09\xed\x22\x26\x01\x06\x00\x57\xde\x72\xf8\xdd\x3b\x78\x90\x04\xf8\x58\x51\x4e\x3b\x9d\xb6\xa7\x25\x09\xe0\xf7\x7e\x63\xeb\xfa\x02\x32\xf2\x48\x19\x81\x28\xcd\x29\x61\x4a\x10\x59\x72\x26\x49\x04\x4d\x83\x36\x1b\x78\x47\x9e\xea\x1a\x4a\x2c\x53\x9c\xd3\xbf\x13\x48\xde\xe1\x82\x40\xd3\x40\x2a\x08\x56\x44\x02\x86\xe9\xf5\x27\xaa\xf6\x1a\x36\xae\x72\x05\x7b\x82\x33\x22\x24\x1c\x70\x5e\x11\x89\x1e\x2b\x96\xce\x42\x5e\xd5\x35\xd0\x47\x20\x7f\x40\x72\xcd\x33\x02\x17\xdf\x41\xd3\xa4\xfa\x89\x32\x55\xd7\x40\x58\x06\x4d\x63\x37\x25\xf7\xe9\x9e\x14\xb8\x7b\xc7\x2c\x83\x95\x77\x32\x6e\x77\x24\x5b\x79\xaf\x04\xc1\x05\x34\xcd\x1a\xea\x9a\xb0\x6c\x00\xc3\xdf\xf1\x24\xa8\x22\x02\x28\x4f\xfe\x66\x9e\x7c\xac\xf6\x21\x86\xf3\x69\xb6\x6b\x04\xa0\xa5\xaa\x01\xff\x64\xb9\x4e\x7e\xc2\xf2\x9e\x17\xe4\xc6\x0a\x43\x6a\xc9\x02\x1c\xb0\x80\x15\x02\xd8\x6c\x80\x32\xaa\xa8\x85\xd3\x0a\x2a\x90\x9e\x93\x1a\x80\x05\x2d\x30\xdb\x91\x0e\xba\x85\xd6\xae\x19\xb4\x58\x3a\x54\xfd\x9a\x5e\x05\x45\x8a\x32\xc7\x8a\x40\x24\x69\x51\xe6\x44\x1a\xc6\x5b\xb2\x0e\x58\x44\x90\x78\x47\x34\x3c\xcb\x2d\x1a\xbd\xc6\xff\x6a\x6a\xb4\x4c\x02\x72\x4e\x51\x13\xbc\x08\xa2\x2a\xc1\xe0\x6c\x52\x3f\x35\xf2\x68\x0b\x4d\xcc\xac\xfc\x26\x15\x56\x95\xd4\x5f\x2f\x41\x1b\xdd\x7a\x8c\xcd\x50\xff\x72\xb6\xc7\xf4\x34\xcd\x25\x78\x76\xcb\xb8\x82\x64\x2b\x7f\x10\x02\x1f\x63\xf7\xaa\xc1\x50\x99\x0a\x5a\x50\x86\x15\x17\x71\xb7\x6d\xcb\x14\x11\x8f\x38\x25\xfd\x27\x6b\xbf\xb1\x7e\x7c\x57\xe5\x39\x7e\xc8\x35\xcb\x67\xbe\xf5\x1e\xb0\x60\x5a\x12\xc9\xf6\x06\x9a\xc6\x51\xb8\x5e\x20\xe2\x9e\xb3\xce\xe5\x06\x1c\x8f\xdd\xc8\x6c\xf8\x80\x8f\x39\xc7\xd9\x25\x58\xa7\x5a\x86\xab\x41\x0d\x42\x9b\xf3\x49\x99\x41\x46\xb4\x40\x1e\x4c\xec\x69\xc3\x95\x75\x18\xab\x3c\xa3\x37\x7d\xd4\x2a\x57\x3b\xfc\x44\x30\x72\x5e\x95\x20\xe4\x74\x90\xdc\x18\xb8\xa5\xa2\x9c\x59\x61\x3d\xe4\x3c\xfd\x9c\xf2\xa2\x20\x4c\x8d\x97\x49\x2e\x89\xd9\x36\x15\x05\x6a\xd8\x57\x05\x66\x81\xe9\xd9\xa0\x83\xe0\x7c\x83\xd4\xb1\x24\x33\x71\x53\x2a\x51\xa5\xca\x8f\x23\x23\x33\xf5\x8c\x54\xc7\xc4\xa1\x03\xcc\x7b\x65\xab\xaa\x90\x15\xa4\xa3\x90\x91\xf5\x29\x86\x91\xaf\x6c\x2e\x20\xb9\x7f\xc2\xbb\x1d\x11\x3f\x72\x51\x60\xb3\x7b\xe8\xe4\x9a\x3f\x41\x99\x82\x28\x1a\x44\x15\x63\x2e\xc1\xf1\x76\xdd\xbe\x1a\xb7\x98\xd9\x31\xb2\x95\x80\xaf\x90\x06\xf7\x6e\xc0\xfd\x2e\x39\x9b\xa6\x32\x84\x16\xbc\x9f\x6f\xa6\x82\xcd\x8c\xc6\x93\xb7\xfc\xa3\xd6\xeb\x38\x24\x8d\x5d\x07\x75\x8e\x31\x8a\x00\x9d\x1f\xbd\xc1\x92\x68\x80\xf1\x70\xc1\x73\xfd\xfe\xe3\x35\xd7\x41\xf4\xcb\xfb\x87\xdf\x49\xaa\x86\x27\xda\xc8\xd0\x34\xe7\x83\x0c\x3a\xbb\xd1\x68\xc0\x7e\xee\xf8\xd2\x67\x73\xa9\x9f\xbc\xd4\xe8\xac\xda\xe7\xb8\x99\x35\x5e\x5d\x52\x98\xd7\x1d\x51\x12\xd4\x9e\x04\x3e\xfb\xc8\x85\xf9\x36\xe5\x3e\x9d\xab\xdb\xea\x41\x57\x09\xc9\x1d\x49\x09\x3d\x10\xd1\x6e\x99\xce\xc9\xb1\xc1\xb8\x8a\xb5\xaf\x18\xbf\x72\x19\x62\x02\x42\xe2\xb9\x16\x1a\x30\x85\xbe\x02\xf1\xad\x10\x5c\xac\x62\xed\xd4\x94\xed\xa0\x46\xff\xe7\x70\x3f\x16\x2a\xb9\x37\xde\xf1\xb8\x8a\x7e\xa9\x6b\xa8\xca\x92\x08\x48\x7e\x26\x6a\xcf\xb3\xd6\xa0\x3e\x60\xb5\x87\xa6\xf9\xf5\x97\xd7\xd9\xaf\x6d\x94\xea\xa2\x49\x60\x7b\x4e\x2d\x15\xfb\xcc\xf8\x13\x03\xa2\xf1\xc2\x6c\xb1\x04\xaf\xff\xff\xd0\x2d\x46\x6b\x98\xaa\xb8\x9e\x91\x4e\x8f\xd3\x0b\xb4\xb3\x08\xd7\xc0\x13\x67\xef\x7d\x09\x85\x8c\x1b\x8c\x7d\xe3\xe5\x62\x7e\x4b\x94\x83\xbe\x8a\xff\x3b\xfc\xc9\x33\x95\x4e\x72\x23\x83\x7c\xb9\xa0\x04\xc1\xd9\x9d\xf3\xa3\x55\x97\x3b\x45\xc5\x14\x2d\x48\x72\x6d\x3a\x80\x76\x7d\x0d\x29\x67\xb2\x2a\x88\xe8\x37\xb8\x0f\x6b\xed\xa9\x05\x56\x52\x1b\xb6\x36\xe5\x3b\xb2\xa3\x52\x89\x63\xdc\x5a\xde\x6c\x1a\xb2\x15\xef\xfe\x98\x09\xd3\x3d\x74\x34\xb8\xa4\x5c\xd7\x2e\xcb\x23\x80\x7d\x26\xa6\x63\xed\xe5\x55\x77\x2e\x79\x4b\x94\x85\xbe\x8a\x3c\x97\x88\x62\x8d\x88\x3e\xce\xc3\xf8\xe6\x4a\xa7\xa5\xa0\x1c\xd4\xec\x1d\x88\xd0\x95\xbf\xab\xd0\xf3\xba\x86\x14\x17\x24\x38\xba\xd6\x3c\x6a\x1a\xac\xe1\xf7\x47\x56\x73\xc8\x62\x4b\x8b\x3e\xf6\xcd\x15\x30\x9a\x3b\xbc\x4e\xc1\x46\x64\x32\xd9\xb2\x03\xce\x69\xa6\x4d\x63\xe5\x39\xff\x1a\x22\x2b\x9b\x68\x0d\x51\x90\x65\xa2\xf5\x2c\x7b\x1a\xa3\xcb\x55\x23\x27\x9e\x96\xc7\xd5\x1c\xbb\x7d\x02\xd4\x96\x6a\xc4\xb4\xa7\x79\xd6\xeb\xf2\x81\xb2\x4c\x07\x37\xa7\x41\xaa\x48\x21\x4d\x24\xf7\xf4\xd1\x49\x73\x8c\x39\x10\xe7\x90\x56\x0d\xdb\xaa\x77\xba\x55\x9c\xe3\xbf\x33\xd0\xe7\x45\x6f\x24\xf5\x55\xa2\x1a\x2f\x8d\x65\xb5\x95\xd7\x95\x54\xbc\xb0\x45\xcc\x62\xd3\x72\xd4\x27\x1f\xb0\x90\xc6\x1a\x6c\xaa\x80\xe8\xf5\x1f\xd1\xb8\x30\x3a\x6d\x07\xff\x1e\xcb\xf3\xfd\x2a\x68\x47\x34\xf7\x9a\xc5\xd5\x8c\x0c\x92\x55\x80\x2a\x8e\x5f\xa8\x9b\xb3\x83\xdf\x61\xd8\xe8\xfa\xcf\xf1\x84\x21\x65\x27\x3a\x99\x0e\xed\xa0\xdb\x74\x87\x23\x5b\x0f\x44\x2f\x27\x6d\x4e\xec\x7f\x9a\xe7\x80\xb5\x93\x91\xec\xb9\xee\xad\xcd\x52\x5d\x9a\x9a\x6b\x1d\x47\x8d\x63\x9b\xa0\xfb\xd8\xd2\xa5\x87\xd2\x15\xcb\x58\xea\x2a\xce\x66\x6b\xd0\x5d\x14\x82\x76\xcd\x0f\x24\x8a\x7f\xc0\xe9\x67\xbc\x23\x86\xee\xe4\x67\x9e\x91\x5c\xba\x4f\x5a\x0a\x7f\x65\x05\x16\x72\x6f\xf4\x9c\x09\x5e\xb6\x4b\x53\x19\x3a\x20\xd1\x34\xe7\x4d\x73\x9f\xd3\x94\x74\x99\xbf\xcb\xa4\xc9\x1b\x9e\x1d\x57\x71\x9f\x39\x17\x86\x9f\x69\x55\xb5\x0d\xc2\x55\xcb\xe1\x38\xbc\xcc\x54\x2b\xcd\x6c\x44\xeb\x61\x32\xf2\xb4\x9a\xaa\x49\xe2\x13\xbd\xff\x74\x3d\x35\xaf\xae\x9e\xfb\xcb\xab\x4e\x26\x6d\x15\x31\x96\x9a\x15\xb6\x46\xb2\x32\x0d\xe6\x34\x73\x53\xc5\x95\x9b\x71\x4c\x57\xad\x8e\xe7\xf8\x7b\x5f\x0f\x67\x67\xed\x1b\xe5\xc9\xed\xfb\x1f\xe7\x14\x33\x3f\x69\xea\x1b\x09\x46\x73\xb4\xac\xf1\xee\x53\xa7\x4b\x9c\x13\xc9\xed\x55\xe7\x95\x7a\x83\x6d\x92\xc6\x65\x52\xef\xf9\x4b\xab\xc0\x57\x7d\x19\xb8\x20\xad\xba\x96\xe5\x44\xa5\x17\x46\xc3\xb5\x4d\x26\xb1\x2b\xfd\xfa\x41\x93\x61\x39\xf9\x84\xf3\x8a\xdc\x7e\x29\x05\x91\xd2\xce\x13\x3e\x69\x9b\xd8\x67\xc2\x59\xaa\x37\x0d\xd4\xbe\x65\x87\xd1\x96\x5b\x4d\x2d\x69\x67\x93\x41\xfb\xf6\x2c\x92\xeb\x75\xa7\x9c\x79\x45\x7a\x8f\x7d\x77\xca\x88\x2e\x50\x33\x78\x38\xc2\x8e\x5f\x48\x9b\x71\xbf\x87\x9b\xf7\xf0\xee\xfd\x47\xb8\xbd\xd9\x7e\x4c\x10\x42\x2e\x3c\x5c\xf3\xf2\x28\xe8\x6e\xaf\xe0\xa2\x69\x36\x1b\x4d\x5a\x37\x45\x09\xd6\xba\x90\x81\x10\x2a\x5d\xcc\xb1\x19\xb7\x0d\x4d\xc6\x32\x3e\xee\xa9\x84\x47\x9a\x13\x78\xc2\x32\x24\xc6\xb4\xcc\x96\x1a\x50\x9c\xe7\x89\xde\x7f\x9b\x51\xa5\x4b\x30\xd5\x9d\x2b\x0c\xc6\x52\xf0\x03\x81\xc7\x4a\x19\x50\x7b\xc2\xe0\xc8\x2b\x10\xe4\x42\x54\x2c\x80\xd4\xa2\x30\x64\x63\x96\x21\x84\x68\x51\x72\xa1\xcc\x88\x3a\xa2\x3c\xd2\x3f\x8c\xa8\xcd\x5e\xa9\x32\xd2\x5a\x88\x76\x54\xed\xab\x87\x24\xe5\xc5\x66\xc7\x2f\x78\x49\x18\x2e\xe9\xc6\x96\x14\xd1\xfc\x06\xd7\x4b\x9c\xd8\x61\x2d\xed\xd4\x86\x27\xbc\x3b\xb1\x6c\x8a\x19\xac\x48\xe4\x4c\xcb\x72\x22\xbb\xe1\xcf\xd6\xbd\xb7\x39\xb2\x5b\xf7\x16\x62\xa3\x87\x49\xef\xb8\x73\x75\xae\x04\x0c\xee\xd9\x9b\x5b\xcc\x4e\xf4\x2a\x41\x92\x13\x73\x3f\x07\xc9\x9b\xfe\xcd\x38\x1e\xf2\x26\xcc\x36\x00\x52\xb6\x6b\x7b\x36\xcb\x93\xbb\xbe\xe8\xef\x2f\x50\x30\x9b\xd1\x9c\xdd\x79\x8d\xa0\xe9\x0a\x35\x37\x92\x88\x83\xee\xf6\xda\xef\x94\x29\xee\xc2\x8f\x09\x2c\xd9\x64\x4a\x79\x71\x1b\x6a\x59\x8d\x03\x1a\xfe\x44\x33\x1a\xc3\xaa\x2b\x09\xea\x61\x1c\xb2\xa2\x6a\xa1\x48\x23\x1e\xf9\x44\x55\xba\xef\x5b\x48\x37\x1d\xaa\x4f\xcc\x51\x3b\x00\x6d\x40\x4f\xb1\x0c\x46\xcc\x97\xae\x30\x12\x44\x56\xb9\xd2\xa1\xed\x99\xeb\xad\xe1\xcd\xd5\xc4\xf8\xbc\xae\xe1\xd5\x48\xda\x4f\x73\x17\x52\x8e\x80\x3e\xdf\x5a\x52\x92\xc9\x96\xbf\x17\xa7\xc9\xba\x63\x34\x6d\xfb\xf4\xfd\xb8\x76\xf1\xd2\x24\xa3\xf9\xda\xe5\x4a\x3b\xb5\x0f\x56\x1d\x63\x5b\x79\x5f\xa5\x29\x91\x5a\x76\x96\x26\x13\x94\xdb\x01\xba\x81\x61\xbf\xf7\xd1\x71\x66\x7e\xea\x1c\x38\xb4\x76\xbb\x6c\x26\xfc\x73\x1b\x3a\x08\xaf\x06\xa6\x00\xed\xa5\xc0\xe5\x74\x61\xbb\x48\xa1\x03\x43\x5a\xac\xdf\x19\xd1\xff\x27\x68\x98\x3e\x8e\xdc\x67\x03\xdf\x7d\xfb\x2d\x5c\x5d\xc1\x5f\xc6\x50\x3c\xb5\x4f\x9b\x8a\x67\x04\x33\xa9\x3a\x0f\xd5\xfd\xbc\x2e\x27\x34\xe9\xa1\x72\x31\xe4\x1d\x79\xfa\xe1\xc3\xd6\x4e\x69\xa3\x2e\x04\xf9\x23\xe9\x8c\x13\x69\x4a\xd2\x02\xeb\xa0\x81\xd9\x11\x06\xfb\x88\x74\x57\xe8\x99\xcb\x03\x54\x6a\xc4\x25\xa7\x4c\x01\x0d\xf3\xac\x2c\x49\x1a\xad\xa1\x57\xd2\x40\x8a\xf1\x9c\xe5\x87\xac\x8e\xc6\xed\xa8\xbf\x91\x1c\x84\xaa\xa0\xb4\x1a\x5e\xf1\x27\xb6\xfc\xe9\x0b\xa1\x79\x2f\x3b\x0d\x67\xe2\x88\x57\xea\xf4\xc4\xdd\x7e\x51\x02\x5b\x4f\x30\xf4\x6d\xe6\x6e\xd1\x7d\x6c\x19\x4f\xdb\x7e\xd9\x10\xec\x84\x79\x59\xe8\xae\x2e\x28\x85\xcd\x75\x8d\x16\x8c\x57\x4d\x1a\x64\x1d\xab\x17\x1e\x51\xfd\x5f\x1f\x66\x4b\x4e\xcd\x7a\x3f\xc5\x30\xcd\x9f\xf9\xd6\x5e\xde\x2f\x2b\x42\x87\x97\x43\x31\x02\x5b\x5c\xb8\x23\x5b\x45\x0a\x79\x43\x4a\x33\x75\xb9\xe6\x79\x4e\x52\x45\x39\xf3\xee\xc2\x82\xf1\xcf\x70\x87\xa3\xf2\x79\x42\xee\x74\xd0\xd0\xd2\x4b\xee\xcb\x9c\xaa\x37\x47\x7b\x7e\xb5\xa8\x5c\x5f\x2f\xa1\x23\x46\xa8\x1d\xfd\xb9\x5b\x42\xc7\xe1\x68\x0c\xe6\x16\xfc\xf9\xa9\x16\xc8\x96\x65\xe4\xcb\x27\x2c\x82\xe1\xf8\x6f\x9d\x2d\xad\x17\xf1\xb9\x35\xbd\x85\x35\xb9\x65\x72\xa9\xd1\xe8\x3f\x09\xb3\x5d\x48\xd7\xc3\x2d\x56\xff\x15\xe0\xb2\x24\x2c\x5b\x24\xe8\xeb\x85\x3c\x5e\xc7\xa6\xe3\xe6\x79\x7e\x51\x95\x9e\x31\x75\x76\x66\xcb\xb7\x81\xe9\x35\x08\x0d\xe3\xe9\x66\xa3\x53\x85\xd6\x02\x48\x6d\x16\xed\x65\xd5\xf8\xb0\x3f\xd1\x9b\x1a\x6b\x1e\x70\xfe\xd5\x13\x4c\x9f\xe7\x29\x8d\xc6\x68\x6a\x90\x32\xc8\x52\x4b\x86\x99\xc6\xca\x7c\x87\x9b\x9a\x6e\x2e\xa0\x26\xbc\x10\x1f\xce\x38\x9f\x01\x70\x6d\x26\xa0\x67\x07\x9c\xc7\xc9\xea\x7c\x6a\xac\x18\x28\x69\x09\xb4\x03\xce\xa7\x07\x94\x61\x22\x0c\x27\xf9\xc1\x85\x87\xaf\x3e\xbd\xcd\x5d\xde\x43\xd4\xde\xf1\x79\x57\x1d\xff\x83\xea\xd2\xda\xfa\x7a\xdd\x9c\xd4\xc5\x38\x98\xcc\x40\x42\x8b\x06\xca\xdd\xa6\x4e\x83\x83\x3f\xff\x4c\xc9\x68\x82\xb5\x69\x40\xc1\xd5\xf5\xeb\xc3\x32\xf1\x87\xcc\xeb\x98\xe3\xa2\x0c\x96\xd3\x51\xa6\x95\xd2\xf4\x9c\xe6\x1f\x01\x00\x00\xff\xff\xcf\x38\x76\x3e\xb8\x28\x00\x00")
+var _templatesClientResponseGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x1a\x4b\x73\xdc\xb6\xf9\x5c\xfc\x8a\x2f\x1c\x5b\xb3\x54\x57\xdc\xa4\x47\x65\x74\x88\x25\xc5\xd9\x43\x6c\x8f\xe4\xba\x87\x4c\x26\x03\x91\xd0\x2e\x62\x12\x60\x00\x70\xe5\x2d\x87\xff\xbd\x83\x07\x49\x80\x8f\x15\xe5\x4c\xa7\xd3\xf6\xb4\x24\x01\x7c\xef\x37\xb6\xae\x2f\x20\x23\x8f\x94\x11\x88\xd2\x9c\x12\xa6\x04\x91\x25\x67\x92\x44\xd0\x34\x68\xb3\x81\x77\xe4\xa9\xae\xa1\xc4\x32\xc5\x39\xfd\x27\x81\xe4\x1d\x2e\x08\x34\x0d\xa4\x82\x60\x45\x24\x60\x98\x5e\x7f\xa2\x6a\xaf\x61\xe3\x2a\x57\xb0\x27\x38\x23\x42\xc2\x01\xe7\x15\x91\xe8\xb1\x62\xe9\x2c\xe4\x55\x5d\x03\x7d\x04\xf2\x07\x24\xd7\x3c\x23\x70\xf1\x1d\x34\x4d\xaa\x9f\x28\x53\x75\x0d\x84\x65\xd0\x34\x76\x53\x72\x9f\xee\x49\x81\xbb\x77\xcc\x32\x58\x79\x27\xe3\x76\x47\xb2\x95\xf7\x4a\x10\x5c\x40\xd3\xac\xa1\xae\x09\xcb\x06\x30\xfc\x1d\x4f\x82\x2a\x22\x80\xf2\xe4\x1f\xe6\xc9\xc7\x6a\x1f\x62\x38\x9f\x66\xbb\x46\x00\x5a\xaa\x1a\xf0\x4f\x96\xeb\xe4\x27\x2c\xef\x79\x41\x6e\xac\x30\xa4\x96\x2c\xc0\x01\x0b\x58\x21\x80\xcd\x06\x28\xa3\x8a\x5a\x38\xad\xa0\x02\xe9\x39\xa9\x01\x58\xd0\x02\xb3\x1d\xe9\xa0\x5b\x68\xed\x9a\x41\x8b\xa5\x43\xd5\xaf\xe9\x55\x50\xa4\x28\x73\xac\x08\x44\x92\x16\x65\x4e\xa4\x61\xbc\x25\xeb\x80\x45\x04\x89\x77\x44\xc3\xb3\xdc\xa2\xd1\x6b\xfc\xef\xa6\x46\xcb\x24\x20\xe7\x14\x35\xc1\x8b\x20\xaa\x12\x0c\xce\x26\xf5\x53\x23\x8f\xb6\xd0\xc4\xcc\xca\x6f\x52\x61\x55\x49\xfd\xf5\x12\xb4\xd1\xad\xc7\xd8\x0c\xf5\x2f\x67\x7b\x4c\x4f\xd3\x5c\x82\x67\xb7\x8c\x2b\x48\xb6\xf2\x07\x21\xf0\x31\x76\xaf\x1a\x0c\x95\xa9\xa0\x05\x65\x58\x71\x11\x77\xdb\xb6\x4c\x11\xf1\x88\x53\xd2\x7f\xb2\xf6\x1b\xeb\xc7\x77\x55\x9e\xe3\x87\x5c\xb3\x7c\xe6\x5b\xef\x01\x0b\xa6\x25\x91\x6c\x6f\xa0\x69\x1c\x85\xeb\x05\x22\xee\x39\xeb\x5c\x6e\xc0\xf1\xd8\x8d\xcc\x86\x0f\xf8\x98\x73\x9c\x5d\x82\x75\xaa\x65\xb8\x1a\xd4\x20\xb4\x39\x9f\x94\x19\x64\x44\x0b\xe4\xc1\xc4\x9e\x36\x5c\x59\x87\xb1\xca\x33\x7a\xd3\x47\xad\x72\xb5\xc3\x4f\x04\x23\xe7\x55\x09\x42\x4e\x07\xc9\x8d\x81\x5b\x2a\xca\x99\x15\xd6\x43\xce\xd3\xcf\x29\x2f\x0a\xc2\xd4\x78\x99\xe4\x92\x98\x6d\x53\x51\xa0\x86\x7d\x55\x60\x16\x98\x9e\x0d\x3a\x08\xce\x37\x48\x1d\x4b\x32\x13\x37\xa5\x12\x55\xaa\xfc\x38\x32\x32\x53\xcf\x48\x75\x4c\x1c\x3a\xc0\xbc\x57\xb6\xaa\x0a\x59\x41\x3a\x0a\x19\x59\x9f\x62\x18\xf9\xca\xe6\x02\x92\xfb\x27\xbc\xdb\x11\xf1\x23\x17\x05\x36\xbb\x87\x4e\xae\xf9\x13\x94\x29\x88\xa2\x41\x54\x31\xe6\x12\x1c\x6f\xd7\xed\xab\x71\x8b\x99\x1d\x23\x5b\x09\xf8\x0a\x69\x70\xef\x06\xdc\xef\x92\xb3\x69\x2a\x43\x68\xc1\xfb\xf9\x66\x2a\xd8\xcc\x68\x3c\x79\xcb\x3f\x6a\xbd\x8e\x43\xd2\xd8\x75\x50\xe7\x18\xa3\x08\xd0\xf9\xd1\x1b\x2c\x89\x06\x18\x0f\x17\x3c\xd7\xef\x3f\x5e\x73\x1d\x44\xbf\xbc\x7f\xf8\x9d\xa4\x6a\x78\xa2\x8d\x0c\x4d\x73\x3e\xc8\xa0\xb3\x1b\x8d\x06\xec\xe7\x8e\x2f\x7d\x36\x97\xfa\xc9\x4b\x8d\xce\xaa\x7d\x8e\x9b\x59\xe3\xd5\x25\x85\x79\xdd\x11\x25\x41\xed\x49\xe0\xb3\x8f\x5c\x98\x6f\x53\xee\xd3\xb9\xba\xad\x1e\x74\x95\x90\xdc\x91\x94\xd0\x03\x11\xed\x96\xe9\x9c\x1c\x1b\x8c\xab\x58\xfb\x8a\xf1\x2b\x97\x21\x26\x20\x24\x9e\x6b\xa1\x01\x53\xe8\x2b\x10\xdf\x0a\xc1\xc5\x2a\xd6\x4e\x4d\xd9\x0e\x6a\xf4\x17\x87\xfb\xb1\x50\xc9\xbd\xf1\x8e\xc7\x55\xf4\x4b\x5d\x43\x55\x96\x44\x40\xf2\x33\x51\x7b\x9e\xb5\x06\xf5\x01\xab\x3d\x34\xcd\xaf\xbf\xbc\xce\x7e\x6d\xa3\x54\x17\x4d\x02\xdb\x73\x6a\xa9\xd8\x67\xc6\x9f\x18\x10\x8d\x17\x66\x8b\x25\x78\xfd\xd7\x43\xb7\x18\xad\x61\xaa\xe2\x7a\x46\x3a\x3d\x4e\x2f\xd0\xce\x22\x5c\x03\x4f\x9c\xbd\xf7\x25\x14\x32\x6e\x30\xf6\x8d\x97\x8b\xf9\x2d\x51\x0e\xfa\x2a\xfe\xdf\xf0\x27\xcf\x54\x3a\xc9\x8d\x0c\xf2\xe5\x82\x12\x04\x67\x77\xce\x8f\x56\x5d\xee\x14\x15\x53\xb4\x20\xc9\xb5\xe9\x00\xda\xf5\x35\xa4\x9c\xc9\xaa\x20\xa2\xdf\xe0\x3e\xac\xb5\xa7\x16\x58\x49\x6d\xd8\xda\x94\xef\xc8\x8e\x4a\x25\x8e\x71\x6b\x79\xb3\x69\xc8\x56\xbc\xfb\x63\x26\x4c\xf7\xd0\xd1\xe0\x92\x72\x5d\xbb\x2c\x8f\x00\xf6\x99\x98\x8e\xb5\x97\x57\xdd\xb9\xe4\x2d\x51\x16\xfa\x2a\xf2\x5c\x22\x8a\x35\x22\xfa\x38\x0f\xe3\x9b\x2b\x9d\x96\x82\x72\x50\xb3\x77\x20\x42\x57\xfe\xae\x42\xcf\xeb\x1a\x52\x5c\x90\xe0\xe8\x5a\xf3\xa8\x69\xb0\x86\xdf\x1f\x59\xcd\x21\x8b\x2d\x2d\xfa\xd8\x37\x57\xc0\x68\xee\xf0\x3a\x05\x1b\x91\xc9\x64\xcb\x0e\x38\xa7\x99\x36\x8d\x95\xe7\xfc\x6b\x88\xac\x6c\xa2\x35\x44\x41\x96\x89\xd6\xb3\xec\x69\x8c\x2e\x57\x8d\x9c\x78\x5a\x1e\x57\x73\xec\xf6\x09\x50\x5b\xaa\x11\xd3\x9e\xe6\x59\xaf\xcb\x07\xca\x32\x1d\xdc\x9c\x06\xa9\x22\x85\x34\x91\xdc\xd3\x47\x27\xcd\x31\xe6\x40\x9c\x43\x5a\x35\x6c\xab\xde\xe9\x56\x71\x8e\xff\xce\x40\x9f\x17\xbd\x91\xd4\x57\x89\x6a\xbc\x34\x96\xd5\x56\x5e\x57\x52\xf1\xc2\x16\x31\x8b\x4d\xcb\x51\x9f\x7c\xc0\x42\x1a\x6b\xb0\xa9\x02\xa2\xd7\x7f\x44\xe3\xc2\xe8\xb4\x1d\xfc\x67\x2c\xcf\xf7\xab\xa0\x1d\xd1\xdc\x6b\x16\x57\x33\x32\x48\x56\x01\xaa\x38\x7e\xa1\x6e\xce\x0e\x7e\x87\x61\xa3\xeb\x0b\x41\x9c\xcf\xd3\x76\x3e\x26\x6e\xae\x9b\xe9\x50\x0f\x3a\x4e\x77\x3a\xb2\x35\x41\xf4\x72\xf2\xe6\x44\xff\xa7\xf9\x0e\x78\x3b\x19\xcd\x9e\xeb\xe0\xda\x4c\xd5\xa5\xaa\xb9\xf6\x71\xd4\x3c\xb6\x49\xba\x8f\x2f\x5d\x8a\x28\x5d\xc1\x8c\xa5\xae\xe4\x6c\xc6\x06\xdd\x49\x21\x68\xd7\xfc\x60\xa2\xf8\x07\x9c\x7e\xc6\x3b\x62\xe8\x4e\x7e\xe6\x19\xc9\xa5\xfb\xa4\xa5\xf0\x77\x56\x60\x21\xf7\x46\xd3\x99\xe0\x65\xbb\x34\x95\xa5\x03\x12\x4d\x83\xde\x34\xf7\x39\x4d\x49\x97\xfd\xbb\x6c\x9a\xbc\xe1\xd9\x71\x15\xf7\xd9\x73\x61\x08\x9a\x56\x55\xdb\x24\x5c\xb5\x1c\x8e\x43\xcc\x4c\xc5\xd2\xcc\x46\xb5\x1e\x26\x23\x4f\xab\xa9\xba\x24\x3e\xd1\xff\x4f\xd7\x54\xf3\xea\xea\xb9\xbf\xbc\xea\x64\xd2\x56\x12\x63\xa9\x59\x61\x6b\x24\x2b\xd3\x64\x4e\x33\x37\x55\x60\xb9\x39\xc7\x74\xe5\xea\x78\x8e\xbf\xf7\xf5\x70\x76\xd6\xbe\x51\x9e\xdc\xbe\xff\x71\x4e\x31\xf3\xd3\xa6\xbe\x99\x60\x34\x47\xcb\x9a\xef\x3e\x7d\xba\xe4\x39\x91\xe0\x5e\x75\x5e\xa9\x37\xd8\x46\x69\x5c\x2a\xf5\x9e\xbf\xb4\x12\x7c\xd5\x97\x82\x0b\x52\xab\x6b\x5b\x4e\x54\x7b\x61\xac\x5e\xdb\x84\x12\xbb\xf2\xaf\x1f\x36\x19\x96\x93\x4f\x38\xaf\xc8\xed\x97\x52\x10\x29\xed\x4c\xe1\x93\xb6\x89\x7d\x26\x9c\xa5\x7a\x13\x41\xed\x5b\x76\x20\x6d\xb9\xd5\xd4\x92\x76\x3e\x19\xb4\x70\xcf\x22\xb9\x5e\x77\xca\x99\x57\xa4\xf7\xd8\x77\xa8\x8c\xe8\x22\x35\x83\x87\x23\xec\xf8\x85\xb4\x59\xf7\x7b\xb8\x79\x0f\xef\xde\x7f\x84\xdb\x9b\xed\xc7\x04\x21\xe4\xc2\xc3\x35\x2f\x8f\x82\xee\xf6\x0a\x2e\x9a\x66\xb3\xd1\xa4\x75\x93\x94\x60\xad\x0b\x19\x08\xa1\xd2\xc5\x1c\x9b\x75\xdb\xd0\x64\x2c\xe3\xe3\x9e\x4a\x78\xa4\x39\x81\x27\x2c\x43\x62\x4c\xdb\x6c\xa9\x01\xc5\x79\x9e\xe8\xfd\xb7\x19\x55\xba\x0c\x53\xdd\xb9\xc2\x60\x2c\x05\x3f\x10\x78\xac\x94\x01\xb5\x27\x0c\x8e\xbc\x02\x41\x2e\x44\xc5\x02\x48\x2d\x0a\x43\x36\x66\x19\x42\x88\x16\x25\x17\xca\x8c\xa9\x23\xca\x23\xfd\xc3\x88\xda\xec\x95\x2a\x23\xad\x85\x68\x47\xd5\xbe\x7a\x48\x52\x5e\x6c\x76\xfc\x82\x97\x84\xe1\x92\x6e\x6c\x59\x11\xcd\x6f\x70\xfd\xc4\x89\x1d\xd6\xd2\x4e\x6d\x78\xc2\xbb\x13\xcb\xa6\xa0\xc1\x8a\x44\xce\xb4\x2c\x27\xb2\x1b\x00\x6d\xdd\x7b\x9b\x23\xbb\x75\x6f\x21\x36\x7a\x98\xf4\x8e\x3b\x57\xeb\x4a\xc0\xe0\x9e\xbd\xd9\xc5\xec\x54\xaf\x12\x24\x39\x31\xfb\x73\x90\xbc\x09\xe0\x8c\xe3\x21\x6f\xca\x6c\x03\x20\x65\xbb\xb6\x6f\xb3\x3c\xb9\x2b\x8c\xfe\x0e\x03\x05\xf3\x19\xcd\xd9\x9d\xd7\x0c\x9a\xce\x50\x73\x23\x89\x38\xe8\x8e\xaf\xfd\x4e\x99\xe2\x2e\xfc\x98\xc0\x92\x4d\xa6\x94\x17\xb7\xa2\x96\xd5\x38\xa0\xe1\x4f\x34\xa4\x31\xac\xba\x92\xa0\x1e\xc6\x21\x2b\xaa\x16\x8a\x34\xe2\x91\x4f\x54\xa5\xfb\xbe\x8d\x74\x13\xa2\xfa\xc4\x2c\xb5\x03\xd0\x06\xf4\x14\xcb\x60\xcc\x7c\xe9\x0a\x23\x41\x64\x95\x2b\x1d\xda\x9e\xb9\xe2\x1a\xde\x5e\x4d\x8c\xd0\xeb\x1a\x5e\x8d\xa4\xfd\x34\x77\x29\xe5\x08\xe8\xf3\xad\x25\x25\x99\x6c\xfb\x7b\x71\x9a\xac\x3b\x46\xd3\xb6\x50\xdf\x8f\x6b\x17\x2f\x4d\x32\x9a\xaf\x5d\xae\xb4\x93\xfb\x60\xd5\x31\xb6\x95\xf7\x55\x9a\x12\xa9\x65\x67\x69\x32\x41\xb9\x1d\xa2\x1b\x18\xf6\x7b\x1f\x1d\x67\x66\xa8\xce\x81\x43\x6b\xb7\xcb\x66\xca\x3f\xb7\xa1\x83\xf0\x6a\x60\x0a\xd0\x5e\x0c\x5c\x4e\x17\xb6\x8b\x14\x3a\x30\xa4\xc5\xfa\x9d\x11\xfd\x7f\x83\x86\xe9\xe3\xc8\x7d\x36\xf0\xdd\xb7\xdf\xc2\xd5\x15\xfc\x6d\x0c\xc5\x53\xfb\xb4\xa9\x78\x46\x30\x93\xaa\xf3\x50\xdd\xcf\xeb\x72\x42\x93\x1e\x2a\x17\x43\xde\x91\xa7\x1f\x3e\x6c\xed\xa4\x36\xea\x42\x90\x3f\x96\xce\x38\x91\xa6\x24\x2d\xb0\x0e\x1a\x98\x1d\x61\xb0\x8f\x48\x77\x8d\x9e\xb9\x3c\x40\xa5\x46\x5c\x72\xca\x14\xd0\x30\xcf\xca\x92\xa4\xd1\x1a\x7a\x25\x0d\xa4\x18\xcf\x59\x7e\xc8\xea\x68\xe4\x8e\xfa\x5b\xc9\x41\xa8\x0a\x4a\xab\xe1\x35\x7f\x62\xcb\x9f\xbe\x10\x9a\xf7\xb2\xd3\x70\x26\x8e\x78\xa5\x4e\x4f\xdc\xed\x17\x25\xb0\xf5\x04\x43\xdf\x66\xee\x26\xdd\xc7\x96\xf1\xb4\xed\x97\x0d\xc1\x4e\x98\x97\x85\xee\xea\x82\x52\xd8\x5c\xd9\x68\xc1\x78\xd5\xa4\x41\xd6\xb1\x7a\xe1\x11\xd5\xff\xfd\x61\xb6\xe4\xd4\xac\xf7\x93\x0c\xd3\xfc\x99\x6f\xed\x05\xfe\xb2\x22\x74\x78\x41\x14\x23\xb0\xc5\x85\x3b\xb2\x55\xa4\x90\x37\xa4\x34\x93\x97\x6b\x9e\xe7\x24\x55\x94\x33\xef\x3e\x2c\x18\x01\x0d\x77\x38\x2a\x9f\x27\xe4\x4e\x07\x0d\x2d\xbd\xe4\xbe\xcc\xa9\x7a\x73\xb4\xe7\x57\x8b\xca\xf5\xf5\x12\x3a\x62\x84\xda\xf1\x9f\xbb\x29\x74\x1c\x8e\x46\x61\x6e\xc1\x9f\xa1\x6a\x81\x6c\x59\x46\xbe\x7c\xc2\x22\x18\x90\xff\xd6\xd9\xd2\x7a\x11\x9f\x5b\xd3\x5b\x58\x93\x5b\x26\x97\x1a\x8d\xfe\x97\x30\xdb\x85\x74\x3d\xdc\x62\xf5\x5f\x01\x2e\x4b\xc2\xb2\x45\x82\xbe\x5e\xc8\xe3\x75\x6c\x3a\x6e\x9e\xe7\x17\x55\xe9\x19\x53\x67\x67\xb6\x7c\x1b\x98\x5e\x83\xd0\x30\x9e\x6e\x36\x3a\x55\x68\x2d\x80\xd4\x66\xd1\x5e\x58\x8d\x0f\xfb\x53\xbd\xa9\xd1\xe6\x01\xe7\x5f\x3d\xc5\xf4\x79\x9e\xd2\x68\x8c\xa6\x06\x29\x83\x2c\xb5\x64\xa0\x69\xac\xcc\x77\xb8\xa9\x09\xe7\x02\x6a\xc2\x4b\xf1\xe1\x9c\xf3\x19\x00\xd7\x66\x0a\x7a\x76\xc0\x79\x3c\x9a\x2b\xa2\xf1\x24\x6f\x09\xb4\x03\xce\x87\xe3\xd3\x89\x4b\xed\xc1\x34\x3f\xb8\xf4\xf0\xd5\xa7\xb7\xb9\x0b\x7c\x88\xda\x7b\x3e\xef\xba\xe3\xff\x50\x5d\x5a\x5b\x5f\xaf\x9b\x93\xba\x18\x07\x93\x19\x48\x68\xd1\x40\xb9\xdb\xd4\x69\x70\xf0\x07\xa0\x29\x19\x4d\xb0\x36\x0d\x28\xb8\xbe\x7e\x7d\x58\x26\xfe\x90\x79\x1d\x73\x5c\x94\xc1\x72\x3a\xca\xb4\x52\x9a\x9e\xd3\xfc\x2b\x00\x00\xff\xff\x8b\xa1\x1d\x6a\xbc\x28\x00\x00")
func templatesClientResponseGotmplBytes() ([]byte, error) {
return bindataRead(
@@ -188,8 +336,8 @@ func templatesClientResponseGotmpl() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "templates/client/response.gotmpl", size: 10424, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
- a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb, 0x12, 0xba, 0xe0, 0x4e, 0x37, 0xb2, 0xf0, 0x5b, 0x83, 0xc4, 0x4c, 0x3c, 0x98, 0x58, 0x1a, 0x3c, 0xfb, 0x9a, 0x3b, 0x3c, 0x96, 0xf5, 0xbd, 0x93, 0x7d, 0xb4, 0xbc, 0xb5, 0xf4, 0xe, 0x57}}
+ info := bindataFileInfo{name: "templates/client/response.gotmpl", size: 10428, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x61, 0x42, 0x46, 0xfe, 0xb3, 0x98, 0x0, 0x91, 0xd5, 0xb7, 0x3a, 0xd2, 0xb6, 0x55, 0xc2, 0x63, 0x67, 0x16, 0xad, 0x6e, 0xbc, 0x14, 0xf5, 0xf8, 0x29, 0x81, 0x47, 0x9e, 0x2d, 0xe7, 0x6, 0xf4}}
return a, nil
}
@@ -353,7 +501,7 @@ func templatesModelGotmpl() (*asset, error) {
return a, nil
}
-var _templatesSchemaGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x58\xdd\x6e\xdc\xb6\x12\xbe\xf7\x53\xcc\xf1\xf1\x39\x90\x0c\x47\xdb\xe6\xaa\x4d\xe1\x0b\x3b\x4e\xea\x14\x68\x1c\xc4\x69\x02\x34\x0d\x02\xae\x38\x5a\x31\xa1\x48\x85\xa4\x1c\x6f\x85\x7d\xf7\x82\x22\xa5\xa5\xb4\xdc\xb5\x5d\xa7\x40\xd0\xd6\x57\x6b\x91\x1c\xce\x7c\xf3\xfb\xb1\x6d\x1f\x00\x2b\x80\x08\x0a\xd9\x33\x7d\x4a\x34\xbe\x5a\xd6\x68\x7f\x3f\xb9\xae\xa5\x32\x48\x21\x11\xd2\xd8\x0f\x97\x4d\x8d\xea\x84\x33\xa2\x53\x58\xad\xf6\x00\xec\x59\x83\x55\xcd\x89\x41\xd8\xd7\x79\x89\x15\x79\x21\xf9\xb2\x92\xaa\x2e\x59\xbe\x0f\x99\xdd\x67\x77\x21\xd7\x68\xaf\x19\x49\x71\x42\x8c\xbd\xae\x6d\xa1\x26\x3a\x27\x9c\xfd\x8e\x90\x3d\x27\x15\xc2\x6a\x65\xbf\xae\xc5\xdb\x7d\x97\xdd\x15\x56\x41\x27\xbb\x6d\x67\x87\xf0\x54\xaa\x4e\x88\x06\x8a\x39\x27\x0a\x29\x10\x0d\x07\x0a\x0b\x90\x02\xb4\xac\x10\xa4\x29\xd1\x6d\x3a\x82\x0f\x8d\x36\xfd\x4e\x30\x25\x3a\x05\x88\x06\x02\x0b\xc9\x89\x58\xc0\x7b\x62\xb5\x43\xfa\xde\x9f\xc0\x6c\x91\xb9\x5d\x27\x70\x0c\xa7\x19\x3c\x97\x50\xa1\x29\x25\x05\x5d\x12\xce\x61\x8e\xa0\xb0\xbf\x3c\x03\x38\x9c\x0d\xf0\x38\x9b\x07\x58\xbb\xef\x30\x36\x6c\xee\x17\x2f\x51\xb1\x0e\x00\x15\x18\xf7\xa6\x44\xd1\x69\xd9\xe9\xb4\xbe\xc6\xaa\x5b\xaf\xa1\xf6\x9a\x52\x2c\x98\x40\x28\x48\x6e\xa4\x5a\x7a\x25\x35\x7c\x66\xa6\x04\x53\x32\xed\xa4\x64\xa1\x82\x28\x68\xc4\x49\x4f\xaa\x39\x52\x8a\x74\xbb\x9f\xfb\x1d\x53\x27\x87\x96\x4b\x65\x65\x3d\x96\x55\xcd\xf1\xfa\x62\xfe\x01\xf3\x2e\x8e\x5e\x35\x35\xef\x22\xec\x84\x52\x66\x98\x14\x84\xbf\x50\xb2\x46\x65\x18\xea\xde\xf0\x57\x17\x67\x17\x49\xa1\x90\xa6\x8f\xa0\x24\x82\x72\x84\x9c\x68\x04\x59\x80\x6e\xe6\x9d\x37\x98\x28\x51\x31\xc3\xc4\x02\x0a\x25\x2b\xb0\x40\x3a\x3f\x75\x06\xc7\xa4\x1f\x01\xd3\xba\x41\xf8\xef\xc3\x87\x0f\xbf\xe9\x61\xf0\x1e\xb1\x96\xfb\xc8\xeb\x63\x92\x15\xe0\x63\x7f\x48\x06\xab\xde\xb0\xaf\x6d\x7b\xa3\xa3\x01\x6c\x97\x05\x0d\x7f\x8c\x3d\xef\x90\x3c\x95\x74\xe9\x51\x74\x9a\x3c\x00\x45\xc4\x02\x21\x1b\xa1\x32\x28\xba\x2d\xa8\xec\xdf\x6c\x16\x49\xa5\xd5\x0a\x16\x68\x74\x17\x46\x6d\x0b\x65\x53\x11\x31\xca\x33\x59\xb8\xe8\x18\x00\xec\x3c\x60\x23\xbb\x5e\x6b\xf0\xb9\x64\x79\x09\x36\x69\x64\x01\x24\x00\xdb\xee\x21\x0b\x6b\x10\x33\x1a\x98\x30\xa8\x0a\x92\x63\x88\x2e\x40\xd1\x88\x1c\x92\xb6\x85\x83\xec\x25\xe6\xc8\xae\x50\x79\xd5\x0e\x47\x0a\x1f\x78\x8d\xd3\xa8\x1d\x49\x1a\x03\x30\xa8\x07\xc3\x7d\x03\x50\xf8\x09\x0e\xb2\x33\xa6\x73\xc5\x2a\x26\x88\x91\xea\x29\x43\x4e\x07\xe3\x83\x13\x00\x0a\x4d\xa3\x44\x77\xb5\x62\xc2\x14\xb0\xff\xbf\x4f\xfb\xd3\xf3\xaf\x09\x6f\x26\x27\xc7\xd1\x1f\x93\x37\x36\x1b\x56\xab\xac\x6d\x73\x52\x61\x68\x5d\xa7\xd8\x54\xaa\xa0\xa1\xd0\xd5\x5e\xe8\xea\x4b\x34\x51\x6f\xeb\xbb\x79\xfb\x1e\x4e\xda\xa2\x41\x72\x45\xf8\x6e\x4f\xa5\x10\xf1\x95\xc0\x3b\xf8\xea\x2e\xa0\xc2\x31\x5c\x11\x7e\x13\xb4\xd1\xa5\xc8\xbf\x36\xfd\xce\xb0\x20\x0d\x37\x9b\xd5\x0a\x1e\x0c\x25\xe6\xdb\xef\xbe\x0f\x93\xa0\x47\x77\x37\xb6\xbd\xad\x29\xfc\x22\x2a\xa2\x6c\x83\xf9\xe9\xf2\xe2\x79\x32\x87\xb7\xef\xe6\x4b\x83\x29\xa0\x52\x52\x05\xf0\x6d\x6f\xa0\xae\xcb\x46\x97\x86\xd3\x57\x44\x81\xd9\x71\x7c\xd8\x68\x73\x49\x29\x78\x74\x0c\x1f\xb4\x14\xd9\xa0\x5d\xe2\xf4\x4a\xda\x36\xcc\x99\xc4\x6e\x1a\x60\x4a\x57\xab\xf4\x08\xfe\x6f\xd2\x1f\x3a\x19\xff\x39\x06\xc1\xf8\x28\x02\x7c\xa6\xa0\x52\x1b\x0e\xd9\x71\xf5\xfc\x1e\x42\x0f\x37\x3d\x71\x1c\xc7\x21\x31\xe9\xde\x44\xa4\x60\x7d\x34\x45\xa2\x64\x5a\x0d\xee\x33\xe1\xec\x45\x64\xb3\x02\x12\x3f\xaf\xbd\xb0\x99\x62\xd8\x95\x6b\xa7\x6e\x6c\xe9\x7a\x6e\xa3\x8d\xac\x9e\x4a\x55\x11\x63\x50\xb9\x11\x2e\xd1\x46\x31\xb1\x78\x2c\x85\x21\x4c\x68\xc8\x7e\x45\x25\x61\x3f\xf9\x6d\x7f\x3f\x4d\xd3\xe8\x6c\xe2\x27\xa1\xe9\x68\xb2\x45\xab\x6e\xba\x9b\x4f\x06\x1d\xdf\xcb\x4e\x38\xbf\x28\xc2\x36\xb6\xab\xc9\x6d\x6b\x73\x5f\xa8\xcf\xf9\x01\x62\xa3\xee\xfd\xdb\x9b\xbe\x96\xde\x74\x6f\x0f\xfd\x0d\x1b\x53\x64\x71\xfd\x61\xdb\xcc\x1c\x1d\xb1\x99\x08\xc6\xb7\xa1\x43\x6d\x74\xba\x00\xa5\x8a\xd4\x17\xea\x92\xb3\x1c\x7f\x44\x5b\x50\xb6\x95\x81\x0d\x60\x37\x2a\xc7\x84\x73\x0c\xd4\x53\xe4\xbc\xa1\xf8\x9a\x70\x46\x2d\xbe\x51\xd2\xd9\x7f\xeb\xb9\x47\xda\x1b\xee\xcb\x94\xa7\x81\x6b\xaa\x06\x54\x76\x03\xbc\xa5\x4d\x1d\x33\xea\x19\xd1\x98\xa1\x59\x0d\x5c\x85\x74\x8c\xe5\xd9\x30\xc3\x5a\x05\x8c\x42\x52\xa5\xa9\x5b\x7c\x89\x9f\x1a\x66\x29\x66\x76\x4e\xb4\xd7\x96\x49\x5b\x4c\xcf\xc9\x50\xaa\xe2\xb5\xd4\x01\x72\xd5\x5b\x38\x86\xd0\x53\xaf\x1b\x94\xb0\x07\x66\x33\xf0\xf7\x22\x78\x61\xd6\x66\x9b\x35\xb1\x94\xea\xf0\x71\x39\xd5\xdd\x0f\xcc\xb2\xb1\x0a\x85\x4f\x43\xd5\x08\xc3\x2a\xcc\xbc\x4c\x32\xe7\x18\xcc\xf0\xf3\xc6\x40\x49\x34\x08\xd9\xdf\xd5\x19\x6b\x24\xe4\x25\xe6\x1f\x1d\x8e\xdb\x06\x1b\x47\xa0\x9c\x35\x03\xe7\xdb\x60\x83\x5b\x48\xe0\x61\x48\x9e\x9c\x98\x64\xc2\xc5\x52\x08\x73\xd2\x53\x47\x18\xe7\xd9\x1d\x48\x5a\x3a\xe0\x9a\x14\x5d\xe3\xd4\xa0\x8d\x2a\x2a\x93\xbd\xc4\x05\xd3\x46\x2d\xc3\xd9\x2b\x18\x04\x26\x3d\xbf\x43\x3c\x20\x89\x40\x25\xea\xce\xb3\x03\xf4\x37\x23\xff\x08\x84\x94\x75\x84\xa8\xff\x99\xa0\x3d\x27\xda\x36\x7d\xbc\x36\x41\xc4\xee\x0a\xd2\xdc\xed\xfe\x12\xb1\x3a\xbe\xf8\x56\x21\xdb\x15\x27\x0a\x52\x80\xd7\x03\x98\x01\xa6\xa1\xb1\x5f\x6f\x1b\xcf\xe3\x7b\xff\xd1\x61\x3d\x71\x41\x92\x9b\xeb\x1e\xd9\x1e\xa6\x23\xf8\x8a\x43\x7e\xb3\x65\x64\x6f\x88\x30\xfa\x67\xc7\x02\x4e\x99\x20\x6a\x19\xe9\x40\x55\xb8\x7e\x53\x23\xf2\x0d\x22\xd2\xe9\xbc\x79\x9a\x2d\x04\x31\x8d\x42\x0b\x55\xbc\xaf\xda\x94\x5c\x2f\x3c\x33\x58\x69\x3b\x91\xda\x01\xdc\x06\xd3\xb4\xed\x78\xbf\x6f\x3e\x0e\x3a\x1b\xcf\xc9\xb6\x20\x0a\xba\x7f\xf7\xd2\x95\xed\xde\xe7\xc7\xe5\xf0\x0d\x8f\xca\xdc\x91\x81\xfe\xa9\x31\x5c\xf4\x8f\x3e\xcb\x75\xb1\x38\x93\xf9\x65\xb0\x3d\x18\x48\x62\x74\x29\x85\x8a\xd4\x6f\x9d\xfc\x77\x3b\x87\xad\x5b\x53\xee\xa9\x99\x0e\xdb\x41\xc0\x5f\x63\xdf\x36\xeb\xde\xde\xc2\xa8\x1d\x84\x70\x36\xbb\xc5\x54\xa6\x4b\xd9\x50\x98\xa3\x9f\xe3\xa8\x7b\xb6\xe6\xec\x23\x82\xc2\x45\xc3\x89\x0a\xde\xe6\x36\x86\x3f\x42\x29\x14\x0d\xe7\xa0\x9b\xda\x16\x95\xed\x21\x1b\x1b\x05\xad\x82\xc6\xd5\xd8\x4a\xda\xdc\x3d\xea\x92\x77\xfc\xe2\x67\x01\xb4\x45\xb9\x6e\x74\x89\x14\xa8\xfc\x2c\x6c\xfd\xb4\x1b\xd7\xc3\x7b\x3c\x89\xff\x08\x00\x00\xff\xff\x38\x2e\xed\x30\x73\x18\x00\x00")
+var _templatesSchemaGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x58\x5f\x6f\xdb\x38\x12\x7f\xcf\xa7\x98\xf3\xe5\x0a\x29\x48\xe5\xbb\x3e\xdd\xf5\x90\x87\xa4\x69\x9b\x1e\x70\x49\x51\xf7\x5a\xe0\xba\x45\x41\x8b\x23\x8b\xad\x44\x2a\x24\xe5\xc4\x2b\xf8\xbb\x2f\xf8\x47\x32\x25\xcb\x4e\xb2\xe9\x02\xc5\xee\xe6\xc9\x11\xc9\xe1\xcc\x6f\xfe\xfe\xd8\x34\x4f\x81\x65\x40\x38\x85\xe4\x8d\x3a\x23\x0a\xdf\xaf\x2a\x34\xbf\x5f\xde\x56\x42\x6a\xa4\x10\x71\xa1\xcd\x87\x59\x5d\xa1\x3c\x2d\x18\x51\x31\xac\xd7\x07\x00\xe6\xac\xc6\xb2\x2a\x88\x46\x98\xa8\x34\xc7\x92\xbc\x15\xc5\xaa\x14\xb2\xca\x59\x3a\x81\xc4\xec\x33\xbb\xb0\x50\x68\xae\xe9\x49\x71\x42\xb4\xb9\xae\x69\xa0\x22\x2a\x25\x05\xfb\x19\x21\xb9\x24\x25\xc2\x7a\x6d\xbe\x6e\xc4\x9b\x7d\x33\x7b\x85\x51\xd0\xc9\x6e\x9a\xe9\x11\xbc\x12\xd2\x0a\x51\x40\x31\x2d\x88\x44\x0a\x44\xc1\xa1\xc4\x0c\x04\x07\x25\x4a\x04\xa1\x73\x74\x9b\x8e\xe1\x6b\xad\x74\xbb\x13\x74\x8e\x4e\x01\xa2\x80\xc0\x42\x14\x84\x2f\xe0\x0b\x31\xda\x21\xfd\xe2\x4f\x60\xb2\x48\xdc\xae\x53\x38\x81\xb3\x04\x2e\x05\x94\xa8\x73\x41\x41\xe5\xa4\x28\x60\x8e\x20\xb1\xbd\x3c\x01\x38\x9a\x76\xf0\x38\x9b\x3b\x58\xed\x77\xe8\x1b\x36\xf7\x8b\x33\x94\xcc\x02\x20\x03\xe3\x3e\xe6\xc8\xad\x96\x56\xa7\xcd\x35\x46\xdd\x6a\x03\xb5\xd7\x94\x62\xc6\x38\x42\x46\x52\x2d\xe4\xca\x2b\xa9\xe0\x86\xe9\x1c\x74\xce\x94\x93\x92\x84\x0a\x22\xa7\x23\x4e\x7a\x59\xce\x91\x52\xa4\xbb\xfd\xdc\xee\x18\x3a\x39\xb4\x5c\x48\x23\xeb\x85\x28\xab\x02\x6f\xaf\xe6\x5f\x31\xb5\x71\xf4\xbe\xae\x0a\x1b\x61\xa7\x94\x32\xcd\x04\x27\xc5\x5b\x29\x2a\x94\x9a\xa1\x6a\x0d\x7f\x7f\x75\x7e\x15\x65\x12\x69\xfc\x1c\x72\xc2\x69\x81\x90\x12\x85\x20\x32\x50\xf5\xdc\x7a\x83\xf1\x1c\x25\xd3\x8c\x2f\x20\x93\xa2\x04\x03\xa4\xf3\x93\x35\x78\x4c\xfa\x31\x30\xa5\x6a\x84\xbf\x3e\x7b\xf6\xec\xef\x2d\x0c\xde\x23\xc6\x72\x1f\x79\x6d\x4c\xb2\x0c\x7c\xec\x77\xc9\x60\xd4\xeb\xf6\x35\x4d\x6b\xf4\x68\x00\x9b\x65\x4e\xc3\x1f\x7d\xcf\x3b\x24\xcf\x04\x5d\x79\x14\x9d\x26\x4f\x41\x12\xbe\x40\x48\x7a\xa8\x74\x8a\xee\x0a\x2a\xf3\x37\x9d\x8e\xa4\xd2\x7a\x0d\x0b\xd4\xca\x86\x51\xd3\x40\x5e\x97\x84\xf7\xf2\x4c\x64\x2e\x3a\x3a\x00\xad\x07\x4c\x64\x57\x1b\x0d\x6e\x72\x96\xe6\x60\x92\x46\x64\x40\x02\xb0\xcd\x1e\xb2\x30\x06\x31\xad\x80\x71\x8d\x32\x23\x29\x86\xe8\x02\x64\x35\x4f\x21\x6a\x1a\x38\x4c\xde\x61\x8a\x6c\x89\xd2\xab\x76\xd4\x53\xf8\xd0\x6b\x1c\x8f\xda\x11\xc5\x63\x00\x06\xf5\xa0\xbb\xaf\x03\x0a\xaf\xe1\x30\x39\x67\x2a\x95\xac\x64\x9c\x68\x21\x5f\x31\x2c\x68\x67\x7c\x70\x02\x40\xa2\xae\x25\xb7\x57\x4b\xc6\x75\x06\x93\xbf\x5d\x4f\x86\xe7\x3f\x90\xa2\x1e\x9c\xec\x47\xff\x98\xbc\xbe\xd9\xb0\x5e\x27\x4d\x93\x92\x12\x43\xeb\xac\x62\x43\xa9\x9c\x86\x42\xd7\x07\xa1\xab\x67\xa8\x47\xbd\xad\x1e\xe6\xed\x47\x38\x69\x87\x06\xd1\x92\x14\xfb\x3d\x15\xc3\x88\xaf\x38\x3e\xc0\x57\x0f\x01\x15\x4e\x60\x49\x8a\xbb\xa0\x1d\x5d\x1a\xf9\xd7\xa4\xdf\x39\x66\xa4\x2e\xf4\x76\xb5\x82\xa7\x5d\x89\xf9\xc7\x3f\xff\x15\x26\x41\x8b\xee\x7e\x6c\x5b\x5b\x63\xf8\x1f\x2f\x89\x34\x0d\xe6\x3f\xb3\xab\xcb\x68\x0e\x9f\x3e\xcf\x57\x1a\x63\x40\x29\x85\x0c\xe0\xdb\xdd\x40\x5d\x97\x1d\x5d\xea\x4e\x2f\x89\x04\xbd\xe7\x78\xb7\xd1\xe4\x92\x94\xf0\xfc\x04\xbe\x2a\xc1\x93\x4e\xbb\xc8\xe9\x15\x35\x4d\x98\x33\x91\xd9\xd4\xc1\x14\xaf\xd7\xf1\x31\x3c\xd1\xf1\xbf\xad\x8c\xbf\x9c\x00\x67\x45\x2f\x02\x7c\xa6\xa0\x94\x5b\x0e\xd9\x73\xf5\xfc\x11\x42\x8f\xb6\x3d\x71\x32\x8e\x43\xa4\xe3\x83\x81\x48\xce\xda\x68\x1a\x89\x92\x61\x35\x78\xcc\x84\x73\x30\x22\x9b\x65\x10\xf9\x79\xed\xad\xc9\x14\xcd\x96\xae\x9d\xba\xb1\xc5\xf6\xdc\x5a\x69\x51\xbe\x12\xb2\x24\x5a\xa3\x74\x23\x5c\xa4\xb4\x64\x7c\xf1\x42\x70\x4d\x18\x57\x90\xfc\x1f\xa5\x80\x49\xf4\xd3\x64\x12\xc7\xf1\xe8\x6c\xe2\x27\xa1\xe1\x68\xb2\x43\x2b\x3b\xdd\xcd\x07\x83\x8e\xef\x65\xa7\x45\x71\x95\x85\x6d\x6c\x5f\x93\xdb\xd5\xe6\xbe\x53\x9f\xf3\x03\xc4\x56\xdd\xfb\xb3\x37\xfd\x28\xbd\xe9\xd1\x1e\xfa\x1d\x36\xa6\x91\xc5\xcd\x87\x5d\x33\xf3\xe8\x88\xcd\x78\x30\xbe\x75\x1d\x6a\xab\xd3\x05\x28\x95\xa4\xba\x92\xb3\x82\xa5\xf8\x1a\x4d\x41\xd9\x55\x06\xb6\x80\xdd\xaa\x1c\x03\xce\xd1\x51\x4f\x9e\x16\x35\xc5\x0f\xa4\x60\xd4\xe0\x3b\x4a\x3a\xdb\x6f\x2d\xf7\x88\x5b\xc3\x7d\x99\xf2\x34\x70\x43\xd5\x80\x0a\x3b\xc0\x1b\xda\x64\x99\x51\xcb\x88\xfa\x0c\xcd\x68\xe0\x2a\xa4\x63\x2c\x6f\xba\x19\xd6\x28\xa0\x25\x92\x32\x8e\xdd\xe2\x3b\xbc\xae\x99\xa1\x98\xc9\x05\x51\x5e\x5b\x26\x4c\x31\xbd\x20\x5d\xa9\x8a\x07\xd3\x42\x84\xd7\x90\xcc\x6e\xc8\x62\x81\xd2\x96\xb2\x89\xab\xc4\x93\xce\x80\x97\xbc\x2e\x3b\xda\x96\x09\x09\xc8\xeb\x52\xd9\x5f\x6e\xee\xbe\x41\x58\x20\x47\x69\xa0\x4d\x05\x57\x1a\x22\xa2\xcb\x63\x10\xbc\x58\x81\x93\xa6\xe2\x1e\x9f\x71\xf5\xd3\x0a\x36\x95\xd3\x66\xd0\x25\xde\x8c\x77\xb8\xa5\xad\x1b\x86\xd9\xbc\x16\xbe\xd8\xc6\x36\xb7\x36\xff\xdb\xbc\x58\x9a\x26\x6c\x37\x1f\x74\x15\xe4\xc9\xf2\xe0\xbe\xb3\xd3\x56\x78\x2c\x5b\x7f\xf7\x03\xca\x13\xd1\x3b\x5c\x62\x0e\x4c\xa7\xe0\xbd\x80\xe0\x85\x99\x08\x30\x35\x64\xac\xc0\x58\xb0\x5d\x85\xb1\xf7\x03\x33\xdc\xb4\x44\xee\x8b\x92\xac\xb9\x66\x25\x26\x5e\x26\x99\x17\x18\x30\x9a\x79\xad\x21\x27\x0a\xb8\x68\xef\xb2\xae\xd7\x02\xd2\x1c\xd3\x6f\x2e\xaa\x76\x8d\x79\x8e\x4e\x3a\x6b\x3a\x06\xbc\xc5\x8d\x77\x50\xe2\xa3\x90\x4a\x3a\x31\xd1\x80\x99\xc6\x10\x56\x28\x4f\xa4\xa1\x5f\x75\x1e\x40\x59\xe3\x0e\xd7\x28\xb3\x63\x84\x32\x61\x96\x95\x3a\x79\x87\x0b\xa6\xb4\x5c\x85\x93\x68\x30\x16\x0d\x26\x20\x8b\x78\x40\x99\x81\x0a\x54\xd6\xb3\x1d\xf4\x77\x23\xff\x1c\xb8\x10\xd5\xc8\xb3\xc5\xaf\x49\xe1\x0b\xa2\xcc\x08\x84\xb7\x3a\xc8\xdf\xf1\xf1\xc7\x05\x49\xea\x76\x7f\x8f\x58\xed\x5f\x7c\xaf\x90\xb5\xa5\x9a\x82\xe0\xe0\xf5\x00\xa6\x81\x29\xa8\xcd\xd7\xfb\xc6\x73\xff\xde\x3f\x74\x58\x0f\x5c\x10\xa5\xfa\xb6\x45\xb6\x85\xe9\x18\x7e\xe0\x90\xdf\x6e\xa0\xc9\x47\xc2\xb5\xfa\xaf\xe3\x44\x67\x8c\x13\xb9\x1a\xe9\xc7\x65\xb8\x7e\x57\x5b\xf6\xed\x72\xa4\xef\x7b\xf3\x14\x5b\x70\xa2\x6b\x89\xb6\x47\x8d\xba\xd7\xa4\xe4\x66\xe1\x8d\xc6\x52\x99\xf9\xdc\xd0\x11\x13\x4c\xc3\x26\xec\xfd\xbe\xfd\x54\xea\x6c\xbc\x20\xbb\x82\x28\xe8\x3d\xf6\xdd\x2f\xd9\xbf\xcf\x93\x87\xf0\x45\x93\x8a\xd4\x37\x64\xff\xf0\x1a\x2e\xfa\x27\xb0\xd5\xa6\x58\x9c\x8b\x74\x16\x6c\x0f\xc6\xb3\xb1\xd6\x1a\x43\x49\xaa\x4f\x4e\xfe\xe7\xbd\xa3\xe7\xbd\x1f\x20\x86\x66\x3a\x6c\x3b\x01\xbf\x8d\x7d\xbb\xac\xfb\x74\x0f\xa3\xf6\xd0\xe3\xe9\xf4\x1e\x33\xaa\xca\x45\x4d\x61\x8e\x7e\xaa\xa5\xee\x11\xbf\x60\xdf\x10\x24\x2e\xea\x82\xc8\xe0\xa5\x72\x6b\x14\x26\x94\x42\x56\x17\x05\xa8\xba\x32\x45\x65\x77\xc8\x8e\x0d\xc6\x46\x41\xed\x6a\x6c\x29\x4c\xee\x1e\xdb\xe4\xed\xbf\x7f\x1a\x00\x4d\x51\xae\x6a\x95\x23\x05\x2a\x6e\xb8\xa9\x9f\x66\xe3\x86\xca\x8c\x27\xf1\x2f\x01\x00\x00\xff\xff\xba\x9a\x01\x98\x81\x19\x00\x00")
func templatesSchemaGotmplBytes() ([]byte, error) {
return bindataRead(
@@ -368,8 +516,8 @@ func templatesSchemaGotmpl() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "templates/schema.gotmpl", size: 6259, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
- a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3a, 0xd6, 0xc6, 0x56, 0x8c, 0xce, 0x4f, 0x11, 0x45, 0xba, 0xcb, 0xb6, 0xc2, 0x28, 0xd4, 0x31, 0x52, 0x91, 0xbd, 0x36, 0xa7, 0xe5, 0xc4, 0x21, 0x15, 0xa1, 0xaa, 0x46, 0x3a, 0x8, 0x9f, 0x4f}}
+ info := bindataFileInfo{name: "templates/schema.gotmpl", size: 6529, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa4, 0x1b, 0x14, 0x27, 0x44, 0x98, 0x94, 0x30, 0x4f, 0x2b, 0x78, 0x30, 0x67, 0xe5, 0x68, 0xbb, 0x64, 0xaa, 0x72, 0x97, 0x2e, 0xbd, 0xdf, 0x47, 0x1e, 0xdd, 0x86, 0x5e, 0xa8, 0xff, 0x2b, 0x62}}
return a, nil
}
@@ -633,6 +781,26 @@ func templatesSerializersTupleserializerGotmpl() (*asset, error) {
return a, nil
}
+var _templatesServerAutoconfigureapiGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x59\x4f\xb3\xda\x38\x12\x3f\x87\x4f\xd1\x45\xcd\x01\x5e\x81\x5d\xb5\xc7\x6c\xe5\xf0\x36\x2f\x93\xa1\x76\x92\x50\xc3\x9b\xdd\xc3\xd6\x1e\x84\xdd\x60\x4d\x64\x49\x2b\xc9\x8f\x30\x94\xbf\xfb\x56\x4b\xb2\xb1\xc1\xf0\x78\x99\x64\xe6\x84\x2d\xf5\x3f\x75\xb7\xba\x7f\x6e\xd2\x14\xde\xaa\x1c\x61\x8b\x12\x0d\x73\x98\xc3\x7a\x0f\x5b\x35\xb7\x3b\xb6\xdd\xa2\xf9\x3b\x3c\x7c\x82\x8f\x9f\x1e\xe1\xdd\xc3\xe2\x31\x19\xa5\x29\xdc\x57\x4e\x41\xa6\xe4\x86\x6f\x2b\x83\x16\x98\xe6\x50\x30\x99\x0b\x34\x16\x16\xa5\x16\x58\xa2\x74\xcc\x71\x25\x6d\x32\x1a\x1d\x0e\xc0\x37\x90\xbc\x55\x7a\x6f\xf8\xb6\x70\x30\xaf\xeb\x34\x85\xc3\x01\x32\x55\x12\xe5\xc9\xde\xe1\x00\x28\x73\xa8\xeb\xd1\x68\xa4\x59\xf6\x99\x6d\x91\x88\x93\xfb\xe5\x62\x19\x5f\x69\x8f\x97\x5a\x19\x07\x93\x11\xc0\x38\x53\xd2\xe1\x17\x37\xf6\xcf\x66\xaf\x9d\x4a\x9d\xb0\xfe\x95\x2b\xff\x23\xd4\xd6\xff\x4a\x74\x69\xe1\x9c\x1e\x8f\xe8\x6d\xcb\x5d\x51\xad\x93\x4c\x95\xe9\x56\xcd\x95\x46\xc9\x34\x4f\xd1\x18\x65\x02\xf7\x30\x81\xa9\xa4\xe3\x25\x3e\x4f\x91\x96\x3c\xcf\x05\xee\x98\xb9\x85\xd8\x62\x56\x19\xee\xf6\xde\x36\xf2\x9a\x3f\xa1\x85\xe4\x01\x37\xac\x12\x6e\x11\xdf\xeb\xfa\x64\xbf\xb3\x31\xf5\xfe\xde\x71\x57\x40\xf2\x1e\xe5\x27\x1d\x96\xd3\x74\xab\x5e\x37\x01\x86\x18\x59\x38\x2e\xa0\x79\x42\x03\xf3\xb9\x63\x66\x8b\xce\xbb\xfb\xd1\x3f\x2e\x99\x2b\xa0\xae\x61\x3e\x97\xac\x0c\x71\xf8\x48\x0f\x7e\xc9\x6a\xcc\xfc\xd2\x4a\x63\x16\x29\x47\x87\xc3\xdc\xc7\xbb\x17\xae\x90\x03\x12\x7b\xcb\x63\xa5\x49\x3d\xa5\xc9\x38\x08\x64\x9a\xcf\x2f\x86\xbc\xcd\x8b\x63\x82\x34\xba\x3e\xa8\x1c\xc5\x90\xb6\xde\xc6\xb8\xa4\xb7\x46\x97\x7f\xe9\x69\x3b\x97\x72\x49\xdf\xca\xfb\x6b\x48\x61\x7f\x67\x6c\xd0\x3a\xa6\xf9\x38\xb8\xcb\xef\xf5\x54\x0e\x08\xba\xa4\xf3\xad\xe0\x28\xdd\x90\xce\xfe\xce\x38\xf3\xaf\xf1\x94\xe1\xa5\xa7\x73\x40\xd0\x25\x9d\xfd\xcb\x7c\x64\x81\xf9\x9c\xf7\xb6\x7a\x0a\x2e\x71\x9d\xcb\x7f\xc4\x52\x0b\xe6\xf0\x81\x9b\x20\xd5\xc5\x85\x79\xce\x4d\xc8\xc2\x1e\x45\x5f\x82\x61\x72\x8b\x90\x7c\x6a\xb3\x28\xc8\x68\xb3\xca\x0b\xb8\xc4\xf5\xc8\xb6\x91\xde\xd1\xd3\x20\x29\x99\xb8\x34\x5c\x66\x5c\x33\x11\x88\x75\xfb\x4a\x1c\xdd\xcd\x73\xd6\x78\x6d\x57\x59\x81\x65\x3f\x62\xfd\x9d\xb1\x2f\x48\x41\x7e\x1e\x76\xe6\x36\x6c\x91\x92\x01\x31\x43\xf1\x8a\xe7\xf2\x49\x6c\x3b\x29\x7e\xf1\x68\xca\xc0\x44\x2a\x07\xc9\x42\x66\xa2\xca\xd1\x73\x4e\xfb\x6b\xff\x62\x82\xe7\xcc\x29\x33\x8d\x37\xfe\x33\xd7\x41\xac\x7d\x56\xde\x4f\xa1\x25\x9c\x48\x5c\x32\xc3\x4a\x74\xd4\x2a\x4e\x76\x7e\x41\xab\x95\xb4\x68\xbb\xba\x8e\x25\xe2\x4c\x5f\x97\x77\x55\x69\xdf\x0d\x8e\x8c\x36\xac\x5c\xe5\xfa\xc0\xb8\x0c\x2c\xf8\xc5\x2f\xcc\x4b\xc6\xe5\x79\x20\xdf\x85\x5d\xaa\x72\x7d\x72\x2a\x80\x03\x71\xaf\x4a\xfd\xc0\x1c\x8b\x11\xad\x4a\x3d\xcf\x99\x63\x03\x65\xc4\x19\x9e\xb9\x70\xee\x9c\x3c\x12\xcc\xf7\xab\x73\xd3\x2e\x77\x19\xdb\xd6\x98\xa6\xf0\x58\x70\x0b\x1b\x2e\x10\xd8\x49\x47\x76\x05\xfa\xae\xbc\x66\xd9\x67\x62\xe8\x5f\x56\xdf\xc4\x0f\x87\xe1\x7b\x7a\x2f\x38\xb3\x75\x0d\xcd\x85\x2e\x2b\xeb\x80\x09\x83\x2c\xdf\x03\x7e\xe1\xd6\xdd\xc2\x9e\x7c\xc4\xdd\x64\x0a\xdc\x1e\x55\x07\x5c\x51\x59\x34\x33\x60\x32\x0f\x82\x0d\xba\xca\x48\x60\x12\xd4\xfa\x37\xcc\x1c\x89\x56\x06\xb8\x74\x68\x36\x2c\x43\x70\x05\x73\x47\x19\x16\x62\x52\x75\x28\x72\xdc\x70\x49\xc2\x51\xa8\x5d\x02\xa3\x27\x66\x3c\x08\x69\x49\xdf\xdc\x66\xac\x77\x69\xc3\x13\xe0\x8c\x05\x26\x84\x77\x64\x6c\x90\x8d\x3f\x1b\x57\xc7\xb2\x43\xc7\x31\xf8\xbf\x0a\xad\xb3\x23\xb7\xd7\x78\x6e\xe6\xa1\xd3\x3b\x42\x97\x7f\x20\xbb\x79\x53\xb7\x46\x40\xb0\xaa\x60\x6b\x81\x9e\x32\x86\x19\xe0\x6d\xa3\x2a\xec\x9c\x15\xbd\xf7\x46\x55\xda\x12\x6e\x0a\xa0\x40\x33\x9b\x31\xc1\x7f\xc7\xb6\x51\x47\x5b\x9a\xe4\x21\xca\x90\x3f\x5d\xd1\xbd\x13\xc7\xd3\xf6\x4f\x19\x0e\xd6\xe3\x39\x06\xe1\xd0\xb1\x14\x7f\x14\x6c\x6b\x27\xe4\xb6\xbb\xc3\xa1\xd3\xc3\x1b\x77\x0f\x5a\x79\xbf\x5c\x4c\xbb\x42\x1e\x7f\x5e\x4d\x9c\xb0\xe1\x1d\xee\x9c\xb0\x49\x78\xee\x51\x85\xfe\x39\xb1\x70\x47\x35\x34\xb6\xd3\x19\x84\xea\x39\x03\x96\xe7\x06\xe8\x3e\xc9\xc0\x56\x59\xa7\xca\x96\xf9\x2b\x4d\x5c\xa1\xab\xf4\x87\x16\xd8\xd9\x49\xd1\x24\x0d\x99\xd0\x56\xbd\xee\x5b\xc3\xf5\x5e\xa8\x35\x13\x47\xde\x5b\x58\xeb\xd1\x73\xa9\x13\x20\x79\xd1\x0b\x63\x0c\x21\xab\x5c\x81\xd2\xf1\xcc\xc7\x30\x84\xb0\xa5\xed\x24\x27\xa5\x4e\xdb\x42\x2e\x66\x68\xa0\xf2\xc0\xc0\xfe\x83\x59\x9e\x91\xa8\xb0\x45\x36\x68\x2d\x38\x5a\xd8\x15\x28\x7d\x05\xa2\x5d\x65\xf8\xef\xa1\x19\x17\xc8\x72\xba\x11\x64\x9b\x0b\x08\x95\x88\xbc\x9c\x18\xb0\xb3\x0c\x5e\x3c\x90\xdb\x2b\x57\x4c\xa8\x6e\xc4\x48\xce\x88\xc2\x36\x61\x85\x49\xfc\xbe\x68\x7b\xf1\xc2\x7e\xac\x84\xf0\x27\xac\xeb\xbb\x4e\xb7\x3c\x92\xd4\xf5\x0c\x3c\xca\x9f\xb6\xa7\x42\x61\x31\x1e\xed\x7e\xb9\xf8\x27\xee\xaf\x9f\x6d\xdc\x41\xc2\xe3\x00\xe5\x54\x65\x32\x0f\x8e\xc2\x11\xaf\x1c\xc6\xa9\xcf\x28\xbf\xe3\x01\x3e\x91\x96\xbf\xc1\x40\x49\x18\xb6\x81\x2e\x8c\xd2\x68\xe1\x3f\xff\xfd\xd6\x46\x35\x65\xac\xf3\x52\x77\x0b\x9c\x7f\xfe\xa1\x69\x36\xaf\xdf\x40\xd2\xf9\xc6\xf3\x7b\x4c\xf3\xb8\xcd\xe8\x72\x7a\x9a\x93\x0b\x1b\x5b\xe3\x95\xd2\x98\xde\x5d\xad\x8d\x11\x67\xd9\xcc\x70\xed\x93\xb5\xae\xe1\x2e\x0d\xd7\xe5\x2a\x5f\xb7\x02\x0e\x58\x10\x94\xbf\x8a\xbe\x5c\x55\x65\xc9\xcc\x3e\xac\x5d\xb2\x28\xe4\x52\xa4\x0c\x66\x10\x7f\x1b\xdd\xae\x95\xcf\x0b\x3a\x3f\xd3\xab\x4e\x1b\x78\x35\xc8\x38\xd1\x04\xd1\x3c\x24\x8e\x70\xb5\x09\x49\x1b\x27\x8f\x26\x93\x93\x10\x34\x56\xd2\xd3\x40\xdc\x3a\x08\x34\x69\xf3\xe3\x5c\xfb\xb2\x51\x1e\xbf\x22\x63\x0d\xc1\x9c\xb2\xab\x87\xbe\x5f\x9e\x9e\x87\x03\xca\xbc\xae\xa7\xd0\xad\x65\x3f\x34\xdf\xc9\x83\x70\x8c\x04\x84\x53\x5c\xea\x0a\x2d\x3d\x1c\xe0\xe8\x02\x38\x7e\xf9\x27\x1d\x8a\x53\x24\x37\x8f\xf7\xa1\xbd\x0e\x9b\x4a\x66\x47\x24\xf7\xd5\x9d\xd4\x37\x64\xc2\x3c\xc9\x79\x57\x9e\x8e\xce\xf4\xdc\x2f\x17\x5f\xa5\xa5\xdb\xa8\xe0\x30\x1a\x01\x81\xa5\xd0\x85\xdf\x51\x21\x80\x37\xa1\x20\xd8\xce\x5a\x43\xf5\xab\xc5\x55\x98\x43\xfc\xba\x20\xf4\xe5\x4b\x55\xbc\x40\x6f\x95\xb4\x55\x89\xe7\x6d\xa7\x87\xe2\xc2\x2e\xc9\x1a\xb4\x30\x0a\x09\x00\x70\x98\xb7\x53\x39\x6f\x96\x15\xa7\x35\x8d\x8d\xe6\xc7\x4a\x66\x13\x72\xe7\xc4\x00\x57\xc9\x2f\xbe\xcd\xcd\x20\x4e\x52\x8e\x3d\xb6\x9e\x06\x5f\xf8\xd0\x40\x83\x7c\x7d\x8c\xae\xa9\x9c\xb4\xb2\xa8\xaa\xd6\xd7\x4b\x6b\xd7\x87\x4b\xa3\xf2\x2a\xfb\x83\x3e\x8c\x42\xbe\x89\x0f\x3b\xb2\x1a\x1f\x36\x4b\x47\x1f\xee\xc8\x87\xff\x36\xdc\x91\x0f\xe9\xab\xe9\x0f\x78\x30\x4a\x9f\xec\x6e\xf4\xe0\x89\x03\xff\x4a\x18\x74\xee\xc4\xb6\x73\xc3\x1b\xf0\x9e\xfa\x5e\x88\xe8\x59\xef\xf6\x41\x59\xd0\xed\x3d\x3b\x02\xf8\xae\x70\xea\x06\xa7\x7c\x4b\x64\x15\x1d\x71\x9b\x2b\xbc\xe2\xc6\x0b\x57\x01\xd9\x0b\x4f\xf1\xcd\xb1\xd9\x0b\xe2\xeb\xed\x68\x0c\x38\x39\xdc\x40\xf5\x89\x6f\x97\xd0\x5c\xdc\xbd\x11\xcf\x75\x6f\x62\x6f\xc2\xe7\x4d\x88\x4e\xbc\x86\x4f\x3a\x27\x6a\x3b\x78\x77\x74\x76\x19\xd4\xbd\xe9\xde\xf1\x0b\xf2\x63\x6a\x10\xd1\x29\x0e\x4a\x86\x81\x4d\x94\x7e\x2c\x75\x47\x98\x75\xa3\x84\x00\x8d\x06\x4a\x6e\xb3\x32\x80\xb9\x5e\x6e\xcc\xed\x42\x4e\xed\x69\x52\x02\xfe\x0c\xf4\xf6\xd7\xe0\xb7\x0e\x82\x7b\xae\x36\x9c\xa1\xe9\x67\x5d\x12\x04\x87\xfe\xe4\x7f\xfa\x77\x8b\x72\x7e\xd9\x8c\x3c\x56\x45\xe5\x72\xb5\x93\x4d\xc9\x98\xc2\x81\xae\x67\x17\x81\x5d\xa1\x49\xd3\xd3\x59\x08\x64\x4c\x82\x7a\x42\x63\x78\x8e\xa0\x0c\xb0\x3c\x87\xce\x50\x31\x5e\x3f\xea\x59\x6c\xad\x9e\xb0\x85\x97\xe7\x23\x15\x8f\xe5\xa2\x5f\xec\xe0\xd4\xa3\x35\x71\x62\x4f\x66\x29\xd3\xe9\xa8\x99\x6d\x22\x3c\xfe\xbc\xea\xeb\x87\x35\x6e\x94\x41\xf8\xe9\xf1\x71\xb9\x6a\x46\x1c\xd6\x31\xe3\x6c\x72\x82\x68\x2f\x8f\x8f\x7c\xfd\x4b\x53\xf8\xc0\x3e\xa3\x9f\x76\x49\xcc\xd0\x5a\xfa\xdc\xca\x0a\xaa\x37\x96\xce\xed\x06\xf5\x17\x68\x30\x39\x43\xd6\x3d\x5d\xcd\x01\xee\x2d\x58\xa5\x24\xb0\x76\x16\xc3\x2d\x78\x1c\xe1\xf3\x23\x87\x75\xe5\xfc\x30\xda\x54\x12\xf6\xe8\x66\xe0\xfc\x38\xb7\x92\x99\x57\xb5\xe3\x42\xc0\x9a\xe2\x22\x04\xe6\x7e\xe6\xba\xd8\xc0\x5e\x55\x20\x11\x7d\x68\x4a\x95\xf3\xcd\x1e\x58\xb4\x71\x06\xd6\x91\x73\x1a\x6d\xd2\x3a\x26\x33\x24\x4a\xeb\x94\x06\x4e\x60\x34\xe7\x4f\x3c\xaf\x98\x10\x7b\x10\xcc\x63\x2c\xaf\x95\x87\x91\xb1\x16\x2c\xc3\xe4\x38\x5a\x6e\x6c\xa1\xdc\x68\x4d\x81\xb2\x12\x8e\x6b\x81\x40\x10\xce\xce\x20\x47\x8d\x32\xe7\x72\x0b\x2a\x34\x73\x59\x95\x6b\x34\xa0\x36\xde\x16\xda\x08\xb8\xc6\x7a\xd1\xf1\x9f\x8d\x27\x26\x2a\x6c\x4f\xe9\xf3\x2a\xcb\x94\x21\x39\x62\xff\x3a\xfe\x27\x32\x0b\xbf\x76\x4c\x19\x39\xae\x24\xff\x32\x3e\x0d\xf4\x0b\x26\x80\x70\x18\xbd\xea\x47\xae\x61\xee\xd3\x77\x73\xf0\x58\x06\x4e\x52\x81\xfc\xa3\x8c\x3f\x6f\x33\xc4\xc3\x2f\x98\x55\x8e\xbe\x76\x88\xd5\x22\xe4\xca\x47\x98\x69\x2d\xf6\x4d\x52\xc5\xff\x5e\x93\xdf\xac\x92\x90\xab\xac\x22\x38\x9d\x0c\xa8\x0b\xd2\xd0\x02\xdb\x38\x34\x60\x54\xe5\xc8\x95\x94\x36\xf1\x1a\xf4\x87\x7b\x33\x58\xf3\x10\x06\x26\x73\x72\x2f\xcf\xe3\xb4\xdf\x3b\xec\xf4\xa6\xdd\x30\x7a\x24\x7f\x75\xeb\xdb\xa5\xc1\xe7\x4d\xfe\x2a\x98\xd6\x28\x6d\x6b\xbb\xdc\xbb\xc2\xc3\x1b\x9f\x80\x1d\x36\x26\xac\xf2\x2e\xe3\xe1\x26\x36\x39\x74\xdd\x79\x2b\xd5\x66\x32\x83\xad\x52\x79\x48\x66\x12\xa0\x45\xb5\x05\x2e\x81\x81\x66\x92\x67\x21\x5c\x24\xf1\xa8\x74\x06\x42\x6d\xb7\x8d\xef\x4a\xa4\x46\x62\xbb\x8e\xfb\x8a\xc1\xed\xa0\xf7\x2e\xc9\x21\x17\xfe\x3f\x00\x00\xff\xff\xb7\x4e\xce\x14\x88\x21\x00\x00")
+
+func templatesServerAutoconfigureapiGotmplBytes() ([]byte, error) {
+ return bindataRead(
+ _templatesServerAutoconfigureapiGotmpl,
+ "templates/server/autoconfigureapi.gotmpl",
+ )
+}
+
+func templatesServerAutoconfigureapiGotmpl() (*asset, error) {
+ bytes, err := templatesServerAutoconfigureapiGotmplBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ info := bindataFileInfo{name: "templates/server/autoconfigureapi.gotmpl", size: 8584, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x67, 0xfe, 0xbe, 0xdd, 0x4, 0x26, 0xda, 0xd8, 0xd, 0x28, 0x0, 0x21, 0x92, 0x1, 0x57, 0xd7, 0xbf, 0xba, 0xd4, 0x29, 0x33, 0x94, 0x84, 0xfc, 0xe5, 0x4f, 0x4d, 0xf4, 0xed, 0x6e, 0x77, 0xc9}}
+ return a, nil
+}
+
var _templatesServerBuilderGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x3c\x5d\x6f\xdb\xb8\x96\xcf\xab\x5f\x71\xae\x71\xef\xae\x55\x38\x76\xb1\x4f\x8b\x0c\xb2\x40\x26\x99\xb9\x37\xbb\x33\x6d\xd0\x74\x76\x1f\x82\xe2\x82\x91\x8e\x6d\x6e\x65\x52\x43\x52\xc9\x64\x04\xfd\xf7\x05\x3f\x45\x7d\xd9\x8e\x9b\xce\xb4\x2f\xad\xa4\xc3\xf3\xc5\xc3\xf3\xc5\xe3\xae\x56\x70\xc5\x73\x84\x0d\x32\x14\x44\x61\x0e\x0f\xcf\xb0\xe1\x67\xf2\x89\x6c\x36\x28\xbe\x83\xeb\xf7\xf0\xee\xfd\x47\xf8\xe1\xfa\xe6\xe3\x32\x49\x92\xba\x06\xba\x86\xe5\x15\x2f\x9f\x05\xdd\x6c\x15\x9c\x35\xcd\x6a\x05\x75\x0d\x19\xdf\xed\x90\xa9\xde\xb7\xba\x06\x64\x39\x34\x4d\x92\x24\x25\xc9\x3e\x93\x0d\x42\x5d\x2f\x6f\xed\x3f\x9b\x46\x23\xfc\xab\xff\x70\x7e\x01\xfe\x8b\x59\xb1\x5a\xc1\xc7\x2d\x95\xb0\xa6\x05\xc2\x13\x91\x5d\x2e\xd5\x16\xc1\xb1\x09\x8a\xf3\x62\xa9\xe1\x7f\xc8\xa9\xa2\x6c\x03\x2a\xac\xdb\x19\x56\x4a\xc1\x1f\x11\xd6\x95\x32\xa8\xb6\xc8\xe0\x99\x57\x20\xf0\x4c\x54\xac\x83\xc9\x93\x30\xf2\x10\x96\x27\x09\xdd\x95\x5c\x28\x98\x27\x00\xb3\x8c\x33\x85\xbf\xa9\x99\xfe\xf7\x7a\x67\xff\xa6\xdc\xfc\xc5\x50\xad\xb6\x4a\x95\xe6\x41\x2a\x41\xd9\x46\xce\x12\xfd\xb0\xa1\x6a\x5b\x3d\x2c\x33\xbe\x5b\x6d\xf8\x19\x2f\x91\x91\x92\xae\x50\x08\x2e\xe4\x6c\x1a\xa0\xe0\x24\xdf\xf7\x5d\x54\x4c\xd1\x1d\x1e\x86\x58\xed\x68\x9e\x17\xf8\x44\xc4\x31\xc0\x12\xb3\x4a\x50\xf5\xbc\x07\x54\x96\x98\xed\xfb\xac\x84\xd7\xcd\x04\xc0\x13\xd9\x18\xd5\x68\x6b\x32\xda\x95\xb0\xbc\xc6\x35\xa9\x0a\x75\xe3\x9e\x9b\xa6\xf7\x3d\xfa\x90\x1a\xd3\x78\x87\x4f\x75\x0d\x25\x91\x19\x29\xe8\xef\x08\xcb\x77\x64\xa7\xed\xe6\xf2\xf6\x06\x32\x81\x44\xa1\x04\x02\x0c\x9f\x60\x14\x0c\x28\x93\x8a\xb0\x0c\x93\x75\xc5\xb2\x7d\xd8\xe6\x5a\x5e\x78\x63\xf6\x63\x79\xcd\xb3\x4a\xdb\x79\x0a\x6f\x26\xa9\xd7\x09\x80\x40\x55\x09\x06\xff\x3a\x05\xa4\x61\x00\xb6\x84\xe5\x05\x0a\x79\x0e\xdd\x3f\x3b\xf2\x19\xe7\x3b\x52\xde\x5b\x43\xfa\x14\xfd\x53\xdb\xd8\xf2\x1f\x76\x5d\xba\x30\x58\xd6\x5c\xec\x88\x1a\x20\x01\xbb\x11\x5e\xb3\x16\x36\xb7\x0f\x57\x9c\xc9\x6a\x87\xed\x9a\x59\x5d\x87\x3d\xf0\x1f\xa1\x69\x66\x9d\x55\xb7\x82\xe7\x55\x36\xb1\xca\x7f\x6c\x57\x65\x95\x54\x7c\xe7\xb0\x45\x42\xf6\xa5\x73\xa6\xb7\xf4\x90\x69\xbc\xdc\xa1\x3d\x62\xb9\x87\x74\xcb\x6f\x05\xde\xa1\x78\x44\x71\xb7\xad\x54\xce\x9f\x98\x43\xa0\xb7\x7b\x9e\x42\x0d\xd0\x58\xc0\x51\xa8\x31\x40\x6d\x07\x03\x25\xbb\xf7\x16\xa2\x92\x78\x67\x1d\xc9\x2f\x37\x31\xe4\x9a\x14\x12\x23\x6a\x3f\xe8\xc3\xdf\x45\x65\xfd\xc1\xb2\xfd\x6c\xc1\xbf\x27\x92\x66\x97\x95\xda\x22\x53\x34\x23\xca\x2f\xf3\xc7\x74\x19\x00\x2c\xfc\xe5\xed\xcd\x7f\xe3\xf3\x70\x41\x80\x6f\x01\x1c\x01\x24\x02\xc5\x9e\x05\x2d\x80\x5d\x50\xd7\x20\x08\xdb\x20\x2c\x23\x3b\x49\xac\x10\x75\x7d\x66\xe2\xc3\xcd\xae\x2c\x50\x1f\x13\xa2\x28\x67\xed\x77\x18\x3f\x8b\x7e\xe3\xcf\xf5\xe7\xe1\xe2\x45\x84\x1d\x0b\x89\x2f\xc0\xd7\x37\xad\x1f\xf5\x9e\x9a\x8d\x15\x40\xf9\xf2\x03\x92\x1c\xc5\x02\x14\x11\x1b\x54\x40\x99\x42\xb1\x26\x19\xd6\x4d\x6a\x37\x04\xea\xa4\xdd\x22\x77\xa6\xdd\x4e\xbd\xe3\x2a\x70\x8a\xf9\x7c\x56\xd7\x86\x7c\xd3\x40\xe6\x88\xc1\x96\x48\x60\x5c\xc1\x33\x2a\x78\x40\x64\xda\x9b\xf9\x05\xb3\x34\x60\x6e\xd2\x8e\x84\x36\x5e\x8e\x3e\x7a\xcd\x47\x67\xed\xcb\x34\xef\xcf\xcc\x6b\x69\xbe\xc5\xd7\x3f\x95\xad\xe6\x9f\xb4\xe6\xff\x57\x50\xa5\x35\x9f\x13\x45\x5e\x4b\xef\xa5\x23\xf5\xf5\xf4\xfe\xbe\xd4\xc9\x01\xe5\xac\xa3\x79\xad\x78\x86\x6d\xee\x12\x12\x1a\x93\xff\x44\x4a\xba\x8d\xdf\x5b\x02\xa3\x5a\x74\xee\xfd\x3c\xd2\xf5\xd9\x7e\x22\xfe\xf5\x65\x41\x89\xe6\x6d\x79\x14\x81\x76\x4f\x4a\x22\xc8\x4e\x1e\x94\x65\x84\x4c\x4f\x6d\x74\x0d\x7f\x5d\xfe\x1d\xd9\xfb\x52\xc9\xe5\x9d\x12\x34\x53\x1f\x50\x96\x9c\xe5\x28\x64\xc7\x7a\xce\xc6\xcc\xc7\xb0\x51\xd7\xda\x92\xb5\xc7\xe1\x82\xfe\x8e\x79\xd3\x2c\xa0\x14\x94\x65\xb4\x24\x05\xd8\xaf\xb7\xfe\xf9\x46\xbe\xab\x8a\x82\x3c\x14\x7a\xfd\x9b\x48\xec\x16\x44\x3f\x21\xcb\x9b\x26\xb5\x8b\x0f\xcb\x77\x58\x83\x41\xa8\x60\xa9\xce\x4a\x5f\x8d\x42\xcf\xce\x53\xa7\x62\x7d\x0c\xff\x7c\x3d\xb6\x29\xe5\x72\x52\x13\x11\x4c\xff\xcc\x72\x7f\x8e\x8e\xb6\xb8\x9e\xbe\x7a\x22\x37\xcd\x31\x67\xde\xad\x3f\x73\xea\xf3\xc7\x7f\xf2\xb4\xdf\xb9\x10\x78\x8d\x6b\xca\xe8\xe0\xd8\x3b\x87\x2b\x43\x04\x6e\x3f\xae\x56\x70\x59\x96\x05\x45\x69\x8b\x0d\x5d\x61\xf8\x7d\xb0\x72\x6f\x4d\xe4\x01\x2a\x41\xa2\x82\x27\xaa\xb6\x06\xc8\xe0\x02\x99\x6d\x71\x87\xc9\xd0\xcb\xde\x5c\xeb\xec\xb1\x52\xdb\x73\x9b\x9d\x54\x12\x05\xd8\x34\x68\xa1\xe1\xa4\x7b\x48\x61\x7e\xca\xf6\x2e\xac\x8f\x4d\xfb\x3b\xc9\x68\xb1\x98\x72\xbf\x0f\x86\x63\xa2\xc5\xd7\x44\x1d\x8f\xe9\x31\xfb\xd1\x4c\xb8\xdf\x58\xb9\x6d\xba\xb2\x5f\xbb\x26\x13\x75\xd6\x3f\x33\xc1\xec\x8e\x57\x22\xb3\x99\xbe\x51\xf2\x11\xea\x54\xfc\x33\xb2\x3f\x5e\x85\xa4\xa4\xf0\x19\x9f\xad\x12\x63\x1d\xb6\xa1\x6d\x2d\xf8\x4e\x3f\x5a\xa1\x74\xac\xd3\x27\x1c\xee\x23\xa9\x3f\xbd\x96\xca\xdf\x6b\x8d\xfc\x7b\x74\x1c\x8e\xd4\xd8\x02\x64\xc6\x4b\x94\x70\xff\xe9\x0f\x57\x21\x27\x86\xe7\x07\x93\xab\x0e\x15\xf9\x05\x9a\x19\x79\xd4\x22\xed\xf1\x0d\xab\x95\xaf\x97\x0c\x23\xc6\xf7\x9a\x93\x1e\x9e\x72\xd8\x21\x61\x94\x6d\x80\x71\x10\xf8\x6b\x85\x52\x49\x20\x02\xe1\xa1\xe0\xd9\x67\xcc\x7d\x2a\x1f\x7c\x77\x3f\x89\x0f\x98\xe6\x63\x4e\xac\x49\x9a\x24\x59\xed\x29\x50\x6d\x17\xe7\x86\xad\xb9\xf5\xb2\xfe\x69\x79\x8d\x32\x13\xb4\x74\xe9\x5f\x5d\x0f\xde\xda\xd4\xc5\xa6\x82\xfa\xdc\xd5\x35\x6c\xab\x1d\x61\x9d\xd2\x5a\xd7\xb7\x51\x6c\xb3\xff\x80\x37\xab\x44\x3d\x97\x38\x9e\x38\x6a\xb6\xa4\x12\x55\xa6\xcc\xb6\x9b\x92\x3b\xfa\xd3\xab\xbe\x13\x00\xd7\x8a\x69\x21\xa2\x70\x73\x65\xbf\x25\x6d\x81\xed\xa1\x0e\xd7\xd4\x49\xa8\xa7\x03\x6a\x57\x47\x7f\xc0\x0d\x95\x4a\x3c\x27\x83\xca\x16\xf6\x14\xb3\xc9\xa0\x90\x1d\x83\xf6\x1f\x93\x41\x85\xee\x0e\x57\x32\x28\xc2\xdb\x0f\x3f\x07\xc9\x2d\xbf\xe6\x64\x46\xea\xf8\xbe\xa2\x45\x8e\x22\x85\x9e\x9c\x71\xb5\xaa\xd7\x3d\x70\x5e\x24\x89\x31\xe0\x61\xd9\x19\x3a\x63\x12\x48\x48\xee\xbb\x10\xc6\x49\x99\x66\x5a\x65\xdc\x73\x0e\x51\x70\xd0\x4c\x69\x03\x5a\x5a\x02\x37\xca\x1c\x4a\x12\x8e\x0a\xed\xd6\x1e\xd4\xb5\xe5\x9c\xc5\x83\x4b\x0a\x16\xb0\xe5\x4f\xf8\x88\xc2\xf4\xef\x32\xc2\x40\x60\x59\x90\x0c\x81\x2a\xbd\x6f\xfa\xb5\xd0\xce\x51\xd1\xac\x2a\x88\x80\x4a\x92\x0d\x6a\x9a\x23\x12\x19\x3d\x85\x33\xf5\x8b\x44\x71\x4b\xa4\x8c\x60\x28\x67\xe9\xb8\xac\x4e\x4d\x23\xd5\xf6\x49\x7a\xb2\x6e\xf4\x9b\xd0\xd3\x98\x48\x56\x51\xde\xc9\xfb\xbf\xbd\xe2\x3e\x6a\xe6\x5f\xa2\xb5\x91\x96\xc3\x69\xd6\x65\xbd\xfd\x37\xa4\xbc\x31\xc9\xba\xca\xf3\x4a\xbb\xd3\xa1\x32\x7f\x81\xea\xa6\x1b\x2f\xb6\xff\x3e\xdd\x05\x01\x61\x1c\x97\xf6\x3c\xa4\xed\x4d\x68\x39\xb4\xf0\x6b\x5e\x14\xfc\x49\xc7\xa2\x1d\xdd\x21\x68\x0f\x2d\xcf\x43\x48\x71\x04\x2f\x8b\xe2\x0e\x05\x35\xf8\x45\x4b\x16\xe0\xcc\xa4\x5a\x3f\x63\x4e\xc9\x47\xed\xdb\x27\x0b\xe8\x7d\xec\x0d\x3d\x66\x67\xfd\xb0\xed\xb1\x57\x6c\xef\x4a\x3b\x62\x87\xd6\xc0\x9f\x2e\x76\xcb\xde\xd0\xf5\x4f\x88\x3d\x92\x6b\xf4\xb2\x91\xa8\x08\x69\x9a\x64\x4c\x39\x21\x71\xeb\xa8\xc5\x9f\x17\x50\x5b\xa2\x40\x91\xcf\x28\x75\x54\x10\x4c\xf3\x4a\x58\x6e\x6a\x8a\x27\x2e\x72\xf3\x60\xf3\x30\xab\x4e\x97\xad\x59\x52\x54\x41\x89\x42\x87\x4d\x9b\xe4\xb4\xd6\x6c\x2b\x9b\x36\x0c\x24\x93\x09\xe5\x98\x93\x31\x09\x24\x1c\x97\x41\x46\x30\xd0\xe6\x90\xfb\x52\xb8\xb8\xb8\xf8\x62\xad\x11\xef\x86\x4e\xd4\xd3\x03\x91\x98\x03\xd7\x08\xc0\xd7\x03\x51\x72\x6f\x2e\xb0\x68\x8e\xb9\xf7\x59\x51\x2d\x70\x9c\x4e\xbf\xb6\x2e\xdb\xaa\xe1\x0b\x15\xc9\x80\x64\x19\x4a\x19\x29\x54\xbb\xad\xa2\x40\x0b\xcb\xd7\x26\x65\xa6\x02\x73\x5f\x70\xbc\x86\xd2\xbb\x15\x84\xa5\xdd\x57\xba\x4b\xd5\x8f\x35\xe2\x4e\x1d\xf4\xca\xaa\x1f\x3c\xec\x29\x4a\x42\xae\xd2\x96\x13\x5e\x34\xe9\x95\xad\xd3\x69\xc1\x0b\x98\x5f\x5e\xfd\xb4\xfa\xf0\xfd\xe5\xd5\xea\xf2\xfb\xcb\xab\x14\x1e\x9e\x1d\xa8\x76\x95\x61\x63\x62\x6d\xd8\x1d\x6a\x15\x8b\x79\x67\x07\xba\x64\xe3\xd8\x66\x5f\x8d\xc9\x32\x75\x23\xbc\xbf\x15\x6b\x8d\xee\x2b\xf5\x62\x41\xa2\x92\x46\xec\xb6\x77\xe5\x8a\x8b\x10\x53\x46\x6b\xa1\x00\x9e\x74\x9a\xc5\x5f\x81\xc3\x13\x9a\xb7\x47\xa0\xed\xee\x8f\x35\xa5\xf6\x92\x4a\x97\xb5\x19\x29\x0a\xcc\x6d\x2b\x86\xb8\x36\xbd\x7e\x2f\x30\x43\xfa\x88\xf9\x42\x2b\x47\xa0\xa9\x80\x43\x26\xb6\x0d\xd8\x57\x2b\x78\xa8\x54\x48\xb5\x24\x2a\x9b\x5f\xf1\x27\xe6\xfb\x62\x54\x26\xf1\xc5\x59\x5b\xe4\x98\x82\xc6\x36\x20\x25\xfa\x2b\x85\x37\xee\xad\xb1\xce\x70\x82\x2c\xa5\xc1\xa5\x60\x24\xc0\x03\xae\xb9\x40\xb3\x93\xff\xf8\xf8\xf1\x76\x7e\x97\x82\x34\xb0\xa6\x81\xe4\xe0\x2d\x1a\x33\x96\x40\x74\x06\x21\xcd\xee\xdb\x0a\x2f\xf8\x33\x73\x44\x36\xa8\x00\x7f\xc3\xac\x52\x7b\x71\x4b\xc5\x4b\x7b\x0a\x4b\x3b\xb9\x20\xc8\x7a\x4d\xb3\x64\xe4\x02\xd3\xdd\x48\xc6\x9b\x30\x26\x47\xe8\x89\x8d\x4b\x01\x06\x5c\x1f\xda\x9c\x33\xb4\xb8\xcc\x6e\x98\x13\x5e\x14\x40\x32\x45\x1f\x51\x7b\x04\x86\x4e\x1c\x0b\x8d\xb6\x89\x62\x79\xed\x7d\x7f\x86\x1d\x17\x98\xf4\x6f\x53\xbb\x2c\x5f\x59\x35\xb9\xd1\x0a\x28\x28\x43\x20\x62\x63\x4a\x7a\xd8\x08\x5e\x95\x32\xb4\x42\xa9\x80\xbc\x6d\x3b\x68\x03\xb8\xb2\xcb\x7e\xa2\x0c\xdf\xdb\x97\x7f\xb7\x4b\xee\x3f\xc9\x27\xb2\x59\x4e\x7c\x77\xb4\x75\x79\xa7\xad\x8f\x32\xcc\xa1\xe0\x66\xd8\x23\x2e\x17\x7e\xb2\xaf\xc2\x9f\x8e\x27\x5f\x2e\x97\xf1\x1d\x55\x62\x87\x53\x7e\x91\xf8\x01\x73\x9e\x19\x13\xc8\x5d\x6b\xc2\xba\x06\xa2\x60\x95\xf3\x4c\xda\xe1\x82\x79\x5d\x2f\x3f\xd8\xd3\x20\x5c\x43\x6f\xb2\x39\x93\x06\xb4\xf3\x14\xea\xe4\x5f\x06\x4b\x97\x9d\xb2\xfd\xc2\xde\x2d\xb7\x1c\xb5\x9f\x5e\x9d\xab\x80\xfa\x48\xce\x94\xa8\x3c\x63\x77\xa8\xfa\x63\x02\xc1\xa1\x7a\x97\x50\xfa\x2f\x3b\x9d\x57\x9b\x94\xfc\x14\x46\x87\xa4\xe6\xbb\x90\xa8\xfb\x80\x3c\xca\x7e\xbf\xc1\x72\x01\x61\xe1\x40\x8c\x50\x82\xf9\xbc\x23\x96\x24\xf3\x1f\x5f\x4b\x12\x4f\xed\x85\x92\x04\x26\x47\x25\xb9\x2b\x31\xb3\xbb\x40\x6c\xbf\xcd\x64\x61\x4f\xb4\x28\xe0\x01\xad\xd3\xc8\x43\x6c\xcb\x0a\x8a\x4c\xc9\xe5\x89\x72\x68\x5a\x13\x73\x34\xa3\x02\x18\xd0\x0b\xc3\x96\x63\xb8\x6f\x3e\x63\x7a\x7f\x25\x0b\xea\x9b\x4f\xea\x94\xad\x59\x0d\xb7\x7c\x07\x8c\xa7\xcb\xf5\x1f\x61\x2d\x7d\x53\x79\x09\xd7\x7e\x91\xe3\xfa\x47\xd7\x00\x8d\xb9\xf5\x79\xbb\xce\xba\x2d\x5e\xd7\x26\x3d\x85\x57\x47\xc0\xf2\x18\xf7\x56\xf7\x32\xeb\x09\x5a\x26\x3f\x38\x86\x2c\xae\x6e\x93\xc3\x85\x63\xfb\xe5\x91\x14\x34\x37\x3d\x94\x13\x38\xed\x52\x99\x9b\xc2\xd8\x47\x05\x87\xdf\x89\x60\x21\x16\x2d\x39\xff\xe1\x7f\xfc\x0b\x7b\xa3\x31\x29\xd7\xf2\x32\xcf\x0d\x01\x8f\x39\xc2\xe5\x43\x8e\xc3\x85\xfe\x0b\xc6\x9b\xe3\xf3\xe1\x50\x22\x8e\x0b\x75\x8a\x1a\x3c\xdd\x79\x3c\x9f\xf1\x48\x04\x54\x2c\x32\x0c\x5f\xf0\xec\x69\x56\xd1\xf5\x88\x02\xf6\xf7\x87\x2e\x2e\x80\xd1\xc2\xdd\x06\x75\xe8\x5d\x00\x29\x4b\x64\xf9\x3c\x7e\xbb\x30\x77\x81\xd3\xf8\xcc\x7d\xcf\x48\x09\x35\x3e\x5b\x73\x3c\xbf\xa1\xb1\xf3\x4a\xfc\x7a\x7c\x87\xf8\x9d\xbc\x89\x3a\x82\xf5\xb6\x70\x3d\x85\xe9\x91\x1b\xda\x51\x49\xda\x1b\xa3\x11\xea\xa1\x08\xd1\x18\x0e\xc9\xda\x2f\xfa\xa6\x44\xfc\x5a\x45\xe0\x49\x5b\xfb\x4a\xf3\x20\x8e\x87\x31\x15\x59\x4d\x14\xc8\x3a\xd4\x53\xf8\x4f\x78\xeb\x78\x75\x3e\x55\xbb\x23\x53\x42\xad\xe7\xb3\x1d\x95\x52\xbb\xf1\xd8\x77\x9c\xc3\xdf\xe4\xcc\x77\xdf\xe4\xf2\xbf\x38\x65\x7d\x81\x16\x30\x4b\x2d\x0b\x49\x7c\x33\x9b\x34\x49\xa7\x30\xfc\xd1\xf4\xf4\x4d\x6e\x61\x1d\x46\x5c\x2c\x13\xd8\xd0\x47\x64\x51\x29\x4d\xf3\xd3\x12\x8b\x88\xdc\x3c\x60\xbb\xb9\x0e\xd9\xd1\x0b\xab\xc4\x78\x74\x77\x68\x58\x2d\x39\x2b\x6d\xa7\x41\x2f\x83\xc4\xda\xf7\x92\xce\xa7\x90\x45\xe9\x7c\x86\xae\xa9\x8e\xa1\xfe\xce\xc1\xce\x7a\x9c\x14\x45\x07\xf4\xe7\x0e\x59\x7c\xc3\xa8\x49\x06\x1f\x71\x67\xbe\xa7\x63\x37\x90\xdd\x4b\x8b\xfa\x70\x57\x49\x2b\x4a\xea\xfc\xe5\xfc\x62\x72\x24\xb7\x83\x34\xb5\x57\xab\x60\x62\xe8\xf9\x85\x3b\xd3\x9e\x65\x6b\xa7\xf2\x89\xaa\x6c\x6b\x41\xea\xe8\x42\xfe\x98\x89\x9c\x8c\x48\x33\x07\xb2\xbc\xb9\x6e\x9a\xd9\x60\x78\x6e\x7c\x52\xc7\x4b\x71\xaf\x49\x7e\x82\x8b\x91\x6d\x1f\xde\x1c\xba\x76\x9e\x2e\x86\xe7\x80\xbf\xc6\x3d\xbb\x59\x54\x27\xce\x20\x85\xa6\x09\x83\x3a\x36\xb4\x87\x8e\x7a\xe8\x0d\x46\x2b\x06\xa3\x0f\x10\x0f\x96\xb5\xd3\x12\xc7\x39\xf5\x97\x70\x39\xc2\x61\x34\x28\x19\x68\xa7\x1d\xad\x76\x06\x48\x0e\x4d\xed\x80\xdb\x6a\xbd\xf5\x6e\xd3\xad\xd2\x3b\xa2\x1e\xd8\x8b\x91\xdb\x49\x67\xf4\xe6\x64\x2c\x1c\xe6\xe5\x0d\x5b\xc0\x8b\x37\xa9\x37\xfe\xf3\x6d\xec\x8b\x61\xea\x0b\xb6\xa2\x3b\xcd\x73\x9c\xc1\x0f\x6f\x31\x5d\x5e\xfa\x45\x2a\x1d\x9b\x0f\xfa\x86\x74\xec\xd9\x7b\xa1\xae\xdd\x48\xa4\x9d\x21\x72\xa1\xd9\x71\x6d\x15\x9d\xf4\xc7\xa7\xa3\xa0\xd9\xc1\x67\x33\xfc\xb8\x59\x3e\x5e\x7e\xb5\x43\x45\xa7\x06\x0d\xbb\x7a\x9e\x8e\xb4\xe3\x8f\xf5\xfc\x13\x21\xb2\xd3\xed\x7f\xa1\xe4\x61\x9c\xa6\x13\x49\xb3\x30\x64\x33\x0c\xa2\x6d\xc1\x2c\xcd\xaf\xbf\x7e\xbe\xf9\xf9\x07\xf3\x68\xc7\xe3\xd0\x96\x83\x02\x81\x6e\x18\xd7\xaa\xdb\xa2\xc0\x93\x5a\x18\x31\x6f\x6d\x13\x26\x36\xe5\x3d\x23\x40\x1d\x9d\x76\xcb\xa1\xc3\x21\xd4\x23\x59\x98\xfc\xae\x25\x9d\xfa\x70\xfa\xcf\x05\xec\x54\x1b\x4f\x23\xe6\x3a\x21\x75\xa7\xdc\x73\x14\x4e\xc7\x7f\xc0\xb1\xe7\xf2\x3b\x0e\xb3\xdd\xfb\xef\x28\xde\x3a\xff\x32\x04\x19\xf7\x36\x7b\x8b\xb5\xa3\x66\xf2\x4c\x2a\x6a\x52\xe0\x6c\x01\xfc\xb3\xd6\xc5\x90\x4c\x6f\x64\xeb\x7e\xa7\x3e\x7d\xa7\x81\xdb\x21\x43\xc3\xf5\x4e\x69\x2e\xb3\x57\x3b\xce\x61\xea\xab\x63\xd4\x65\x98\x05\xfb\x33\x8d\x3a\xe6\xed\x68\xa3\x0e\x65\x6e\x6c\xd4\xdd\x9a\xf9\xb0\x51\x7b\x24\xaf\x66\xd4\x1d\xcb\x1d\xfe\x3a\xe6\xdb\x31\xec\x68\xda\x63\x32\xa0\x4c\x18\x77\x79\xc8\xb8\xc3\x7e\xee\x37\xee\xf2\xd5\x8c\xdb\xff\x8c\xa4\xad\xf5\xe2\x09\xc3\x60\xdb\xe1\x1a\xbd\xad\xf7\x76\xa8\xb6\x3c\x77\x23\x26\x6a\x7b\x8a\xf5\xb6\xc4\xe7\x16\xdb\xc2\xa0\x6a\xf3\xb7\x98\x97\x85\x19\x6e\xb4\xb9\xc5\x68\xd3\x20\x0c\x8a\x76\x4a\xfc\x78\xf2\xd8\xde\xb3\x58\xa5\x55\x3b\x93\xc5\xba\x32\xf9\x23\xff\xa5\x2c\xd1\xb3\x91\x5a\x12\xff\x9c\xde\x2d\x4f\xeb\xbe\xda\x7d\xfa\x0e\xfe\x12\xf6\x69\x8a\x9a\xde\x7b\x62\x7b\x34\xb3\xd5\xcc\x01\xdb\x37\x30\x9b\x39\xa0\xed\x71\xf4\xee\xf5\xba\x4f\xed\xce\x9a\x65\x6d\x00\x36\x23\xb5\x71\xde\xd1\x8e\x91\x86\x89\xdb\xbd\xd7\xdd\x27\xf6\x17\x1d\xe9\x79\x3a\x36\xc7\x3b\xbd\x6b\x9e\xa5\xce\xa6\xed\x01\xeb\xfc\x26\x05\x9f\x3e\xf0\x4a\x91\x87\x02\x3d\xf5\xf1\x7b\x88\xc5\x10\xe3\x42\x93\xeb\x77\x41\xb4\x5b\x88\xc1\xa0\xa5\xac\x15\x7c\x82\x56\x74\xd2\xe5\x0c\xf8\x8a\x64\x5b\x9c\x4f\x75\x90\x5b\xf5\xad\x56\x90\x73\xf6\x6f\x0a\x32\xbd\x65\xe4\x81\x57\xca\xe5\x8f\xfa\x7c\x2f\xe0\xff\x2a\xa9\xdc\xb8\xcd\x16\x0d\x01\xe3\x08\xfd\x40\x43\x59\x22\x33\xe3\xe7\xde\xb3\x8f\x76\xdc\x86\x72\x8e\x1f\x9f\x7d\xc7\xec\xe8\xdf\x38\x3b\xfb\x3e\xd8\x06\x9c\x66\xea\x5e\x6b\x58\x50\xa6\xd6\x30\xfb\xdb\xaf\x33\x98\x57\xfa\xb8\x6a\x1f\x6e\xce\xab\xf9\xed\x44\x8f\xef\x2f\x44\x36\x10\x6e\x4c\xa2\x3d\x07\xf5\x30\x8d\x7b\x5b\xe0\x98\xd2\x46\x7b\x02\xed\x18\x9a\x66\x36\xeb\xf6\x5a\x63\x1c\x59\x81\x84\x19\x58\xb3\x22\x8d\x9b\x9e\x36\x80\x9d\x3a\x3e\x32\xf5\xdb\xf9\x91\xf3\xe4\xce\xc3\xc8\x91\x5a\x4e\xfe\x70\x6e\x5f\xd3\xd6\xd4\x5e\xfb\xda\xa5\xfb\x47\xa7\xfc\x5d\xa8\x78\xc4\xe8\xff\x0c\xd0\x9b\x15\xfa\x95\x8a\xdb\xab\x50\xfb\x1b\xae\xdb\x1b\xe0\x8f\x28\xcc\x68\x85\x5e\x9a\x11\x06\x0f\x08\x95\xc4\x1c\x72\x2a\x30\x53\xc5\x33\x50\x66\xe3\xe0\x4f\xba\x62\x63\x97\x2c\x37\x04\xe6\xb3\xf3\xff\x78\xfb\xf6\xed\x6c\x01\xa4\xa4\xb6\x97\x38\xd7\x5e\x24\x3d\xb9\xf3\x39\x7f\xb0\x83\xfd\x70\x68\xd6\xdf\x79\x8d\xa1\x51\xdf\x30\xaa\xec\x74\xc6\xc8\x11\x6a\x9a\x65\xf4\xcb\x82\xbf\x8c\xc4\xc5\x31\x94\xed\x12\xcf\x5e\xda\x86\xb1\x03\x23\x03\x3d\xe4\x13\xc6\xa3\x8b\x4c\x27\x58\x3b\x91\xd0\xa3\xf5\x02\x1c\xed\x52\x6b\x0d\x5a\x27\x7e\xb6\xe7\x99\x57\xda\x00\x8c\xd3\x0c\xbe\xd2\x9a\x82\xb7\x8f\x4c\x3b\xe6\x45\x18\x5f\x52\x5b\xd4\xc9\x54\xc6\x77\x25\x97\xd8\x0f\xa1\xc4\xa2\x94\x88\xb0\xa6\xea\x94\x8d\xb7\x3b\xe6\x23\xa2\xce\x9e\xa7\xdd\x48\xaa\xbd\xda\xdb\x49\x5f\x3c\x8c\x2e\xe1\xa7\x43\xed\xed\x6a\xa8\x61\xbb\x1a\x21\x79\x0e\x73\x2e\xcc\x61\x10\x34\xc7\xb4\x3f\x5a\x4e\xa2\x3a\xe6\xa4\xe2\xa4\xcf\xc0\x60\xf4\x61\xd1\x12\x1c\xfc\x07\x12\x13\x61\x72\x50\x03\x7a\x94\xa6\xe6\xf3\x25\x67\x57\x01\xa1\xde\x39\xac\x80\xce\x90\xf9\xab\x29\xc0\x33\x30\xa2\x80\x72\x6a\x96\x7c\xbf\x02\xa2\x3a\x21\x56\x80\xc7\xe6\x1b\x51\x79\xde\x9e\x65\x9d\xe2\x93\x3c\x0f\xde\x31\xb2\x69\xc5\x01\x7f\xa3\xd2\x0c\xaf\xf9\xa9\xbe\x53\xfa\x52\x3d\x72\x63\x49\xfd\x02\xf6\x79\xbc\xfa\xb8\xc4\xfc\x70\x2a\x3d\xd4\x9b\xf3\x93\x66\xfd\x8b\x12\xed\xa8\x0a\xdb\x03\x6e\xf9\x73\x4b\xe0\xc2\x4b\x39\xdf\xfa\x13\xf9\xff\x01\x00\x00\xff\xff\xe7\x4d\x86\x07\xa7\x49\x00\x00")
func templatesServerBuilderGotmplBytes() ([]byte, error) {
@@ -713,7 +881,7 @@ func templatesServerMainGotmpl() (*asset, error) {
return a, nil
}
-var _templatesServerOperationGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x57\x4b\x6f\xdb\xc6\x13\xbf\xf3\x53\xcc\x5f\xf8\x23\xa0\x0c\x99\xbc\x3b\xf0\x21\xb5\x53\xc4\x87\x3a\x82\x2d\xb4\xc7\x62\x4d\x0e\xc9\x45\xc8\x5d\x66\x76\x68\x59\x21\xf8\xdd\x8b\x7d\x50\xa2\x1c\x5a\x0a\xfa\x00\x8a\x9e\xec\xe5\xce\xce\xe3\x37\xbf\x79\x28\x4d\xe1\x46\xe7\x08\x25\x2a\x24\xc1\x98\xc3\xd3\x0e\x4a\x7d\x69\xb6\xa2\x2c\x91\xde\xc3\xed\x67\xb8\xff\xbc\x81\x8f\xb7\x77\x9b\x24\x8a\xa2\xbe\x07\x59\x40\x72\xa3\xdb\x1d\xc9\xb2\x62\xb8\x1c\x86\x34\x85\xbe\x87\x4c\x37\x0d\x2a\x7e\x75\xd7\xf7\x80\x2a\x87\x61\x88\xa2\xa8\x15\xd9\x17\x51\xa2\x15\x4e\xd6\xe1\x7f\x7b\x91\xa6\xb0\xa9\xa4\x81\x42\xd6\x08\x5b\x61\x8e\x9d\xe1\x0a\x21\x78\x03\xac\x75\x9d\x58\xf9\x8f\xb9\x64\xa9\x4a\xe0\xfd\xbb\xc6\x59\x6c\x49\x3f\x23\x14\x1d\x3b\x55\x15\x2a\xd8\xe9\x0e\x08\x2f\xa9\x53\x4e\xd3\xa8\xda\xb9\x2b\x54\x1e\x45\xb2\x69\x35\x31\xc4\x11\xc0\x42\x21\xa7\x15\x73\xbb\x88\xec\xa9\x94\x5c\x75\x4f\x49\xa6\x9b\xb4\xd4\x97\xba\x45\x25\x5a\x99\x22\x91\x26\xb3\x78\x5b\x80\x3a\xc5\xb2\xc1\xb4\x91\x79\x5e\xe3\x56\x10\xfe\x80\xb0\xc1\xac\x23\xc9\xbb\x13\xa2\x86\xa9\x68\xf8\x94\xc0\x56\x94\x27\xae\x9f\x45\x2d\x73\xc1\xe8\x82\xb3\x79\x74\x81\x1b\x48\x6e\xb1\x10\x5d\xcd\x77\xe1\x3c\x0c\xaf\xee\x27\x17\x4b\x97\xad\xbe\x87\x56\x98\x4c\xd4\xf2\x1b\x42\x72\x2f\x1a\x9b\xc7\x4f\x42\xe5\x35\xd2\xcf\x9d\xca\x80\x3b\x52\x06\x04\x14\x9d\xca\x58\x6a\x05\x5b\xc9\x95\xc3\xdf\x13\xc3\xc8\x52\x09\xee\x08\x41\x2a\xd6\x20\xac\xc6\xaa\x6b\x84\x9a\x2a\x84\xca\x6b\x8c\x78\xd7\xe2\x79\x9b\xd6\x56\x3c\x2b\xb5\x16\x24\x1a\x13\x98\xfb\xa1\xe3\x4a\x93\xfc\x86\x96\x94\x2b\x08\x5f\xd7\x24\x55\x26\x5b\x51\xdf\x99\xfb\xae\xae\xc5\x53\x6d\x1f\x5e\xec\xd9\xeb\x28\x3b\xca\xc0\x84\xd6\xcb\xa0\xe1\xff\xc9\x23\x93\xcc\xf8\x01\x4d\xab\x55\x8e\x64\xe1\x9a\x77\x7a\x2f\x02\x7d\x8f\xb5\xc1\x61\x80\x03\x55\x92\xa3\x5b\x95\x87\xfa\xf0\x81\x02\xbe\x60\xd6\x05\xe2\x23\x10\x7e\xed\xd0\x30\x08\x95\x03\xa1\xc5\xdc\xde\x08\x20\xa7\xc2\x60\x64\x21\x81\xb8\x50\x67\xc1\x5b\x06\x03\x71\xeb\xa0\x9a\x97\x3f\x05\x63\xbb\xc7\xe6\xdf\x0f\x28\xf4\x11\x04\xbc\xa0\x50\x21\xe4\x33\x61\x1d\xdc\x8b\x86\xb3\x25\x60\x49\x8d\x54\x88\x0c\xa1\xd0\x04\x5c\x09\x86\x4c\xa8\xc0\x67\x70\x75\x38\xcf\x78\xef\xcb\x79\xc2\x4f\x2c\xd8\x60\x42\xf2\xfe\x8b\xe4\xf7\x68\xdf\xe3\x76\x56\x1b\x64\x84\x82\xd1\xb6\x1a\x85\x5b\xb0\xad\x3b\x19\x21\xf2\xd0\xe3\x3c\xd0\xba\xb5\x53\x40\x6a\xe5\x6b\xe4\x2d\xfd\x71\xc6\x2f\x70\x31\x71\xf0\x46\x2b\xc6\x17\x5e\x8d\xbd\xe9\x64\x96\x96\x70\x31\xef\xf5\x84\x80\xef\x66\x25\xfa\x60\xe7\x0a\x32\x7e\x59\x85\xfc\xd2\xd5\x68\xd5\xc3\x72\x31\x6f\x7c\x1c\x96\x57\xa4\x3b\xf6\xc3\xf6\x17\xe4\x4a\xe7\x21\x27\xc9\x5a\x70\xe5\xb3\x48\x42\x95\x08\xc9\x46\x94\x63\xc2\x92\x69\x7a\xdd\x54\x17\x0d\x1e\xa9\xdf\xaf\x00\x8f\x5d\xd3\x08\xda\x05\x7e\x1c\x9d\xec\xf5\x2d\x9a\x8c\x64\xeb\xba\x7f\x78\xf5\x54\xeb\xec\xcb\x7e\x4d\x38\x16\x98\x92\xcd\xf2\xe2\xb5\x0e\x77\x71\x4e\x81\x7d\xe7\xfe\x9b\xc3\x7c\x8e\x06\x1f\xd6\x77\x93\x05\xe5\x22\x3d\x51\x79\x60\x98\xba\x8c\x5d\xee\x42\x76\xe6\x98\xb1\xaf\xc6\xd3\xd4\xb0\x09\xf4\xdd\xd9\x82\xf7\x80\x19\xca\x67\xa4\xd1\xd4\x3c\x6d\x96\xf0\x88\xf4\x8c\x9f\x36\x9b\x75\x4c\x81\xec\x0f\xa1\xd5\xff\x46\x92\x91\x56\x40\x70\x11\xbe\xbb\xd1\xb0\xf4\x54\xb3\x44\x58\x01\xdd\x58\x2e\xfd\x0e\x57\xd7\x30\x63\x74\x0c\x20\x79\xb0\xd2\x77\xaa\xd0\x31\x2d\x23\xb0\x79\xb0\x0f\xe1\x7f\xd7\xa0\x64\xed\xf4\x01\x10\x5c\xbb\xaf\x11\x80\x5d\x16\x9e\x05\x81\xef\x33\x70\xfd\x66\x2d\x79\x81\x78\xe9\xb7\x8f\xcb\xef\xfb\x51\x04\xd0\xb9\x86\xbb\x02\xe1\x5c\x45\xa2\x73\xce\xee\x15\xc4\x36\x78\xeb\x79\xf0\xd9\xbe\x3d\x72\xf9\x64\xc8\xbe\xed\xc4\xb4\x5d\xc1\xa8\x27\x59\x93\xce\xbb\x0c\xcd\x6a\xc4\x0f\xc9\x01\x32\x96\x6e\x88\x5d\x16\xce\xdb\xef\xf1\x11\xc7\xf8\xfc\xe5\x09\xe9\x6d\x79\x84\x8e\xad\x1d\x54\x5f\x07\xe5\xf8\x75\xfa\x76\x21\x55\xe1\xa7\x45\x3f\x2c\x60\x18\xbc\x8e\x43\xc1\xf8\x73\x12\xff\x49\xc7\x96\x90\xa6\x7e\x11\x97\x06\x08\x45\x5d\xef\xfc\x46\x77\x24\xb5\x82\x3b\xbb\x9d\x37\xd2\xe0\xa1\xe4\x3c\x3c\xd3\x73\x48\xdd\x99\xb4\xff\x24\x55\xfe\xab\x1d\xa3\x81\xe7\xfb\xec\xaf\xe0\x9d\xe7\xd9\xf2\xfd\x11\x05\xac\x8b\x4f\x52\xe5\xe3\x84\xfd\xe7\x18\xe1\x5a\xbb\x79\x2b\x80\x50\xfe\xe1\x6f\xfc\x43\x2b\xd5\x64\xdc\xa6\x29\x88\x8c\x3b\x07\x71\xd8\x26\x26\x8b\x60\xf4\x77\xc4\x44\x68\x96\x51\xe4\x1b\x76\x98\x0f\x1f\x5f\x98\xc4\x63\x56\x61\x23\xdc\x8f\x00\xbf\xfe\x4c\x3b\x2b\x63\xd3\xd6\xf6\x57\xd5\x22\xd7\x99\x61\x92\xaa\x5c\xb8\x59\x12\xa5\xa9\x15\x1f\x47\x52\xa3\x73\xac\xa7\x8f\x43\x2f\x38\xbc\x37\xce\x4c\x78\x6c\xaf\x02\x33\xfe\x08\x00\x00\xff\xff\x9c\x28\xa4\x7b\xa8\x0e\x00\x00")
+var _templatesServerOperationGotmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x57\x4b\x6f\xdb\x46\x10\xbe\xf3\x57\x4c\x85\x22\xa0\x04\x99\xbc\x3b\xf0\x21\xb5\x53\xc4\x87\x3a\x82\x6d\xb4\xc7\x62\x4d\x0e\xc9\x45\xc8\x5d\x66\x76\x68\x59\x21\xf8\xdf\x8b\x7d\x50\xa2\x5c\x5a\x0a\xfa\x00\x8a\x9e\xec\xe5\xce\xce\xe3\x9b\x6f\x1e\x4a\x53\xb8\xd6\x39\x42\x89\x0a\x49\x30\xe6\xf0\xb4\x83\x52\x5f\x98\xad\x28\x4b\xa4\xf7\x70\xf3\x19\xee\x3e\x3f\xc2\xc7\x9b\xdb\xc7\x24\x8a\xa2\xbe\x07\x59\x40\x72\xad\xdb\x1d\xc9\xb2\x62\xb8\x18\x86\x34\x85\xbe\x87\x4c\x37\x0d\x2a\x7e\x75\xd7\xf7\x80\x2a\x87\x61\x88\xa2\xa8\x15\xd9\x17\x51\xa2\x15\x4e\x36\xe1\x7f\x7b\x91\xa6\xf0\x58\x49\x03\x85\xac\x11\xb6\xc2\x1c\x3b\xc3\x15\x42\xf0\x06\x58\xeb\x3a\xb1\xf2\x1f\x73\xc9\x52\x95\xc0\xfb\x77\x8d\xb3\xd8\x92\x7e\x46\x28\x3a\x76\xaa\x2a\x54\xb0\xd3\x1d\x10\x5e\x50\xa7\x9c\xa6\x51\xb5\x73\x57\xa8\x3c\x8a\x64\xd3\x6a\x62\x88\x23\x80\x85\x42\x4e\x2b\xe6\x76\x11\xd9\x53\x29\xb9\xea\x9e\x92\x4c\x37\x69\xa9\x2f\x74\x8b\x4a\xb4\x32\x45\x22\x4d\x66\xf1\xb6\x00\x75\x8a\x65\x83\x69\x23\xf3\xbc\xc6\xad\x20\xfc\x0e\x61\x83\x59\x47\x92\x77\x27\x44\x0d\x53\xd1\xf0\x29\x81\xad\x28\x4f\x5c\x3f\x8b\x5a\xe6\x82\xd1\x05\x67\xf3\xe8\x02\x37\x90\xdc\x60\x21\xba\x9a\x6f\xc3\x79\x18\x5e\xdd\x4f\x2e\x96\x2e\x5b\x7d\x0f\xad\x30\x99\xa8\xe5\x37\x84\xe4\x4e\x34\x36\x8f\x9f\x84\xca\x6b\xa4\x9f\x3b\x95\x01\x77\xa4\x0c\x08\x28\x3a\x95\xb1\xd4\x0a\xb6\x92\x2b\x87\xbf\x27\x86\x91\xa5\x12\xdc\x11\x82\x54\xac\x41\x58\x8d\x55\xd7\x08\x35\x55\x08\x95\xd7\x18\xf1\xae\xc5\xf3\x36\xad\xad\x78\x56\x6a\x23\x48\x34\x26\x30\xf7\x43\xc7\x95\x26\xf9\x0d\x2d\x29\xd7\x10\xbe\x6e\x48\xaa\x4c\xb6\xa2\xbe\x35\x77\x5d\x5d\x8b\xa7\xda\x3e\x5c\xed\xd9\xeb\x28\x3b\xca\xc0\x84\xd6\xcb\xa0\xe1\xc7\xe4\x81\x49\x66\x7c\x8f\xa6\xd5\x2a\x47\xb2\x70\xcd\x3b\xbd\x17\x81\xbe\xc7\xda\xe0\x30\xc0\x81\x2a\xc9\xd1\xad\xca\x43\x7d\xf8\x40\x01\x5f\x30\xeb\x02\xf1\x11\x08\xbf\x76\x68\x18\x84\xca\x81\xd0\x62\x6e\x6f\x04\x90\x53\x61\x30\xb2\x90\x40\x5c\xa8\xb3\xe0\x2d\x83\x81\xb8\x75\x50\xcd\xcb\x9f\x82\xb1\xdd\x63\xf3\xdf\x07\x14\xfa\x08\x02\x5e\x50\xa8\x10\xf2\x99\xb0\x0e\xee\x45\xc3\xd9\x12\xb0\xa4\x46\x2a\x44\x86\x50\x68\x02\xae\x04\x43\x26\x54\xe0\x33\xb8\x3a\x9c\x67\xbc\xf7\xe5\x3c\xe1\x27\x16\x6c\x30\x21\x79\xff\x47\xf2\x7b\xb4\xef\x70\x3b\xab\x0d\x32\x42\xc1\x68\x5b\x8d\xc2\x2d\xd8\xd6\x9d\x8c\x10\x79\xe8\x71\x1e\x68\xdd\xda\x29\x20\xb5\xf2\x35\xf2\x96\xfe\x38\xe3\x17\x58\x4d\x1c\xbc\xd6\x8a\xf1\x85\xd7\x63\x6f\x3a\x99\xa5\x25\xac\xe6\xbd\x9e\x10\xf0\xdd\xac\x44\x1f\xec\x5c\x42\xc6\x2f\xeb\x90\x5f\xba\x1c\xad\x7a\x58\x56\xf3\xc6\xc7\x61\x79\x49\xba\x63\x3f\x6c\x7f\x41\xae\x74\x1e\x72\x92\x6c\x04\x57\x3e\x8b\x24\x54\x89\x90\x3c\x8a\x72\x4c\x58\x32\x4d\xaf\x9b\xea\xa2\xc1\x23\xf5\xfb\x15\xe0\xa1\x6b\x1a\x41\xbb\xc0\x8f\xa3\x93\xbd\xbe\x41\x93\x91\x6c\x5d\xf7\x0f\xaf\x9e\x6a\x9d\x7d\xd9\xaf\x09\xc7\x02\x53\xb2\x59\x5e\xbc\xd6\xe1\x2e\xce\x29\xb0\xef\xdc\x7f\x73\x98\xcf\xd1\xe0\xc3\xe6\x76\xb2\xa0\xac\xd2\x13\x95\x07\x86\xa9\xcb\xd8\xe5\x2e\x64\x67\x8e\x19\xfb\x6a\x3c\x4d\x0d\x9b\x40\xdf\x9d\x2d\x78\xf7\x98\xa1\x7c\x46\x1a\x4d\xcd\xd3\x66\x09\x0f\x48\xcf\xf8\xe9\xf1\x71\x13\x53\x20\xfb\x7d\x68\xf5\xbf\x91\x64\xa4\x35\x10\xac\xc2\x77\x37\x1a\x96\x9e\x6a\x96\x08\x6b\xa0\x6b\xcb\xa5\xdf\xe1\xf2\x0a\x66\x8c\x8e\x01\x24\xf7\x56\xfa\x56\x15\x3a\xa6\x65\x04\x36\x0f\xf6\x21\xfc\x70\x05\x4a\xd6\x4e\x1f\xc0\x8a\xe0\x0a\x56\xf6\x7b\x04\x60\xd7\x85\x67\x41\xe0\x3b\x0d\x5c\xbd\x59\x4d\x5e\x20\x5e\xfa\xfd\xe3\xe2\xcf\x1d\x29\x02\xe8\x5c\xcb\x5d\x83\x70\xce\x22\xd1\x39\x77\xf7\x0a\x62\x1b\xbe\xf5\x3d\x78\x6d\xdf\x1e\x39\x7d\x32\x68\xdf\x78\x62\xda\xae\x61\xd4\x93\x6c\x48\xe7\x5d\x86\x66\x3d\x22\x88\xe4\x20\x19\x8b\x37\xc4\x2e\x0b\xe7\xed\x1c\x42\xe2\x18\xa1\xbf\x3d\x25\xbd\x35\x8f\xd1\xb1\xbd\x83\xea\xab\xa0\x1c\xbf\x4e\xdf\x2e\xa4\x2a\xfc\xc4\xe8\x87\x05\x0c\x83\xd7\x71\x28\x1a\x7f\x4e\xe2\xbf\xe8\xd8\x12\xd2\xd4\x2f\xe3\xd2\x00\xa1\xa8\xeb\x9d\xdf\xea\x8e\xa4\xd6\x70\x6b\x37\xf4\x46\x1a\x3c\x94\x9d\x87\x67\x7a\x0e\xc9\x3b\x93\xf8\x9f\xa4\xca\x7f\xb5\xa3\x34\x70\x7d\x9f\xff\x35\xbc\xf3\x4c\x5b\xbe\x3f\x22\x81\x75\xf1\x49\xaa\x7c\x9c\xb2\xff\x1e\x27\x5c\x7b\x37\x6f\x05\x10\x5a\x40\xf8\x1b\x7f\xd7\x5a\x35\x19\xb9\x69\x0a\x22\xe3\xce\x41\x1c\x36\x8a\xc9\x32\x18\xfd\x13\x31\x11\x9a\x65\x14\xf9\xa6\x1d\x66\xc4\xc7\x17\x26\xf1\x90\x55\xd8\x08\xf7\x43\xc0\xaf\x40\xd3\xee\xca\xd8\xb4\xb5\xfd\x65\xb5\xc8\x75\x66\x98\xa4\x2a\x17\x6e\x9e\x44\x69\x6a\xc5\xc7\xb1\xd4\xe8\x1c\xeb\xe9\xe3\xd0\x0d\x0e\xef\x8d\x33\x13\x1e\xdb\xab\xc0\x8c\x3f\x02\x00\x00\xff\xff\x85\x61\x25\x9c\xac\x0e\x00\x00")
func templatesServerOperationGotmplBytes() ([]byte, error) {
return bindataRead(
@@ -728,8 +896,8 @@ func templatesServerOperationGotmpl() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "templates/server/operation.gotmpl", size: 3752, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
- a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x12, 0x9e, 0xc1, 0x15, 0xfc, 0x9c, 0x4f, 0x16, 0xa3, 0xd7, 0x49, 0xc2, 0xf, 0x43, 0x7d, 0x78, 0xd6, 0x19, 0x4f, 0xd5, 0xb1, 0x2a, 0xd7, 0xee, 0x51, 0xb6, 0xa9, 0xc6, 0x7d, 0xe0, 0x46, 0x5c}}
+ info := bindataFileInfo{name: "templates/server/operation.gotmpl", size: 3756, mode: os.FileMode(0644), modTime: time.Unix(1482416923, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3a, 0x3d, 0x51, 0x65, 0x5d, 0x48, 0x91, 0xc0, 0x3, 0x29, 0x44, 0x80, 0x90, 0xa4, 0x30, 0xfd, 0x22, 0xa3, 0x4b, 0x5d, 0x83, 0x23, 0x7, 0x64, 0xb5, 0x6b, 0x91, 0x72, 0x2b, 0x78, 0x19, 0xcb}}
return a, nil
}
@@ -1104,6 +1272,13 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
+ "templates/cli/cli.gotmpl": templatesCliCliGotmpl,
+ "templates/cli/main.gotmpl": templatesCliMainGotmpl,
+ "templates/cli/modelcli.gotmpl": templatesCliModelcliGotmpl,
+ "templates/cli/operation.gotmpl": templatesCliOperationGotmpl,
+ "templates/cli/registerflag.gotmpl": templatesCliRegisterflagGotmpl,
+ "templates/cli/retrieveflag.gotmpl": templatesCliRetrieveflagGotmpl,
+ "templates/cli/schema.gotmpl": templatesCliSchemaGotmpl,
"templates/client/client.gotmpl": templatesClientClientGotmpl,
"templates/client/facade.gotmpl": templatesClientFacadeGotmpl,
"templates/client/parameter.gotmpl": templatesClientParameterGotmpl,
@@ -1130,6 +1305,7 @@ var _bindata = map[string]func() (*asset, error){
"templates/serializers/schemaserializer.gotmpl": templatesSerializersSchemaserializerGotmpl,
"templates/serializers/subtypeserializer.gotmpl": templatesSerializersSubtypeserializerGotmpl,
"templates/serializers/tupleserializer.gotmpl": templatesSerializersTupleserializerGotmpl,
+ "templates/server/autoconfigureapi.gotmpl": templatesServerAutoconfigureapiGotmpl,
"templates/server/builder.gotmpl": templatesServerBuilderGotmpl,
"templates/server/configureapi.gotmpl": templatesServerConfigureapiGotmpl,
"templates/server/doc.gotmpl": templatesServerDocGotmpl,
@@ -1196,11 +1372,20 @@ type bintree struct {
var _bintree = &bintree{nil, map[string]*bintree{
"templates": {nil, map[string]*bintree{
+ "cli": {nil, map[string]*bintree{
+ "cli.gotmpl": {templatesCliCliGotmpl, map[string]*bintree{}},
+ "main.gotmpl": {templatesCliMainGotmpl, map[string]*bintree{}},
+ "modelcli.gotmpl": {templatesCliModelcliGotmpl, map[string]*bintree{}},
+ "operation.gotmpl": {templatesCliOperationGotmpl, map[string]*bintree{}},
+ "registerflag.gotmpl": {templatesCliRegisterflagGotmpl, map[string]*bintree{}},
+ "retrieveflag.gotmpl": {templatesCliRetrieveflagGotmpl, map[string]*bintree{}},
+ "schema.gotmpl": {templatesCliSchemaGotmpl, map[string]*bintree{}},
+ }},
"client": {nil, map[string]*bintree{
- "client.gotmpl": {templatesClientClientGotmpl, map[string]*bintree{}},
- "facade.gotmpl": {templatesClientFacadeGotmpl, map[string]*bintree{}},
+ "client.gotmpl": {templatesClientClientGotmpl, map[string]*bintree{}},
+ "facade.gotmpl": {templatesClientFacadeGotmpl, map[string]*bintree{}},
"parameter.gotmpl": {templatesClientParameterGotmpl, map[string]*bintree{}},
- "response.gotmpl": {templatesClientResponseGotmpl, map[string]*bintree{}},
+ "response.gotmpl": {templatesClientResponseGotmpl, map[string]*bintree{}},
}},
"contrib": {nil, map[string]*bintree{
"stratoscale": {nil, map[string]*bintree{
@@ -1210,56 +1395,57 @@ var _bintree = &bintree{nil, map[string]*bintree{
}},
"server": {nil, map[string]*bintree{
"configureapi.gotmpl": {templatesContribStratoscaleServerConfigureapiGotmpl, map[string]*bintree{}},
- "server.gotmpl": {templatesContribStratoscaleServerServerGotmpl, map[string]*bintree{}},
+ "server.gotmpl": {templatesContribStratoscaleServerServerGotmpl, map[string]*bintree{}},
}},
}},
}},
"docstring.gotmpl": {templatesDocstringGotmpl, map[string]*bintree{}},
- "header.gotmpl": {templatesHeaderGotmpl, map[string]*bintree{}},
+ "header.gotmpl": {templatesHeaderGotmpl, map[string]*bintree{}},
"markdown": {nil, map[string]*bintree{
"docs.gotmpl": {templatesMarkdownDocsGotmpl, map[string]*bintree{}},
}},
- "model.gotmpl": {templatesModelGotmpl, map[string]*bintree{}},
- "schema.gotmpl": {templatesSchemaGotmpl, map[string]*bintree{}},
- "schemabody.gotmpl": {templatesSchemabodyGotmpl, map[string]*bintree{}},
- "schemaembedded.gotmpl": {templatesSchemaembeddedGotmpl, map[string]*bintree{}},
+ "model.gotmpl": {templatesModelGotmpl, map[string]*bintree{}},
+ "schema.gotmpl": {templatesSchemaGotmpl, map[string]*bintree{}},
+ "schemabody.gotmpl": {templatesSchemabodyGotmpl, map[string]*bintree{}},
+ "schemaembedded.gotmpl": {templatesSchemaembeddedGotmpl, map[string]*bintree{}},
"schemapolymorphic.gotmpl": {templatesSchemapolymorphicGotmpl, map[string]*bintree{}},
- "schematype.gotmpl": {templatesSchematypeGotmpl, map[string]*bintree{}},
- "schemavalidator.gotmpl": {templatesSchemavalidatorGotmpl, map[string]*bintree{}},
+ "schematype.gotmpl": {templatesSchematypeGotmpl, map[string]*bintree{}},
+ "schemavalidator.gotmpl": {templatesSchemavalidatorGotmpl, map[string]*bintree{}},
"serializers": {nil, map[string]*bintree{
"additionalpropertiesserializer.gotmpl": {templatesSerializersAdditionalpropertiesserializerGotmpl, map[string]*bintree{}},
- "aliasedserializer.gotmpl": {templatesSerializersAliasedserializerGotmpl, map[string]*bintree{}},
- "allofserializer.gotmpl": {templatesSerializersAllofserializerGotmpl, map[string]*bintree{}},
- "basetypeserializer.gotmpl": {templatesSerializersBasetypeserializerGotmpl, map[string]*bintree{}},
- "marshalbinaryserializer.gotmpl": {templatesSerializersMarshalbinaryserializerGotmpl, map[string]*bintree{}},
- "schemaserializer.gotmpl": {templatesSerializersSchemaserializerGotmpl, map[string]*bintree{}},
- "subtypeserializer.gotmpl": {templatesSerializersSubtypeserializerGotmpl, map[string]*bintree{}},
- "tupleserializer.gotmpl": {templatesSerializersTupleserializerGotmpl, map[string]*bintree{}},
+ "aliasedserializer.gotmpl": {templatesSerializersAliasedserializerGotmpl, map[string]*bintree{}},
+ "allofserializer.gotmpl": {templatesSerializersAllofserializerGotmpl, map[string]*bintree{}},
+ "basetypeserializer.gotmpl": {templatesSerializersBasetypeserializerGotmpl, map[string]*bintree{}},
+ "marshalbinaryserializer.gotmpl": {templatesSerializersMarshalbinaryserializerGotmpl, map[string]*bintree{}},
+ "schemaserializer.gotmpl": {templatesSerializersSchemaserializerGotmpl, map[string]*bintree{}},
+ "subtypeserializer.gotmpl": {templatesSerializersSubtypeserializerGotmpl, map[string]*bintree{}},
+ "tupleserializer.gotmpl": {templatesSerializersTupleserializerGotmpl, map[string]*bintree{}},
}},
"server": {nil, map[string]*bintree{
- "builder.gotmpl": {templatesServerBuilderGotmpl, map[string]*bintree{}},
- "configureapi.gotmpl": {templatesServerConfigureapiGotmpl, map[string]*bintree{}},
- "doc.gotmpl": {templatesServerDocGotmpl, map[string]*bintree{}},
- "main.gotmpl": {templatesServerMainGotmpl, map[string]*bintree{}},
- "operation.gotmpl": {templatesServerOperationGotmpl, map[string]*bintree{}},
- "parameter.gotmpl": {templatesServerParameterGotmpl, map[string]*bintree{}},
- "responses.gotmpl": {templatesServerResponsesGotmpl, map[string]*bintree{}},
- "server.gotmpl": {templatesServerServerGotmpl, map[string]*bintree{}},
- "urlbuilder.gotmpl": {templatesServerUrlbuilderGotmpl, map[string]*bintree{}},
+ "autoconfigureapi.gotmpl": {templatesServerAutoconfigureapiGotmpl, map[string]*bintree{}},
+ "builder.gotmpl": {templatesServerBuilderGotmpl, map[string]*bintree{}},
+ "configureapi.gotmpl": {templatesServerConfigureapiGotmpl, map[string]*bintree{}},
+ "doc.gotmpl": {templatesServerDocGotmpl, map[string]*bintree{}},
+ "main.gotmpl": {templatesServerMainGotmpl, map[string]*bintree{}},
+ "operation.gotmpl": {templatesServerOperationGotmpl, map[string]*bintree{}},
+ "parameter.gotmpl": {templatesServerParameterGotmpl, map[string]*bintree{}},
+ "responses.gotmpl": {templatesServerResponsesGotmpl, map[string]*bintree{}},
+ "server.gotmpl": {templatesServerServerGotmpl, map[string]*bintree{}},
+ "urlbuilder.gotmpl": {templatesServerUrlbuilderGotmpl, map[string]*bintree{}},
}},
"simpleschema": {nil, map[string]*bintree{
"defaultsinit.gotmpl": {templatesSimpleschemaDefaultsinitGotmpl, map[string]*bintree{}},
- "defaultsvar.gotmpl": {templatesSimpleschemaDefaultsvarGotmpl, map[string]*bintree{}},
+ "defaultsvar.gotmpl": {templatesSimpleschemaDefaultsvarGotmpl, map[string]*bintree{}},
}},
- "structfield.gotmpl": {templatesStructfieldGotmpl, map[string]*bintree{}},
+ "structfield.gotmpl": {templatesStructfieldGotmpl, map[string]*bintree{}},
"swagger_json_embed.gotmpl": {templatesSwagger_json_embedGotmpl, map[string]*bintree{}},
"validation": {nil, map[string]*bintree{
"customformat.gotmpl": {templatesValidationCustomformatGotmpl, map[string]*bintree{}},
- "maximum.gotmpl": {templatesValidationMaximumGotmpl, map[string]*bintree{}},
- "minimum.gotmpl": {templatesValidationMinimumGotmpl, map[string]*bintree{}},
- "multipleOf.gotmpl": {templatesValidationMultipleofGotmpl, map[string]*bintree{}},
- "primitive.gotmpl": {templatesValidationPrimitiveGotmpl, map[string]*bintree{}},
- "structfield.gotmpl": {templatesValidationStructfieldGotmpl, map[string]*bintree{}},
+ "maximum.gotmpl": {templatesValidationMaximumGotmpl, map[string]*bintree{}},
+ "minimum.gotmpl": {templatesValidationMinimumGotmpl, map[string]*bintree{}},
+ "multipleOf.gotmpl": {templatesValidationMultipleofGotmpl, map[string]*bintree{}},
+ "primitive.gotmpl": {templatesValidationPrimitiveGotmpl, map[string]*bintree{}},
+ "structfield.gotmpl": {templatesValidationStructfieldGotmpl, map[string]*bintree{}},
}},
}},
}}
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/language.go b/vendor/github.com/go-swagger/go-swagger/generator/language.go
index 4b5fb6bc3..fb02c896f 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/language.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/language.go
@@ -262,7 +262,7 @@ func GoLangOpts() *LanguageOpts {
if err != nil {
return "", err
}
- return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(string(b), "}", ",}"), "[", "{"), "]", ",}"), nil
+ return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(string(b), "}", ",}"), "[", "{"), "]", ",}"), "{,}", "{}"), nil
}
opts.BaseImportFunc = func(tgt string) string {
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/operation.go b/vendor/github.com/go-swagger/go-swagger/generator/operation.go
index 36e5840e3..6710596d8 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/operation.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/operation.go
@@ -1130,6 +1130,13 @@ func (b *codeGenOpBuilder) buildOperationSchema(schemaPath, containerName, schem
isInterface := schema.IsInterface
hasValidations := schema.HasValidations
+ // TODO: remove this and find a better way to get package name for anonymous models
+ // get the package that the param will be generated. Used by generate CLI
+ pkg := "operations"
+ if len(b.Operation.Tags) != 0 {
+ pkg = b.Operation.Tags[0]
+ }
+
// for complex anonymous objects, produce an extra schema
if hasProperties || isAllOf {
if b.ExtraSchemas == nil {
@@ -1138,6 +1145,7 @@ func (b *codeGenOpBuilder) buildOperationSchema(schemaPath, containerName, schem
schema.Name = schemaName
schema.GoType = schemaName
schema.IsAnonymous = false
+ schema.Pkg = pkg
b.ExtraSchemas[schemaName] = schema
// constructs new schema to refer to the newly created type
@@ -1147,6 +1155,7 @@ func (b *codeGenOpBuilder) buildOperationSchema(schemaPath, containerName, schem
schema.SwaggerType = schemaName
schema.HasValidations = hasValidations
schema.GoType = schemaName
+ schema.Pkg = pkg
} else if isInterface {
schema = GenSchema{}
schema.IsAnonymous = false
@@ -1288,3 +1297,8 @@ func renameAPIPackage(pkg string) string {
// favors readability over perfect deconfliction
return "swagger" + pkg
}
+
+func renameImplementationPackage(pkg string) string {
+ // favors readability over perfect deconfliction
+ return "swagger" + pkg + "impl"
+}
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/shared.go b/vendor/github.com/go-swagger/go-swagger/generator/shared.go
index a79f6cd32..bf803b333 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/shared.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/shared.go
@@ -40,13 +40,14 @@ import (
const (
// default generation targets structure
- defaultModelsTarget = "models"
- defaultServerTarget = "restapi"
- defaultClientTarget = "client"
- defaultOperationsTarget = "operations"
- defaultClientName = "rest"
- defaultServerName = "swagger"
- defaultScheme = "http"
+ defaultModelsTarget = "models"
+ defaultServerTarget = "restapi"
+ defaultClientTarget = "client"
+ defaultOperationsTarget = "operations"
+ defaultClientName = "rest"
+ defaultServerName = "swagger"
+ defaultScheme = "http"
+ defaultImplementationTarget = "implementation"
)
func init() {
@@ -62,7 +63,7 @@ func init() {
func DefaultSectionOpts(gen *GenOpts) {
sec := gen.Sections
if len(sec.Models) == 0 {
- sec.Models = []TemplateOpts{
+ opts := []TemplateOpts{
{
Name: "definition",
Source: "asset:model",
@@ -70,11 +71,20 @@ func DefaultSectionOpts(gen *GenOpts) {
FileName: "{{ (snakize (pascalize .Name)) }}.go",
},
}
+ if gen.IncludeCLi {
+ opts = append(opts, TemplateOpts{
+ Name: "clidefinitionhook",
+ Source: "asset:cliModelcli",
+ Target: "{{ joinFilePath .Target (toPackagePath .CliPackage) }}",
+ FileName: "{{ (snakize (pascalize .Name)) }}_model.go",
+ })
+ }
+ sec.Models = opts
}
if len(sec.Operations) == 0 {
if gen.IsClient {
- sec.Operations = []TemplateOpts{
+ opts := []TemplateOpts{
{
Name: "parameters",
Source: "asset:clientParameter",
@@ -88,6 +98,15 @@ func DefaultSectionOpts(gen *GenOpts) {
FileName: "{{ (snakize (pascalize .Name)) }}_responses.go",
},
}
+ if gen.IncludeCLi {
+ opts = append(opts, TemplateOpts{
+ Name: "clioperation",
+ Source: "asset:cliOperation",
+ Target: "{{ joinFilePath .Target (toPackagePath .CliPackage) }}",
+ FileName: "{{ (snakize (pascalize .Name)) }}_operation.go",
+ })
+ }
+ sec.Operations = opts
} else {
ops := []TemplateOpts{}
if gen.IncludeParameters {
@@ -143,7 +162,7 @@ func DefaultSectionOpts(gen *GenOpts) {
if len(sec.Application) == 0 {
if gen.IsClient {
- sec.Application = []TemplateOpts{
+ opts := []TemplateOpts{
{
Name: "facade",
Source: "asset:clientFacade",
@@ -151,15 +170,23 @@ func DefaultSectionOpts(gen *GenOpts) {
FileName: "{{ snakize .Name }}Client.go",
},
}
+ if gen.IncludeCLi {
+ // include a commandline tool app
+ opts = append(opts, []TemplateOpts{{
+ Name: "commandline",
+ Source: "asset:cliCli",
+ Target: "{{ joinFilePath .Target (toPackagePath .CliPackage) }}",
+ FileName: "cli.go",
+ }, {
+ Name: "climain",
+ Source: "asset:cliMain",
+ Target: "{{ joinFilePath .Target \"cmd\" (toPackagePath .CliPackage) }}",
+ FileName: "main.go",
+ }}...)
+ }
+ sec.Application = opts
} else {
- sec.Application = []TemplateOpts{
- {
- Name: "configure",
- Source: "asset:serverConfigureapi",
- Target: "{{ joinFilePath .Target (toPackagePath .ServerPackage) }}",
- FileName: "configure_{{ (snakize (pascalize .Name)) }}.go",
- SkipExists: !gen.RegenerateConfigureAPI,
- },
+ opts := []TemplateOpts{
{
Name: "main",
Source: "asset:serverMain",
@@ -191,6 +218,25 @@ func DefaultSectionOpts(gen *GenOpts) {
FileName: "doc.go",
},
}
+ if gen.ImplementationPackage != "" {
+ // Use auto configure template
+ opts = append(opts, TemplateOpts{
+ Name: "autoconfigure",
+ Source: "asset:serverAutoconfigureapi",
+ Target: "{{ joinFilePath .Target (toPackagePath .ServerPackage) }}",
+ FileName: "auto_configure_{{ (snakize (pascalize .Name)) }}.go",
+ })
+
+ } else {
+ opts = append(opts, TemplateOpts{
+ Name: "configure",
+ Source: "asset:serverConfigureapi",
+ Target: "{{ joinFilePath .Target (toPackagePath .ServerPackage) }}",
+ FileName: "configure_{{ (snakize (pascalize .Name)) }}.go",
+ SkipExists: !gen.RegenerateConfigureAPI,
+ })
+ }
+ sec.Application = opts
}
}
gen.Sections = sec
@@ -248,6 +294,7 @@ type GenOpts struct {
IncludeURLBuilder bool
IncludeMain bool
IncludeSupport bool
+ IncludeCLi bool
ExcludeSpec bool
DumpData bool
ValidateSpec bool
@@ -263,9 +310,11 @@ type GenOpts struct {
ModelPackage string
ServerPackage string
ClientPackage string
+ CliPackage string
+ ImplementationPackage string
Principal string
- PrincipalCustomIface bool // user-provided interface for Principal (non-nullable)
- Target string
+ PrincipalCustomIface bool // user-provided interface for Principal (non-nullable)
+ Target string // dir location where generated code is written to
Sections SectionOpts
LanguageOpts *LanguageOpts
TypeMapping map[string]string
@@ -488,16 +537,17 @@ func (g *GenOpts) location(t *TemplateOpts, data interface{}) (string, string, e
}
d := struct {
- Name, Package, APIPackage, ServerPackage, ClientPackage, ModelPackage, MainPackage, Target string
- Tags []string
- UseTags bool
- Context interface{}
+ Name, Package, APIPackage, ServerPackage, ClientPackage, CliPackage, ModelPackage, MainPackage, Target string
+ Tags []string
+ UseTags bool
+ Context interface{}
}{
Name: name,
Package: pkg,
APIPackage: g.APIPackage,
ServerPackage: g.ServerPackage,
ClientPackage: g.ClientPackage,
+ CliPackage: g.CliPackage,
ModelPackage: g.ModelPackage,
MainPackage: g.MainPackage,
Target: g.Target,
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/structs.go b/vendor/github.com/go-swagger/go-swagger/generator/structs.go
index 3e88c9a91..ac3a638b5 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/structs.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/structs.go
@@ -146,6 +146,8 @@ func (g GenSchema) PrintTags() string {
if tag == "example" && len(g.Example) > 0 {
// only add example tag if it's contained in the struct tags
tags["example"] = g.Example // json representation of the example object
+ } else if tag == "description" && len(g.Description) > 0 {
+ tags["description"] = g.Description
} else {
tags[tag] = tags["json"]
}
@@ -645,33 +647,34 @@ func (g GenOperations) Swap(i, j int) { g[i], g[j] = g[j], g[i] }
// from a swagger spec
type GenApp struct {
GenCommon
- APIPackage string
- ServerPackageAlias string
- APIPackageAlias string
- Package string
- ReceiverName string
- Name string
- Principal string
- PrincipalIsNullable bool
- DefaultConsumes string
- DefaultProduces string
- Host string
- BasePath string
- Info *spec.Info
- ExternalDocs *spec.ExternalDocumentation
- Tags []spec.Tag
- Imports map[string]string
- DefaultImports map[string]string
- Schemes []string
- ExtraSchemes []string
- Consumes GenSerGroups
- Produces GenSerGroups
- SecurityDefinitions GenSecuritySchemes
- SecurityRequirements []analysis.SecurityRequirement // original security requirements as per the spec (for doc)
- Models []GenDefinition
- Operations GenOperations
- OperationGroups GenOperationGroups
- SwaggerJSON string
+ APIPackage string
+ ServerPackageAlias string
+ ImplementationPackageAlias string
+ APIPackageAlias string
+ Package string
+ ReceiverName string
+ Name string
+ Principal string
+ PrincipalIsNullable bool
+ DefaultConsumes string
+ DefaultProduces string
+ Host string
+ BasePath string
+ Info *spec.Info
+ ExternalDocs *spec.ExternalDocumentation
+ Tags []spec.Tag
+ Imports map[string]string
+ DefaultImports map[string]string
+ Schemes []string
+ ExtraSchemes []string
+ Consumes GenSerGroups
+ Produces GenSerGroups
+ SecurityDefinitions GenSecuritySchemes
+ SecurityRequirements []analysis.SecurityRequirement // original security requirements as per the spec (for doc)
+ Models []GenDefinition
+ Operations GenOperations
+ OperationGroups GenOperationGroups
+ SwaggerJSON string
// Embedded specs: this is important for when the generated server adds routes.
// NOTE: there is a distinct advantage to having this in runtime rather than generated code.
// We are not ever going to generate the router.
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/support.go b/vendor/github.com/go-swagger/go-swagger/generator/support.go
index 3697e255d..df3996df4 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/support.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/support.go
@@ -217,6 +217,12 @@ func (a *appGenerator) GenerateSupport(ap *GenApp) error {
app.DefaultImports[pkgAlias] = serverPath
app.ServerPackageAlias = pkgAlias
+ // add client import for cli generation
+ clientPath := path.Join(baseImport,
+ a.GenOpts.LanguageOpts.ManglePackagePath(a.ClientPackage, defaultClientTarget))
+ clientPkgAlias := importAlias(clientPath)
+ app.DefaultImports[clientPkgAlias] = clientPath
+
return a.GenOpts.renderApplication(app)
}
@@ -260,6 +266,12 @@ func (a *appGenerator) makeCodegenApp() (GenApp, error) {
baseImport,
a.GenOpts.LanguageOpts.ManglePackagePath(a.OperationsPackage, defaultOperationsTarget))
+ implAlias := ""
+ if a.GenOpts.ImplementationPackage != "" {
+ implAlias = deconflictPkg(a.GenOpts.LanguageOpts.ManglePackageName(a.GenOpts.ImplementationPackage, defaultImplementationTarget), renameImplementationPackage)
+ imports[implAlias] = a.GenOpts.ImplementationPackage
+ }
+
log.Printf("planning definitions (found: %d)", len(a.Models))
genModels := make(GenDefinitions, 0, len(a.Models))
@@ -434,34 +446,35 @@ func (a *appGenerator) makeCodegenApp() (GenApp, error) {
Copyright: a.GenOpts.Copyright,
TargetImportPath: baseImport,
},
- APIPackage: a.GenOpts.LanguageOpts.ManglePackageName(a.ServerPackage, defaultServerTarget),
- APIPackageAlias: alias,
- Package: a.Package,
- ReceiverName: receiver,
- Name: a.Name,
- Host: host,
- BasePath: basePath,
- Schemes: schemeOrDefault(collectedSchemes, a.DefaultScheme),
- ExtraSchemes: extraSchemes,
- ExternalDocs: trimExternalDoc(sw.ExternalDocs),
- Tags: trimTags(sw.Tags),
- Info: trimInfo(sw.Info),
- Consumes: consumes,
- Produces: produces,
- DefaultConsumes: a.DefaultConsumes,
- DefaultProduces: a.DefaultProduces,
- DefaultImports: defaultImports,
- Imports: imports,
- SecurityDefinitions: security,
- SecurityRequirements: securityRequirements(a.SpecDoc.Spec().Security), // top level securityRequirements
- Models: genModels,
- Operations: genOps,
- OperationGroups: opGroups,
- Principal: a.GenOpts.PrincipalAlias(),
- SwaggerJSON: generateReadableSpec(jsonb),
- FlatSwaggerJSON: generateReadableSpec(flatjsonb),
- ExcludeSpec: a.GenOpts.ExcludeSpec,
- GenOpts: a.GenOpts,
+ APIPackage: a.GenOpts.LanguageOpts.ManglePackageName(a.ServerPackage, defaultServerTarget),
+ APIPackageAlias: alias,
+ ImplementationPackageAlias: implAlias,
+ Package: a.Package,
+ ReceiverName: receiver,
+ Name: a.Name,
+ Host: host,
+ BasePath: basePath,
+ Schemes: schemeOrDefault(collectedSchemes, a.DefaultScheme),
+ ExtraSchemes: extraSchemes,
+ ExternalDocs: trimExternalDoc(sw.ExternalDocs),
+ Tags: trimTags(sw.Tags),
+ Info: trimInfo(sw.Info),
+ Consumes: consumes,
+ Produces: produces,
+ DefaultConsumes: a.DefaultConsumes,
+ DefaultProduces: a.DefaultProduces,
+ DefaultImports: defaultImports,
+ Imports: imports,
+ SecurityDefinitions: security,
+ SecurityRequirements: securityRequirements(a.SpecDoc.Spec().Security), // top level securityRequirements
+ Models: genModels,
+ Operations: genOps,
+ OperationGroups: opGroups,
+ Principal: a.GenOpts.PrincipalAlias(),
+ SwaggerJSON: generateReadableSpec(jsonb),
+ FlatSwaggerJSON: generateReadableSpec(flatjsonb),
+ ExcludeSpec: a.GenOpts.ExcludeSpec,
+ GenOpts: a.GenOpts,
PrincipalIsNullable: a.GenOpts.PrincipalIsNullable(),
}, nil
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/template_repo.go b/vendor/github.com/go-swagger/go-swagger/generator/template_repo.go
index 50f080997..bf4b6f912 100644
--- a/vendor/github.com/go-swagger/go-swagger/generator/template_repo.go
+++ b/vendor/github.com/go-swagger/go-swagger/generator/template_repo.go
@@ -137,6 +137,7 @@ func DefaultFuncMap(lang *LanguageOpts) template.FuncMap {
"httpStatus": httpStatus,
"cleanupEnumVariant": cleanupEnumVariant,
"gt0": gt0,
+ "hasfield": hasField,
})
}
@@ -179,15 +180,16 @@ func defaultAssets() map[string][]byte {
"swagger_json_embed.gotmpl": MustAsset("templates/swagger_json_embed.gotmpl"),
// server templates
- "server/parameter.gotmpl": MustAsset("templates/server/parameter.gotmpl"),
- "server/urlbuilder.gotmpl": MustAsset("templates/server/urlbuilder.gotmpl"),
- "server/responses.gotmpl": MustAsset("templates/server/responses.gotmpl"),
- "server/operation.gotmpl": MustAsset("templates/server/operation.gotmpl"),
- "server/builder.gotmpl": MustAsset("templates/server/builder.gotmpl"),
- "server/server.gotmpl": MustAsset("templates/server/server.gotmpl"),
- "server/configureapi.gotmpl": MustAsset("templates/server/configureapi.gotmpl"),
- "server/main.gotmpl": MustAsset("templates/server/main.gotmpl"),
- "server/doc.gotmpl": MustAsset("templates/server/doc.gotmpl"),
+ "server/parameter.gotmpl": MustAsset("templates/server/parameter.gotmpl"),
+ "server/urlbuilder.gotmpl": MustAsset("templates/server/urlbuilder.gotmpl"),
+ "server/responses.gotmpl": MustAsset("templates/server/responses.gotmpl"),
+ "server/operation.gotmpl": MustAsset("templates/server/operation.gotmpl"),
+ "server/builder.gotmpl": MustAsset("templates/server/builder.gotmpl"),
+ "server/server.gotmpl": MustAsset("templates/server/server.gotmpl"),
+ "server/configureapi.gotmpl": MustAsset("templates/server/configureapi.gotmpl"),
+ "server/autoconfigureapi.gotmpl": MustAsset("templates/server/autoconfigureapi.gotmpl"),
+ "server/main.gotmpl": MustAsset("templates/server/main.gotmpl"),
+ "server/doc.gotmpl": MustAsset("templates/server/doc.gotmpl"),
// client templates
"client/parameter.gotmpl": MustAsset("templates/client/parameter.gotmpl"),
@@ -196,6 +198,15 @@ func defaultAssets() map[string][]byte {
"client/facade.gotmpl": MustAsset("templates/client/facade.gotmpl"),
"markdown/docs.gotmpl": MustAsset("templates/markdown/docs.gotmpl"),
+
+ // cli templates
+ "cli/cli.gotmpl": MustAsset("templates/cli/cli.gotmpl"),
+ "cli/main.gotmpl": MustAsset("templates/cli/main.gotmpl"),
+ "cli/modelcli.gotmpl": MustAsset("templates/cli/modelcli.gotmpl"),
+ "cli/operation.gotmpl": MustAsset("templates/cli/operation.gotmpl"),
+ "cli/registerflag.gotmpl": MustAsset("templates/cli/registerflag.gotmpl"),
+ "cli/retrieveflag.gotmpl": MustAsset("templates/cli/retrieveflag.gotmpl"),
+ "cli/schema.gotmpl": MustAsset("templates/cli/schema.gotmpl"),
}
}
@@ -830,3 +841,15 @@ func gt0(in *int64) bool {
// with a pointer
return in != nil && *in > 0
}
+
+// returns struct v has field of name
+func hasField(v interface{}, name string) bool {
+ rv := reflect.ValueOf(v)
+ if rv.Kind() == reflect.Ptr {
+ rv = rv.Elem()
+ }
+ if rv.Kind() != reflect.Struct {
+ return false
+ }
+ return rv.FieldByName(name).IsValid()
+}
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/.gitignore b/vendor/github.com/go-testfixtures/testfixtures/v3/.gitignore
index 8772d9ba0..a838ad49a 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/.gitignore
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/.gitignore
@@ -27,3 +27,4 @@ _testmain.go
.env
/testfixtures
/dist
+/tmp
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/CHANGELOG.md b/vendor/github.com/go-testfixtures/testfixtures/v3/CHANGELOG.md
index 1827f1858..1cab63ced 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/CHANGELOG.md
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## v3.6.0 - 2021-04-17
+
+- Add support for dumping a database using the CLI (use the `--dump` flag)
+ ([#88](https://github.com/go-testfixtures/testfixtures/pull/88), [#63](https://github.com/go-testfixtures/testfixtures/issues/63)).
+- Support SkipResetSequences and ResetSequencesTo for MySQL and MariaDB
+ ([#91](https://github.com/go-testfixtures/testfixtures/pull/91)).
+
## v3.5.0 - 2021-01-11
- Fix insert of JSON values on PostgreSQL when using `binary_parameters=yes` in
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/README.md b/vendor/github.com/go-testfixtures/testfixtures/v3/README.md
index 8b8748853..1c6bc293c 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/README.md
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/README.md
@@ -406,11 +406,11 @@ dumper, err := testfixtures.NewDumper(
testfixtures.DumpDatabase(db),
testfixtures.DumpDialect("postgres"), // or your database of choice
testfixtures.DumpDirectory("tmp/fixtures"),
- textfixtures.DumpTables( // optional, will dump all table if not given
+ testfixtures.DumpTables( // optional, will dump all table if not given
"posts",
"comments",
"tags",
- )
+ ),
)
if err != nil {
...
@@ -454,9 +454,15 @@ brew install go-testfixtures/tap/testfixtures
Usage is like this:
```bash
+# load
testfixtures -d postgres -c "postgres://user:password@localhost/database" -D testdata/fixtures
```
+```bash
+# dump
+testfixtures --dump -d postgres -c "postgres://user:password@localhost/database" -D testdata/fixtures
+```
+
The connection string changes for each database driver.
Use `testfixtures --help` for all flags.
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/go.mod b/vendor/github.com/go-testfixtures/testfixtures/v3/go.mod
index 0ac428360..71e159475 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/go.mod
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/go.mod
@@ -2,14 +2,13 @@ module github.com/go-testfixtures/testfixtures/v3
require (
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73
- github.com/go-sql-driver/mysql v1.4.1
+ github.com/go-sql-driver/mysql v1.6.0
github.com/jackc/pgx/v4 v4.6.0
github.com/joho/godotenv v1.3.0
- github.com/lib/pq v1.3.0
- github.com/mattn/go-sqlite3 v1.14.0
+ github.com/lib/pq v1.10.0
+ github.com/mattn/go-sqlite3 v1.14.7
github.com/spf13/pflag v1.0.5
- google.golang.org/appengine v1.3.0 // indirect
- gopkg.in/yaml.v2 v2.2.7
+ gopkg.in/yaml.v2 v2.4.0
)
go 1.13
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/go.sum b/vendor/github.com/go-testfixtures/testfixtures/v3/go.sum
index c118c8ef4..5af6a429d 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/go.sum
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/go.sum
@@ -1,5 +1,3 @@
-github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
-github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
@@ -10,14 +8,13 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73 h1:OGNva6WhsKst5OZf7eZOklDztV3hwtTHovdrLHV+MsA=
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
-github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
-github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
+github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
+github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
-github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
@@ -72,16 +69,16 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
-github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.10.0 h1:Zx5DJFEYQXio93kgXnQ09fXNiUKsqv4OUEu2UtGcB1E=
+github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
-github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
-github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
+github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA=
+github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -114,23 +111,16 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
-golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 h1:3zb4D3T4G8jdExgVU/95+vQXfpEPiMdCaZgmGVxjNHM=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -141,7 +131,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -152,13 +141,10 @@ golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk=
-google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
-gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/mysql.go b/vendor/github.com/go-testfixtures/testfixtures/v3/mysql.go
index c1cb720e4..3f20fdb32 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/mysql.go
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/mysql.go
@@ -7,6 +7,10 @@ import (
type mySQL struct {
baseHelper
+
+ skipResetSequences bool
+ resetSequencesTo int64
+
tables []string
tablesChecksum map[string]int64
}
@@ -36,7 +40,7 @@ func (*mySQL) databaseName(q queryable) (string, error) {
}
func (h *mySQL) tableNames(q queryable) ([]string, error) {
- query := `
+ const query = `
SELECT table_name
FROM information_schema.tables
WHERE table_schema = ?
@@ -69,6 +73,13 @@ func (h *mySQL) tableNames(q queryable) ([]string, error) {
}
func (h *mySQL) disableReferentialIntegrity(db *sql.DB, loadFn loadFunction) (err error) {
+ if !h.skipResetSequences {
+ defer func() {
+ if err2 := h.resetSequences(db); err2 != nil && err == nil {
+ err = err2
+ }
+ }()
+ }
tx, err := db.Begin()
if err != nil {
return err
@@ -91,6 +102,20 @@ func (h *mySQL) disableReferentialIntegrity(db *sql.DB, loadFn loadFunction) (er
return tx.Commit()
}
+func (h *mySQL) resetSequences(db *sql.DB) error {
+ resetSequencesTo := h.resetSequencesTo
+ if resetSequencesTo == 0 {
+ resetSequencesTo = 10000
+ }
+
+ for _, t := range h.tables {
+ if _, err := db.Exec(fmt.Sprintf("ALTER TABLE %s AUTO_INCREMENT = %d", h.quoteKeyword(t), resetSequencesTo)); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
func (h *mySQL) isTableModified(q queryable, tableName string) (bool, error) {
checksum, err := h.getChecksum(q, tableName)
if err != nil {
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/postgresql.go b/vendor/github.com/go-testfixtures/testfixtures/v3/postgresql.go
index 30064a02b..3a3062e62 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/postgresql.go
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/postgresql.go
@@ -66,7 +66,7 @@ func (*postgreSQL) databaseName(q queryable) (string, error) {
func (h *postgreSQL) tableNames(q queryable) ([]string, error) {
var tables []string
- sql := `
+ const sql = `
SELECT pg_namespace.nspname || '.' || pg_class.relname
FROM pg_class
INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
@@ -126,7 +126,7 @@ func (h *postgreSQL) getSequences(q queryable) ([]string, error) {
func (*postgreSQL) getNonDeferrableConstraints(q queryable) ([]pgConstraint, error) {
var constraints []pgConstraint
- sql := `
+ const sql = `
SELECT table_schema || '.' || table_name, constraint_name
FROM information_schema.table_constraints
WHERE constraint_type = 'FOREIGN KEY'
@@ -156,7 +156,7 @@ func (*postgreSQL) getNonDeferrableConstraints(q queryable) ([]pgConstraint, err
func (h *postgreSQL) getConstraints(q queryable) ([]pgConstraint, error) {
var constraints []pgConstraint
- sql := `
+ const sql = `
SELECT conrelid::regclass AS table_from, conname, pg_get_constraintdef(pg_constraint.oid)
FROM pg_constraint
INNER JOIN pg_namespace ON pg_namespace.oid = pg_constraint.connamespace
@@ -192,29 +192,29 @@ func (h *postgreSQL) getConstraints(q queryable) ([]pgConstraint, error) {
func (h *postgreSQL) dropAndRecreateConstraints(db *sql.DB, loadFn loadFunction) (err error) {
defer func() {
// Re-create constraints again after load
- var sql string
+ var b strings.Builder
for _, constraint := range h.constraints {
- sql += fmt.Sprintf(
+ b.WriteString(fmt.Sprintf(
"ALTER TABLE %s ADD CONSTRAINT %s %s;",
h.quoteKeyword(constraint.tableName),
h.quoteKeyword(constraint.constraintName),
constraint.definition,
- )
+ ))
}
- if _, err2 := db.Exec(sql); err2 != nil && err == nil {
+ if _, err2 := db.Exec(b.String()); err2 != nil && err == nil {
err = err2
}
}()
- var sql string
+ var b strings.Builder
for _, constraint := range h.constraints {
- sql += fmt.Sprintf(
+ b.WriteString(fmt.Sprintf(
"ALTER TABLE %s DROP CONSTRAINT %s;",
h.quoteKeyword(constraint.tableName),
h.quoteKeyword(constraint.constraintName),
- )
+ ))
}
- if _, err := db.Exec(sql); err != nil {
+ if _, err := db.Exec(b.String()); err != nil {
return err
}
@@ -233,12 +233,11 @@ func (h *postgreSQL) dropAndRecreateConstraints(db *sql.DB, loadFn loadFunction)
func (h *postgreSQL) disableTriggers(db *sql.DB, loadFn loadFunction) (err error) {
defer func() {
- // re-enable triggers after load
- var sql string
+ var b strings.Builder
for _, table := range h.tables {
- sql += fmt.Sprintf("ALTER TABLE %s ENABLE TRIGGER ALL;", h.quoteKeyword(table))
+ b.WriteString(fmt.Sprintf("ALTER TABLE %s ENABLE TRIGGER ALL;", h.quoteKeyword(table)))
}
- if _, err2 := db.Exec(sql); err2 != nil && err == nil {
+ if _, err2 := db.Exec(b.String()); err2 != nil && err == nil {
err = err2
}
}()
@@ -248,11 +247,11 @@ func (h *postgreSQL) disableTriggers(db *sql.DB, loadFn loadFunction) (err error
return err
}
- var sql string
+ var b strings.Builder
for _, table := range h.tables {
- sql += fmt.Sprintf("ALTER TABLE %s DISABLE TRIGGER ALL;", h.quoteKeyword(table))
+ b.WriteString(fmt.Sprintf("ALTER TABLE %s DISABLE TRIGGER ALL;", h.quoteKeyword(table)))
}
- if _, err = tx.Exec(sql); err != nil {
+ if _, err = tx.Exec(b.String()); err != nil {
return err
}
@@ -267,20 +266,20 @@ func (h *postgreSQL) disableTriggers(db *sql.DB, loadFn loadFunction) (err error
func (h *postgreSQL) makeConstraintsDeferrable(db *sql.DB, loadFn loadFunction) (err error) {
defer func() {
// ensure constraint being not deferrable again after load
- var sql string
+ var b strings.Builder
for _, constraint := range h.nonDeferrableConstraints {
- sql += fmt.Sprintf("ALTER TABLE %s ALTER CONSTRAINT %s NOT DEFERRABLE;", h.quoteKeyword(constraint.tableName), h.quoteKeyword(constraint.constraintName))
+ b.WriteString(fmt.Sprintf("ALTER TABLE %s ALTER CONSTRAINT %s NOT DEFERRABLE;", h.quoteKeyword(constraint.tableName), h.quoteKeyword(constraint.constraintName)))
}
- if _, err2 := db.Exec(sql); err2 != nil && err == nil {
+ if _, err2 := db.Exec(b.String()); err2 != nil && err == nil {
err = err2
}
}()
- var sql string
+ var b strings.Builder
for _, constraint := range h.nonDeferrableConstraints {
- sql += fmt.Sprintf("ALTER TABLE %s ALTER CONSTRAINT %s DEFERRABLE;", h.quoteKeyword(constraint.tableName), h.quoteKeyword(constraint.constraintName))
+ b.WriteString(fmt.Sprintf("ALTER TABLE %s ALTER CONSTRAINT %s DEFERRABLE;", h.quoteKeyword(constraint.tableName), h.quoteKeyword(constraint.constraintName)))
}
- if _, err := db.Exec(sql); err != nil {
+ if _, err := db.Exec(b.String()); err != nil {
return err
}
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/sqlserver.go b/vendor/github.com/go-testfixtures/testfixtures/v3/sqlserver.go
index 9d6058ede..bfd628b6a 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/sqlserver.go
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/sqlserver.go
@@ -114,20 +114,20 @@ func (h *sqlserver) whileInsertOnTable(tx *sql.Tx, tableName string, fn func() e
func (h *sqlserver) disableReferentialIntegrity(db *sql.DB, loadFn loadFunction) (err error) {
// ensure the triggers are re-enable after all
defer func() {
- var sql string
+ var b strings.Builder
for _, table := range h.tables {
- sql += fmt.Sprintf("ALTER TABLE %s WITH CHECK CHECK CONSTRAINT ALL;", h.quoteKeyword(table))
+ b.WriteString(fmt.Sprintf("ALTER TABLE %s WITH CHECK CHECK CONSTRAINT ALL;", h.quoteKeyword(table)))
}
- if _, err2 := db.Exec(sql); err2 != nil && err == nil {
+ if _, err2 := db.Exec(b.String()); err2 != nil && err == nil {
err = err2
}
}()
- var sql string
+ var b strings.Builder
for _, table := range h.tables {
- sql += fmt.Sprintf("ALTER TABLE %s NOCHECK CONSTRAINT ALL;", h.quoteKeyword(table))
+ b.WriteString(fmt.Sprintf("ALTER TABLE %s NOCHECK CONSTRAINT ALL;", h.quoteKeyword(table)))
}
- if _, err := db.Exec(sql); err != nil {
+ if _, err := db.Exec(b.String()); err != nil {
return err
}
diff --git a/vendor/github.com/go-testfixtures/testfixtures/v3/testfixtures.go b/vendor/github.com/go-testfixtures/testfixtures/v3/testfixtures.go
index 87bec9f07..f83359e0f 100644
--- a/vendor/github.com/go-testfixtures/testfixtures/v3/testfixtures.go
+++ b/vendor/github.com/go-testfixtures/testfixtures/v3/testfixtures.go
@@ -159,14 +159,17 @@ func UseDropConstraint() func(*Loader) error {
// SkipResetSequences prevents Loader from reseting sequences after loading
// fixtures.
//
-// Only valid for PostgreSQL. Returns an error otherwise.
+// Only valid for PostgreSQL and MySQL. Returns an error otherwise.
func SkipResetSequences() func(*Loader) error {
return func(l *Loader) error {
- pgHelper, ok := l.helper.(*postgreSQL)
- if !ok {
- return fmt.Errorf("testfixtures: SkipResetSequences is only valid for PostgreSQL databases")
+ switch helper := l.helper.(type) {
+ case *postgreSQL:
+ helper.skipResetSequences = true
+ case *mySQL:
+ helper.skipResetSequences = true
+ default:
+ return fmt.Errorf("testfixtures: SkipResetSequences is valid for PostgreSQL and MySQL databases")
}
- pgHelper.skipResetSequences = true
return nil
}
}
@@ -175,14 +178,17 @@ func SkipResetSequences() func(*Loader) error {
//
// Defaults to 10000.
//
-// Only valid for PostgreSQL. Returns an error otherwise.
+// Only valid for PostgreSQL and MySQL. Returns an error otherwise.
func ResetSequencesTo(value int64) func(*Loader) error {
return func(l *Loader) error {
- pgHelper, ok := l.helper.(*postgreSQL)
- if !ok {
- return fmt.Errorf("testfixtures: ResetSequencesTo is only valid for PostgreSQL databases")
+ switch helper := l.helper.(type) {
+ case *postgreSQL:
+ helper.resetSequencesTo = value
+ case *mySQL:
+ helper.resetSequencesTo = value
+ default:
+ return fmt.Errorf("testfixtures: ResetSequencesTo is only valid for PostgreSQL and MySQL databases")
}
- pgHelper.resetSequencesTo = value
return nil
}
}
diff --git a/vendor/github.com/golang/protobuf/proto/registry.go b/vendor/github.com/golang/protobuf/proto/registry.go
index 1e7ff6420..066b4323b 100644
--- a/vendor/github.com/golang/protobuf/proto/registry.go
+++ b/vendor/github.com/golang/protobuf/proto/registry.go
@@ -13,6 +13,7 @@ import (
"strings"
"sync"
+ "google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/runtime/protoimpl"
@@ -62,14 +63,7 @@ func FileDescriptor(s filePath) fileDescGZIP {
// Find the descriptor in the v2 registry.
var b []byte
if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil {
- if fd, ok := fd.(interface{ ProtoLegacyRawDesc() []byte }); ok {
- b = fd.ProtoLegacyRawDesc()
- } else {
- // TODO: Use protodesc.ToFileDescriptorProto to construct
- // a descriptorpb.FileDescriptorProto and marshal it.
- // However, doing so causes the proto package to have a dependency
- // on descriptorpb, leading to cyclic dependency issues.
- }
+ b, _ = Marshal(protodesc.ToFileDescriptorProto(fd))
}
// Locally cache the raw descriptor form for the file.
diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go
index e729dcff1..85f9f5736 100644
--- a/vendor/github.com/golang/protobuf/ptypes/any.go
+++ b/vendor/github.com/golang/protobuf/ptypes/any.go
@@ -19,6 +19,8 @@ const urlPrefix = "type.googleapis.com/"
// AnyMessageName returns the message name contained in an anypb.Any message.
// Most type assertions should use the Is function instead.
+//
+// Deprecated: Call the any.MessageName method instead.
func AnyMessageName(any *anypb.Any) (string, error) {
name, err := anyMessageName(any)
return string(name), err
@@ -38,6 +40,8 @@ func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) {
}
// MarshalAny marshals the given message m into an anypb.Any message.
+//
+// Deprecated: Call the anypb.New function instead.
func MarshalAny(m proto.Message) (*anypb.Any, error) {
switch dm := m.(type) {
case DynamicAny:
@@ -58,6 +62,9 @@ func MarshalAny(m proto.Message) (*anypb.Any, error) {
// Empty returns a new message of the type specified in an anypb.Any message.
// It returns protoregistry.NotFound if the corresponding message type could not
// be resolved in the global registry.
+//
+// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead
+// to resolve the message name and create a new instance of it.
func Empty(any *anypb.Any) (proto.Message, error) {
name, err := anyMessageName(any)
if err != nil {
@@ -76,6 +83,8 @@ func Empty(any *anypb.Any) (proto.Message, error) {
//
// The target message m may be a *DynamicAny message. If the underlying message
// type could not be resolved, then this returns protoregistry.NotFound.
+//
+// Deprecated: Call the any.UnmarshalTo method instead.
func UnmarshalAny(any *anypb.Any, m proto.Message) error {
if dm, ok := m.(*DynamicAny); ok {
if dm.Message == nil {
@@ -100,6 +109,8 @@ func UnmarshalAny(any *anypb.Any, m proto.Message) error {
}
// Is reports whether the Any message contains a message of the specified type.
+//
+// Deprecated: Call the any.MessageIs method instead.
func Is(any *anypb.Any, m proto.Message) bool {
if any == nil || m == nil {
return false
@@ -119,6 +130,9 @@ func Is(any *anypb.Any, m proto.Message) bool {
// var x ptypes.DynamicAny
// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
// fmt.Printf("unmarshaled message: %v", x.Message)
+//
+// Deprecated: Use the any.UnmarshalNew method instead to unmarshal
+// the any message contents into a new instance of the underlying message.
type DynamicAny struct{ proto.Message }
func (m DynamicAny) String() string {
diff --git a/vendor/github.com/golang/protobuf/ptypes/doc.go b/vendor/github.com/golang/protobuf/ptypes/doc.go
index fb9edd5c6..d3c33259d 100644
--- a/vendor/github.com/golang/protobuf/ptypes/doc.go
+++ b/vendor/github.com/golang/protobuf/ptypes/doc.go
@@ -3,4 +3,8 @@
// license that can be found in the LICENSE file.
// Package ptypes provides functionality for interacting with well-known types.
+//
+// Deprecated: Well-known types have specialized functionality directly
+// injected into the generated packages for each message type.
+// See the deprecation notice for each function for the suggested alternative.
package ptypes
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go
index 6110ae8a4..b2b55dd85 100644
--- a/vendor/github.com/golang/protobuf/ptypes/duration.go
+++ b/vendor/github.com/golang/protobuf/ptypes/duration.go
@@ -21,6 +21,8 @@ const (
// Duration converts a durationpb.Duration to a time.Duration.
// Duration returns an error if dur is invalid or overflows a time.Duration.
+//
+// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead.
func Duration(dur *durationpb.Duration) (time.Duration, error) {
if err := validateDuration(dur); err != nil {
return 0, err
@@ -39,6 +41,8 @@ func Duration(dur *durationpb.Duration) (time.Duration, error) {
}
// DurationProto converts a time.Duration to a durationpb.Duration.
+//
+// Deprecated: Call the durationpb.New function instead.
func DurationProto(d time.Duration) *durationpb.Duration {
nanos := d.Nanoseconds()
secs := nanos / 1e9
diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go
index 026d0d491..8368a3f70 100644
--- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go
+++ b/vendor/github.com/golang/protobuf/ptypes/timestamp.go
@@ -33,6 +33,8 @@ const (
//
// A nil Timestamp returns an error. The first return value in that case is
// undefined.
+//
+// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead.
func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) {
// Don't return the zero value on error, because corresponds to a valid
// timestamp. Instead return whatever time.Unix gives us.
@@ -46,6 +48,8 @@ func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) {
}
// TimestampNow returns a google.protobuf.Timestamp for the current time.
+//
+// Deprecated: Call the timestamppb.Now function instead.
func TimestampNow() *timestamppb.Timestamp {
ts, err := TimestampProto(time.Now())
if err != nil {
@@ -56,6 +60,8 @@ func TimestampNow() *timestamppb.Timestamp {
// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
// It returns an error if the resulting Timestamp is invalid.
+//
+// Deprecated: Call the timestamppb.New function instead.
func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) {
ts := ×tamppb.Timestamp{
Seconds: t.Unix(),
@@ -69,6 +75,9 @@ func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) {
// TimestampString returns the RFC 3339 string for valid Timestamps.
// For invalid Timestamps, it returns an error message in parentheses.
+//
+// Deprecated: Call the ts.AsTime method instead,
+// followed by a call to the Format method on the time.Time value.
func TimestampString(ts *timestamppb.Timestamp) string {
t, err := Timestamp(ts)
if err != nil {
diff --git a/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go
index 37080b19b..91198f819 100644
--- a/vendor/github.com/google/go-querystring/query/encode.go
+++ b/vendor/github.com/google/go-querystring/query/encode.go
@@ -51,8 +51,8 @@ type Encoder interface {
// - the field is empty and its tag specifies the "omitempty" option
//
// The empty values are false, 0, any nil pointer or interface value, any array
-// slice, map, or string of length zero, and any time.Time that returns true
-// for IsZero().
+// slice, map, or string of length zero, and any type (such as time.Time) that
+// returns true for IsZero().
//
// The URL parameter name defaults to the struct field name but can be
// specified in the struct field's tag value. The "url" key in the struct
@@ -82,7 +82,14 @@ type Encoder interface {
//
// time.Time values default to encoding as RFC3339 timestamps. Including the
// "unix" option signals that the field should be encoded as a Unix time (see
-// time.Unix())
+// time.Unix()). The "unixmilli" and "unixnano" options will encode the number
+// of milliseconds and nanoseconds, respectively, since January 1, 1970 (see
+// time.UnixNano()). Including the "layout" struct tag (separate from the
+// "url" tag) will use the value of the "layout" tag as a layout passed to
+// time.Format. For example:
+//
+// // Encode a time.Time as YYYY-MM-DD
+// Field time.Time `layout:"2006-01-02"`
//
// Slice and Array values default to encoding as multiple URL values of the
// same name. Including the "comma" option signals that the field should be
@@ -92,7 +99,13 @@ type Encoder interface {
// Including the "brackets" option signals that the multiple URL values should
// have "[]" appended to the value name. "numbered" will append a number to
// the end of each incidence of the value name, example:
-// name0=value0&name1=value1, etc.
+// name0=value0&name1=value1, etc. Including the "del" struct tag (separate
+// from the "url" tag) will use the value of the "del" tag as the delimiter.
+// For example:
+//
+// // Encode a slice of bools as ints ("1" for true, "0" for false),
+// // separated by exclamation points "!".
+// Field []bool `url:",int" del:"!"`
//
// Anonymous struct fields are usually encoded as if their inner exported
// fields were fields in the outer struct, subject to the standard Go
@@ -151,11 +164,15 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
continue
}
name, opts := parseTag(tag)
+
if name == "" {
- if sf.Anonymous && sv.Kind() == reflect.Struct {
- // save embedded struct for later processing
- embedded = append(embedded, sv)
- continue
+ if sf.Anonymous {
+ v := reflect.Indirect(sv)
+ if v.IsValid() && v.Kind() == reflect.Struct {
+ // save embedded struct for later processing
+ embedded = append(embedded, v)
+ continue
+ }
}
name = sf.Name
@@ -170,7 +187,9 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
}
if sv.Type().Implements(encoderType) {
- if !reflect.Indirect(sv).IsValid() {
+ // if sv is a nil pointer and the custom encoder is defined on a non-pointer
+ // method receiver, set sv to the zero value of the underlying type
+ if !reflect.Indirect(sv).IsValid() && sv.Type().Elem().Implements(encoderType) {
sv = reflect.New(sv.Type().Elem())
}
@@ -181,28 +200,38 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
continue
}
+ // recursively dereference pointers. break on nil pointers
+ for sv.Kind() == reflect.Ptr {
+ if sv.IsNil() {
+ break
+ }
+ sv = sv.Elem()
+ }
+
if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array {
- var del byte
+ var del string
if opts.Contains("comma") {
- del = ','
+ del = ","
} else if opts.Contains("space") {
- del = ' '
+ del = " "
} else if opts.Contains("semicolon") {
- del = ';'
+ del = ";"
} else if opts.Contains("brackets") {
name = name + "[]"
+ } else {
+ del = sf.Tag.Get("del")
}
- if del != 0 {
+ if del != "" {
s := new(bytes.Buffer)
first := true
for i := 0; i < sv.Len(); i++ {
if first {
first = false
} else {
- s.WriteByte(del)
+ s.WriteString(del)
}
- s.WriteString(valueString(sv.Index(i), opts))
+ s.WriteString(valueString(sv.Index(i), opts, sf))
}
values.Add(name, s.String())
} else {
@@ -211,30 +240,25 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
if opts.Contains("numbered") {
k = fmt.Sprintf("%s%d", name, i)
}
- values.Add(k, valueString(sv.Index(i), opts))
+ values.Add(k, valueString(sv.Index(i), opts, sf))
}
}
continue
}
- for sv.Kind() == reflect.Ptr {
- if sv.IsNil() {
- break
- }
- sv = sv.Elem()
- }
-
if sv.Type() == timeType {
- values.Add(name, valueString(sv, opts))
+ values.Add(name, valueString(sv, opts, sf))
continue
}
if sv.Kind() == reflect.Struct {
- reflectValue(values, sv, name)
+ if err := reflectValue(values, sv, name); err != nil {
+ return err
+ }
continue
}
- values.Add(name, valueString(sv, opts))
+ values.Add(name, valueString(sv, opts, sf))
}
for _, f := range embedded {
@@ -247,7 +271,7 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
}
// valueString returns the string representation of a value.
-func valueString(v reflect.Value, opts tagOptions) string {
+func valueString(v reflect.Value, opts tagOptions, sf reflect.StructField) string {
for v.Kind() == reflect.Ptr {
if v.IsNil() {
return ""
@@ -267,6 +291,15 @@ func valueString(v reflect.Value, opts tagOptions) string {
if opts.Contains("unix") {
return strconv.FormatInt(t.Unix(), 10)
}
+ if opts.Contains("unixmilli") {
+ return strconv.FormatInt((t.UnixNano() / 1e6), 10)
+ }
+ if opts.Contains("unixnano") {
+ return strconv.FormatInt(t.UnixNano(), 10)
+ }
+ if layout := sf.Tag.Get("layout"); layout != "" {
+ return t.Format(layout)
+ }
return t.Format(time.RFC3339)
}
@@ -291,8 +324,12 @@ func isEmptyValue(v reflect.Value) bool {
return v.IsNil()
}
- if v.Type() == timeType {
- return v.Interface().(time.Time).IsZero()
+ type zeroable interface {
+ IsZero() bool
+ }
+
+ if z, ok := v.Interface().(zeroable); ok {
+ return z.IsZero()
}
return false
diff --git a/vendor/github.com/hashicorp/go-version/.gitignore b/vendor/github.com/hashicorp/go-version/.gitignore
new file mode 100644
index 000000000..e9eb644a6
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-version/.gitignore
@@ -0,0 +1,2 @@
+coverage.out
+.idea/
diff --git a/vendor/github.com/hashicorp/go-version/.golangci.yml b/vendor/github.com/hashicorp/go-version/.golangci.yml
new file mode 100644
index 000000000..9253124a9
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-version/.golangci.yml
@@ -0,0 +1,40 @@
+linters:
+ enable:
+ - gosimple
+ - deadcode
+ - typecheck
+ - govet
+ - errcheck
+ - staticcheck
+ - unused
+ - structcheck
+ - varcheck
+ - golint
+ - dupl
+ - gocyclo
+ - gofmt
+ - misspell
+ - gocritic
+ enable-all: false
+ disable-all: true
+ fast: false
+
+run:
+ timeout: 3m
+
+linters-settings:
+ gocritic:
+ disabled-checks:
+ - ifElseChain
+
+issues:
+ exclude-rules:
+ # Exclude some linters from running on tests files.
+ - path: _test\.go
+ linters:
+ - gocyclo
+ - errcheck
+ - dupl
+ - gosec
+ - unparam
+ - staticcheck
diff --git a/vendor/github.com/hashicorp/go-version/.revive.toml b/vendor/github.com/hashicorp/go-version/.revive.toml
new file mode 100644
index 000000000..2e9947379
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-version/.revive.toml
@@ -0,0 +1,25 @@
+ignoreGeneratedHeader = false
+severity = "warning"
+confidence = 0.8
+errorCode = 0
+warningCode = 0
+
+[rule.blank-imports]
+[rule.context-as-argument]
+[rule.context-keys-type]
+[rule.dot-imports]
+[rule.error-return]
+[rule.error-strings]
+[rule.error-naming]
+[rule.exported]
+[rule.if-return]
+[rule.increment-decrement]
+[rule.var-naming]
+[rule.var-declaration]
+[rule.package-comments]
+[rule.range]
+[rule.receiver-naming]
+[rule.time-naming]
+[rule.unexported-return]
+[rule.indent-error-flow]
+[rule.errorf]
diff --git a/vendor/github.com/hashicorp/go-version/Makefile b/vendor/github.com/hashicorp/go-version/Makefile
new file mode 100644
index 000000000..ad92317cf
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-version/Makefile
@@ -0,0 +1,49 @@
+GO_PACKAGE := github.com/6543/go-version
+
+GO ?= go
+GOFMT ?= gofmt -s
+SHASUM ?= shasum -a 256
+
+GO_SOURCES := $(shell find . -type f -name "*.go")
+
+.PHONY: all
+all: clean test
+
+.PHONY: clean
+clean:
+ $(GO) clean -i ./...
+
+.PHONY: fmt
+fmt:
+ $(GOFMT) -w $(GO_SOURCES)
+
+.PHONY: fmt-check
+fmt-check:
+ # get all go files and run go fmt on them
+ @diff=$$($(GOFMT) -d $(GO_SOURCES)); \
+ if [ -n "$$diff" ]; then \
+ echo "Please run 'make fmt' and commit the result:"; \
+ echo "$${diff}"; \
+ exit 1; \
+ fi;
+
+.PHONY: lint
+lint: vet revive misspell
+
+.PHONY: vet
+vet:
+ $(GO) vet $(GO_PACKAGE)
+
+.PHONY: revive
+revive:
+ $(GO) get -u github.com/mgechev/revive; \
+ revive -config .revive.toml || exit 1
+
+.PHONY: misspell
+misspell-check:
+ $(GO) get -u github.com/client9/misspell/cmd/misspell; \
+ misspell -error -i unknwon,destory $(GO_SOURCES)
+
+.PHONY: test
+test:
+ $(GO) test -cover -coverprofile coverage.out || exit 1
diff --git a/vendor/github.com/hashicorp/go-version/README.md b/vendor/github.com/hashicorp/go-version/README.md
index e19e0a9af..f67a27b70 100644
--- a/vendor/github.com/hashicorp/go-version/README.md
+++ b/vendor/github.com/hashicorp/go-version/README.md
@@ -1,6 +1,8 @@
# Versioning Library for Go
![Build Status](https://github.com/6543/go-version/workflows/Release/badge.svg)
+[![License: MPL](https://img.shields.io/badge/License-MPL2-red.svg)](https://opensource.org/licenses/MPL-2.0)
[![GoDoc](https://godoc.org/github.com/6543/go-version?status.svg)](https://godoc.org/github.com/6543/go-version)
+[![Go Report Card](https://goreportcard.com/badge/github.com/6543/go-version)](https://goreportcard.com/report/github.com/6543/go-version)
go-version is a library for parsing versions and version constraints,
and verifying versions against a set of constraints. go-version
@@ -12,12 +14,12 @@ Versions used with go-version must follow [SemVer](http://semver.org/).
## Installation and Usage
Package documentation can be found on
-[GoDoc](http://godoc.org/github.com/hashicorp/go-version).
+[GoDoc](http://godoc.org/github.com/6543/go-version).
Installation can be done with a normal `go get`:
```
-$ go get github.com/hashicorp/go-version
+$ go get github.com/6543/go-version
```
#### Version Parsing and Comparison
diff --git a/vendor/github.com/hashicorp/go-version/constraint.go b/vendor/github.com/hashicorp/go-version/constraint.go
index d05575961..a2f638d6d 100644
--- a/vendor/github.com/hashicorp/go-version/constraint.go
+++ b/vendor/github.com/hashicorp/go-version/constraint.go
@@ -195,10 +195,5 @@ func constraintPessimistic(v, c *Version) bool {
// Check the last part of the segment in the constraint. If the version segment at
// this index is less than the constraints segment at this index, then it cannot
// be valid against the constraint
- if c.segments[cs-1] > v.segments[cs-1] {
- return false
- }
-
- // If nothing has rejected the version by now, it's valid
- return true
+ return c.segments[cs-1] <= v.segments[cs-1]
}
diff --git a/vendor/github.com/hashicorp/go-version/version.go b/vendor/github.com/hashicorp/go-version/version.go
index 3fb63ae80..54e482971 100644
--- a/vendor/github.com/hashicorp/go-version/version.go
+++ b/vendor/github.com/hashicorp/go-version/version.go
@@ -18,7 +18,7 @@ var (
// The raw regular expression string used for testing the validity
// of a version.
const (
- VersionRegexpRaw string = `[vV]?` + // Optional [vV] prefix
+ VersionRegexpRaw string = `(?:\w+\-)*[vV]?` + // Optional prefixes, will be ignored for parsing
`([0-9]+(\.[0-9]+)*?)` + // ( MajorNum ( '.' MinorNums ) *? )
`(-` + // Followed by (optionally): ( '-'
`([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)` + // Either ( PreNum String ( '.' OtherString ) * )
@@ -167,7 +167,7 @@ func (v *Version) Compare(other *Version) int {
// this means Other had the lower specificity
// Check to see if the remaining segments in Self are all zeros -
if !allZero(segmentsSelf[i:]) {
- //if not, it means that Self has to be greater than Other
+ // if not, it means that Self has to be greater than Other
return 1
}
break
@@ -262,7 +262,7 @@ func comparePrereleases(v string, other string) int {
}
// loop for parts to find the first difference
- for i := 0; i < biggestLen; i = i + 1 {
+ for i := 0; i < biggestLen; i++ {
partSelfPre := ""
if i < selfPreReleaseLen {
partSelfPre = selfPreReleaseMeta[i]
@@ -283,6 +283,14 @@ func comparePrereleases(v string, other string) int {
return 0
}
+// Core returns a new version constructed from only the MAJOR.MINOR.PATCH
+// segments of the version, without prerelease or metadata.
+func (v *Version) Core() *Version {
+ segments := v.Segments64()
+ segmentsOnly := fmt.Sprintf("%d.%d.%d", segments[0], segments[1], segments[2])
+ return Must(NewVersion(segmentsOnly))
+}
+
// Equal tests if two versions are equal.
func (v *Version) Equal(o *Version) bool {
if v == nil || o == nil {
@@ -371,7 +379,7 @@ func (v *Version) String() string {
str := strconv.FormatInt(s, 10)
fmtParts[i] = str
}
- fmt.Fprintf(&buf, strings.Join(fmtParts, "."))
+ fmt.Fprint(&buf, strings.Join(fmtParts, "."))
if v.pre != "" {
fmt.Fprintf(&buf, "-%s", v.pre)
}
@@ -387,3 +395,15 @@ func (v *Version) String() string {
func (v *Version) Original() string {
return v.original
}
+
+// RemoveMeta remove metadata
+// original parsed version data is not touched
+func (v *Version) RemoveMeta() {
+ v.metadata = ""
+}
+
+// RemovePre remove pre-release data
+// original parsed version data is not touched
+func (v *Version) RemovePre() {
+ v.pre = ""
+}
diff --git a/vendor/github.com/imdario/mergo/.travis.yml b/vendor/github.com/imdario/mergo/.travis.yml
index dad29725f..d324c43ba 100644
--- a/vendor/github.com/imdario/mergo/.travis.yml
+++ b/vendor/github.com/imdario/mergo/.travis.yml
@@ -1,4 +1,7 @@
language: go
+arch:
+ - amd64
+ - ppc64le
install:
- go get -t
- go get golang.org/x/tools/cmd/cover
diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md
index 876abb500..aa8cbd7ce 100644
--- a/vendor/github.com/imdario/mergo/README.md
+++ b/vendor/github.com/imdario/mergo/README.md
@@ -97,7 +97,7 @@ If Mergo is useful to you, consider buying me a coffee, a beer, or making a mont
- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
- [jnuthong/item_search](https://github.com/jnuthong/item_search)
- [bukalapak/snowboard](https://github.com/bukalapak/snowboard)
-- [janoszen/containerssh](https://github.com/janoszen/containerssh)
+- [containerssh/containerssh](https://github.com/containerssh/containerssh)
## Install
diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go
index afa84a1e2..8c2a8fcd9 100644
--- a/vendor/github.com/imdario/mergo/merge.go
+++ b/vendor/github.com/imdario/mergo/merge.go
@@ -95,13 +95,18 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
}
}
} else {
- if (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) {
+ if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) {
dst.Set(src)
}
}
case reflect.Map:
if dst.IsNil() && !src.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
+ if dst.CanSet() {
+ dst.Set(reflect.MakeMap(dst.Type()))
+ } else {
+ dst = src
+ return
+ }
}
if src.Kind() != reflect.Map {
diff --git a/vendor/github.com/issue9/identicon/.gitignore b/vendor/github.com/issue9/identicon/.gitignore
index 4063b85a0..3e7884f1f 100644
--- a/vendor/github.com/issue9/identicon/.gitignore
+++ b/vendor/github.com/issue9/identicon/.gitignore
@@ -7,18 +7,6 @@
_obj
_test
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
*.exe
*.test
*.prof
@@ -30,3 +18,6 @@ _testmain.go
.DS_Store
/testdata/*.png
+
+.idea
+.vscode
\ No newline at end of file
diff --git a/vendor/github.com/issue9/identicon/.travis.yml b/vendor/github.com/issue9/identicon/.travis.yml
deleted file mode 100644
index a755be27c..000000000
--- a/vendor/github.com/issue9/identicon/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-language: go
-
-os:
- - linux
- - osx
- - windows
-
-go:
- - tip
- - 1.12
- - 1.11
-
-script:
- - GO111MODULE=on go test -v -coverprofile=coverage.txt -covermode=atomic ./...
-
-after_success: bash <(curl -s https://codecov.io/bash)
-
-matrix:
- allow_failures:
- - go: tip
diff --git a/vendor/github.com/issue9/identicon/README.md b/vendor/github.com/issue9/identicon/README.md
index 8a801862a..2331e953c 100644
--- a/vendor/github.com/issue9/identicon/README.md
+++ b/vendor/github.com/issue9/identicon/README.md
@@ -1,14 +1,18 @@
-identicon
-[![Build Status](https://travis-ci.org/issue9/identicon.svg?branch=master)](https://travis-ci.org/issue9/identicon)
-======
+# identicon
+
+[![Go](https://github.com/issue9/identicon/actions/workflows/go.yml/badge.svg)](https://github.com/issue9/identicon/actions/workflows/go.yml)
+[![codecov](https://codecov.io/gh/issue9/identicon/branch/master/graph/badge.svg)](https://codecov.io/gh/issue9/identicon)
+[![PkgGoDev](https://pkg.go.dev/badge/github.com/issue9/identicon)](https://pkg.go.dev/github.com/issue9/identicon)
+![Go version](https://img.shields.io/github/go-mod/go-version/issue9/identicon)
+![License](https://img.shields.io/github/license/issue9/identicon)
根据用户的 IP 、邮箱名等任意数据为用户产生漂亮的随机头像。
-![screenhost.1](https://raw.github.com/issue9/identicon/master/screenshot/1.png)
-![screenhost.4](https://raw.github.com/issue9/identicon/master/screenshot/4.png)
-![screenhost.5](https://raw.github.com/issue9/identicon/master/screenshot/5.png)
-![screenhost.6](https://raw.github.com/issue9/identicon/master/screenshot/6.png)
-![screenhost.7](https://raw.github.com/issue9/identicon/master/screenshot/7.png)
+![screenshot.1](https://raw.github.com/issue9/identicon/master/screenshot/1.png)
+![screenshot.4](https://raw.github.com/issue9/identicon/master/screenshot/4.png)
+![screenshot.5](https://raw.github.com/issue9/identicon/master/screenshot/5.png)
+![screenshot.6](https://raw.github.com/issue9/identicon/master/screenshot/6.png)
+![screenshot.7](https://raw.github.com/issue9/identicon/master/screenshot/7.png)
```go
// 根据用户访问的IP,为其生成一张头像
@@ -23,19 +27,12 @@ img := ii.Make([]byte("192.168.1.1"))
img = ii.Make([]byte("192.168.1.2"))
```
-### 安装
+## 安装
```shell
go get github.com/issue9/identicon
```
-
-### 文档
-
-[![Go Walker](https://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/issue9/identicon)
-[![GoDoc](https://godoc.org/github.com/issue9/identicon?status.svg)](https://godoc.org/github.com/issue9/identicon)
-
-
-### 版权
+## 版权
本项目采用 [MIT](https://opensource.org/licenses/MIT) 开源授权许可证,完整的授权说明可在 [LICENSE](LICENSE) 文件中找到。
diff --git a/vendor/github.com/issue9/identicon/block.go b/vendor/github.com/issue9/identicon/block.go
index b504d7bf8..887ffea38 100644
--- a/vendor/github.com/issue9/identicon/block.go
+++ b/vendor/github.com/issue9/identicon/block.go
@@ -1,42 +1,33 @@
-// Copyright 2015 by caixw, All rights reserved
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
+// SPDX-License-Identifier: MIT
package identicon
-import (
- "image"
- "sync"
-)
-
-var pool = sync.Pool{
- New: func() interface{} { return make([]float64, 0, 10) },
-}
+import "image"
var (
// 可以出现在中间的方块,一般为了美观,都是对称图像。
- centerBlocks = []blockFunc{b0, b1, b2, b3}
+ centerBlocks = []blockFunc{b0, b1, b2, b3, b19, b26, b27}
// 所有方块
- blocks = []blockFunc{b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16}
+ blocks = []blockFunc{b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27}
)
// 所有 block 函数的类型
-type blockFunc func(img *image.Paletted, x, y, size float64, angle int)
+type blockFunc func(img *image.Paletted, x, y, size int, angle int)
// 将多边形 points 旋转 angle 个角度,然后输出到 img 上,起点为 x,y 坐标
-func drawBlock(img *image.Paletted, x, y, size float64, angle int, points []float64) {
+//
+// points 中的坐标是基于左上角是原点的坐标系。
+func drawBlock(img *image.Paletted, x, y, size int, angle int, points []int) {
if angle > 0 { // 0 角度不需要转换
- // 中心坐标与 x、y 的距离,方便下面指定中心坐标(x+m,y+m),
- // 0.5 的偏移值不能少,否则坐标靠右,非正中央
- m := size/2 - 0.5
- rotate(points, x+m, y+m, angle)
+ m := size / 2
+ rotate(points, m, m, angle)
}
- for i := x; i < x+size; i++ {
- for j := y; j < y+size; j++ {
+ for i := 0; i < size; i++ {
+ for j := 0; j < size; j++ {
if pointInPolygon(i, j, points) {
- img.SetColorIndex(int(i), int(j), 1)
+ img.SetColorIndex(x+i, y+j, 1)
}
}
}
@@ -49,8 +40,7 @@ func drawBlock(img *image.Paletted, x, y, size float64, angle int, points []floa
// | |
// | |
// --------
-func b0(img *image.Paletted, x, y, size float64, angle int) {
-}
+func b0(img *image.Paletted, x, y, size int, angle int) {}
// 全填充正方形
//
@@ -59,12 +49,9 @@ func b0(img *image.Paletted, x, y, size float64, angle int) {
// |######|
// |######|
// --------
-func b1(img *image.Paletted, x, y, size float64, angle int) {
- isize := int(size)
- ix := int(x)
- iy := int(y)
- for i := ix + 1; i < ix+isize; i++ {
- for j := iy + 1; j < iy+isize; j++ {
+func b1(img *image.Paletted, x, y, size int, angle int) {
+ for i := x; i < x+size; i++ {
+ for j := y; j < y+size; j++ {
img.SetColorIndex(i, j, 1)
}
}
@@ -77,14 +64,14 @@ func b1(img *image.Paletted, x, y, size float64, angle int) {
// | #### |
// | |
// ----------
-func b2(img *image.Paletted, x, y, size float64, angle int) {
+func b2(img *image.Paletted, x, y, size int, angle int) {
l := size / 4
x = x + l
y = y + l
for i := x; i < x+2*l; i++ {
for j := y; j < y+2*l; j++ {
- img.SetColorIndex(int(i), int(j), 1)
+ img.SetColorIndex(i, j, 1)
}
}
}
@@ -100,19 +87,15 @@ func b2(img *image.Paletted, x, y, size float64, angle int) {
// | ### |
// | # |
// ---------
-func b3(img *image.Paletted, x, y, size float64, angle int) {
+func b3(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- points := pool.Get().([]float64)[:0]
-
- drawBlock(img, x, y, size, 0, append(points,
- x+m, y,
- x+size, y+m,
- x+m, y+size,
- x, y+m,
- x+m, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, 0, []int{
+ m, 0,
+ size, m,
+ m, size,
+ 0, m,
+ m, 0,
+ })
}
// b4
@@ -124,16 +107,13 @@ func b3(img *image.Paletted, x, y, size float64, angle int) {
// |## |
// |# |
// |------
-func b4(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
- drawBlock(img, x, y, size, angle, append(points,
- x, y,
- x+size, y,
- x, y+size,
- x, y,
- ))
-
- pool.Put(points)
+func b4(img *image.Paletted, x, y, size int, angle int) {
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ size, 0,
+ 0, size,
+ 0, 0,
+ })
}
// b5
@@ -143,18 +123,14 @@ func b4(img *image.Paletted, x, y, size float64, angle int) {
// | ### |
// | ##### |
// |#######|
-func b5(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b5(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x+m, y,
- x+size,
- y+size,
- x, y+size,
- x+m, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ size, size,
+ 0, size,
+ m, 0,
+ })
}
// b6 矩形
@@ -164,18 +140,15 @@ func b5(img *image.Paletted, x, y, size float64, angle int) {
// |### |
// |### |
// --------
-func b6(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b6(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x, y,
- x+m, y,
- x+m, y+size,
- x, y+size,
- x, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, 0,
+ m, size,
+ 0, size,
+ 0, 0,
+ })
}
// b7 斜放的锥形
@@ -186,18 +159,15 @@ func b6(img *image.Paletted, x, y, size float64, angle int) {
// | #####|
// | ####|
// |--------
-func b7(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b7(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x, y,
- x+size, y+m,
- x+size, y+size,
- x+m, y+size,
- x, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ size, m,
+ size, size,
+ m, size,
+ 0, 0,
+ })
}
// b8 三个堆叠的三角形
@@ -210,36 +180,33 @@ func b7(img *image.Paletted, x, y, size float64, angle int) {
// | ### ### |
// |#########|
// -----------
-func b8(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b8(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
mm := m / 2
// 顶部三角形
- drawBlock(img, x, y, size, angle, append(points,
- x+m, y,
- x+3*mm, y+m,
- x+mm, y+m,
- x+m, y,
- ))
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ 3 * mm, m,
+ mm, m,
+ m, 0,
+ })
// 底下左边
- drawBlock(img, x, y, size, angle, append(points[:0],
- x+mm, y+m,
- x+m, y+size,
- x, y+size,
- x+mm, y+m,
- ))
+ drawBlock(img, x, y, size, angle, []int{
+ mm, m,
+ m, size,
+ 0, size,
+ mm, m,
+ })
// 底下右边
- drawBlock(img, x, y, size, angle, append(points[:0],
- x+3*mm, y+m,
- x+size, y+size,
- x+m, y+size,
- x+3*mm, y+m,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 3 * mm, m,
+ size, size,
+ m, size,
+ 3 * mm, m,
+ })
}
// b9 斜靠的三角形
@@ -251,17 +218,14 @@ func b8(img *image.Paletted, x, y, size float64, angle int) {
// | #### |
// | # |
// ---------
-func b9(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b9(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x, y,
- x+size, y+m,
- x+m, y+size,
- x, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ size, m,
+ m, size,
+ 0, 0,
+ })
}
// b10
@@ -276,24 +240,21 @@ func b9(img *image.Paletted, x, y, size float64, angle int) {
// |## |
// |# |
// ----------
-func b10(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b10(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x+m, y,
- x+size, y,
- x+m, y+m,
- x+m, y,
- ))
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ size, 0,
+ m, m,
+ m, 0,
+ })
- drawBlock(img, x, y, size, angle, append(points[:0],
- x, y+m,
- x+m, y+m,
- x, y+size,
- x, y+m,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, m,
+ m, m,
+ 0, size,
+ 0, m,
+ })
}
// b11 左上角1/4大小的方块
@@ -305,18 +266,15 @@ func b10(img *image.Paletted, x, y, size float64, angle int) {
// | |
// | |
// ----------
-func b11(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b11(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x, y,
- x+m, y,
- x+m, y+m,
- x, y+m,
- x, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, 0,
+ m, m,
+ 0, m,
+ 0, 0,
+ })
}
// b12
@@ -328,17 +286,14 @@ func b11(img *image.Paletted, x, y, size float64, angle int) {
// | ##### |
// | # |
// -----------
-func b12(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b12(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x, y+m,
- x+size, y+m,
- x+m, y+size,
- x, y+m,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, m,
+ size, m,
+ m, size,
+ 0, m,
+ })
}
// b13
@@ -350,17 +305,14 @@ func b12(img *image.Paletted, x, y, size float64, angle int) {
// | ##### |
// |#########|
// -----------
-func b13(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b13(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x+m, y+m,
- x+size, y+size,
- x, y+size,
- x+m, y+m,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ m, m,
+ size, size,
+ 0, size,
+ m, m,
+ })
}
// b14
@@ -372,17 +324,14 @@ func b13(img *image.Paletted, x, y, size float64, angle int) {
// | |
// | |
// ---------
-func b14(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b14(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x+m, y,
- x+m, y+m,
- x, y+m,
- x+m, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ m, m,
+ 0, m,
+ m, 0,
+ })
}
// b15
@@ -394,17 +343,14 @@ func b14(img *image.Paletted, x, y, size float64, angle int) {
// | |
// | |
// ----------
-func b15(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b15(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x, y,
- x+m, y,
- x, y+m,
- x, y,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, 0,
+ 0, m,
+ 0, 0,
+ })
}
// b16
@@ -417,22 +363,354 @@ func b15(img *image.Paletted, x, y, size float64, angle int) {
// | ##### |
// |#######|
// ---------
-func b16(img *image.Paletted, x, y, size float64, angle int) {
- points := pool.Get().([]float64)[:0]
+func b16(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
- drawBlock(img, x, y, size, angle, append(points,
- x+m, y,
- x+size, y+m,
- x, y+m,
- x+m, y,
- ))
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ size, m,
+ 0, m,
+ m, 0,
+ })
- drawBlock(img, x, y, size, angle, append(points[:0],
- x+m, y+m,
- x+size, y+size,
- x, y+size,
- x+m, y+m,
- ))
-
- pool.Put(points)
+ drawBlock(img, x, y, size, angle, []int{
+ m, m,
+ size, size,
+ 0, size,
+ m, m,
+ })
+}
+
+// b17
+//
+// ----------
+// |##### |
+// |### |
+// |# |
+// | ##|
+// | ##|
+// ----------
+func b17(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, 0,
+ 0, m,
+ 0, 0,
+ })
+
+ quarter := size / 4
+ drawBlock(img, x, y, size, angle, []int{
+ size - quarter, size - quarter,
+ size, size - quarter,
+ size, size,
+ size - quarter, size,
+ size - quarter, size - quarter,
+ })
+}
+
+// b18
+//
+// ----------
+// |##### |
+// |#### |
+// |### |
+// |## |
+// |# |
+// ----------
+func b18(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, 0,
+ 0, size,
+ 0, 0,
+ })
+}
+
+// b19
+//
+// ----------
+// |########|
+// |### ###|
+// |# #|
+// |### ###|
+// |########|
+// ----------
+func b19(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, 0,
+ 0, m,
+ 0, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ size, 0,
+ size, m,
+ m, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ size, m,
+ size, size,
+ m, size,
+ size, m,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, m,
+ m, size,
+ 0, size,
+ 0, m,
+ })
+}
+
+// b20
+//
+// ----------
+// | ## |
+// |### |
+// |## |
+// |## |
+// |# |
+// ----------
+func b20(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ 0, size,
+ 0, m,
+ q, 0,
+ })
+}
+
+// b21
+//
+// ----------
+// | #### |
+// |## #####|
+// |## ##|
+// |## |
+// |# |
+// ----------
+func b21(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ 0, size,
+ 0, m,
+ q, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ size, q,
+ size, m,
+ q, 0,
+ })
+}
+
+// b22
+//
+// ----------
+// | #### |
+// |## ### |
+// |## ##|
+// |## ##|
+// |# #|
+// ----------
+func b22(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ 0, size,
+ 0, m,
+ q, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ size, q,
+ size, size,
+ q, 0,
+ })
+}
+
+// b23
+//
+// ----------
+// | #######|
+// |### #|
+// |## |
+// |## |
+// |# |
+// ----------
+func b23(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ 0, size,
+ 0, m,
+ q, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ size, 0,
+ size, q,
+ q, 0,
+ })
+}
+
+// b24
+//
+// ----------
+// | ## ###|
+// |### ###|
+// |## ## |
+// |## ## |
+// |# # |
+// ----------
+func b24(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ q, 0,
+ 0, size,
+ 0, m,
+ q, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ m, 0,
+ size, 0,
+ m, size,
+ m, 0,
+ })
+}
+
+// b25
+//
+// ----------
+// |# #|
+// |## ###|
+// |## ## |
+// |###### |
+// |#### |
+// ----------
+func b25(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ 0, size,
+ q, size,
+ 0, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, m,
+ size, 0,
+ q, size,
+ 0, m,
+ })
+}
+
+// b26
+//
+// ----------
+// |# #|
+// |### ###|
+// | #### |
+// |### ###|
+// |# #|
+// ----------
+func b26(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ m, q,
+ q, m,
+ 0, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ size, 0,
+ m + q, m,
+ m, q,
+ size, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ size, size,
+ m, m + q,
+ q + m, m,
+ size, size,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, size,
+ q, m,
+ m, q + m,
+ 0, size,
+ })
+}
+
+// b27
+//
+// ----------
+// |########|
+// |## ###|
+// |# #|
+// |### ##|
+// |########|
+// ----------
+func b27(img *image.Paletted, x, y, size int, angle int) {
+ m := size / 2
+ q := size / 4
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, 0,
+ size, 0,
+ 0, q,
+ 0, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ q + m, 0,
+ size, 0,
+ size, size,
+ q + m, 0,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ size, q + m,
+ size, size,
+ 0, size,
+ size, q + m,
+ })
+
+ drawBlock(img, x, y, size, angle, []int{
+ 0, size,
+ 0, 0,
+ q, size,
+ 0, size,
+ })
}
diff --git a/vendor/github.com/issue9/identicon/doc.go b/vendor/github.com/issue9/identicon/doc.go
index e0371f706..3a7129829 100644
--- a/vendor/github.com/issue9/identicon/doc.go
+++ b/vendor/github.com/issue9/identicon/doc.go
@@ -1,8 +1,6 @@
-// Copyright 2015 by caixw, All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
+// SPDX-License-Identifier: MIT
-// Package identicon 一个基于 hash 值生成随机图像的包。
+// Package identicon 一个基于 hash 值生成随机图像的包
//
// identicon 并没有统一的标准,一般用于在用户注册时,
// 取用户的邮箱或是访问 IP 等数据(也可以是其它任何数据),
diff --git a/vendor/github.com/issue9/identicon/go.mod b/vendor/github.com/issue9/identicon/go.mod
index 45313601d..3c0f2a918 100644
--- a/vendor/github.com/issue9/identicon/go.mod
+++ b/vendor/github.com/issue9/identicon/go.mod
@@ -1,3 +1,5 @@
module github.com/issue9/identicon
-require github.com/issue9/assert v1.3.1
+require github.com/issue9/assert v1.4.1
+
+go 1.13
diff --git a/vendor/github.com/issue9/identicon/go.sum b/vendor/github.com/issue9/identicon/go.sum
index 4ccc898a3..e03cdc34c 100644
--- a/vendor/github.com/issue9/identicon/go.sum
+++ b/vendor/github.com/issue9/identicon/go.sum
@@ -1,2 +1,2 @@
-github.com/issue9/assert v1.3.1 h1:L8pRpbnzMIPFJqrMKR/oG03uWrtVeZyYBpI2U2Jx1JE=
-github.com/issue9/assert v1.3.1/go.mod h1:9Ger+iz8X7r1zMYYwEhh++2wMGWcNN2oVI+zIQXxcio=
+github.com/issue9/assert v1.4.1 h1:gUtOpMTeaE4JTe9kACma5foOHBvVt1p5XTFrULDwdXI=
+github.com/issue9/assert v1.4.1/go.mod h1:Yktk83hAVl1SPSYtd9kjhBizuiBIqUQyj+D5SE2yjVY=
diff --git a/vendor/github.com/issue9/identicon/identicon.go b/vendor/github.com/issue9/identicon/identicon.go
index 474a67a95..1c34d2f06 100644
--- a/vendor/github.com/issue9/identicon/identicon.go
+++ b/vendor/github.com/issue9/identicon/identicon.go
@@ -1,6 +1,4 @@
-// Copyright 2015 by caixw, All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
+// SPDX-License-Identifier: MIT
package identicon
@@ -9,6 +7,7 @@ import (
"fmt"
"image"
"image/color"
+ "math/rand"
)
const (
@@ -16,7 +15,8 @@ const (
maxForeColors = 32 // 在New()函数中可以指定的最大颜色数量
)
-// Identicon 用于产生统一尺寸的头像。
+// Identicon 用于产生统一尺寸的头像
+//
// 可以根据用户提供的数据,经过一定的算法,自动产生相应的图案和颜色。
type Identicon struct {
foreColors []color.Color
@@ -25,17 +25,18 @@ type Identicon struct {
rect image.Rectangle
}
-// New 声明一个 Identicon 实例。
+// New 声明一个 Identicon 实例
+//
// size 表示整个头像的大小;
// back 表示前景色;
// fore 表示所有可能的前景色,会为每个图像随机挑选一个作为其前景色。
func New(size int, back color.Color, fore ...color.Color) (*Identicon, error) {
if len(fore) == 0 || len(fore) > maxForeColors {
- return nil, fmt.Errorf("前景色数量必须介于[1]~[%v]之间,当前为[%v]", maxForeColors, len(fore))
+ return nil, fmt.Errorf("前景色数量必须介于[1]~[%d]之间,当前为[%d]", maxForeColors, len(fore))
}
if size < minSize {
- return nil, fmt.Errorf("参数size的值(%v)不能小于%v", size, minSize)
+ return nil, fmt.Errorf("参数 size 的值(%d)不能小于 %d", size, minSize)
}
return &Identicon{
@@ -43,104 +44,94 @@ func New(size int, back color.Color, fore ...color.Color) (*Identicon, error) {
backColor: back,
size: size,
- // 画布坐标从0开始,其长度应该是size-1
+ // 画布坐标从0开始,其长度应该是 size-1
rect: image.Rect(0, 0, size, size),
}, nil
}
-// Make 根据 data 数据产生一张唯一性的头像图片。
+// Make 根据 data 数据产生一张唯一性的头像图片
func (i *Identicon) Make(data []byte) image.Image {
h := md5.New()
h.Write(data)
sum := h.Sum(nil)
- // 第一个方块
- index := int(sum[0]+sum[1]+sum[2]+sum[3]) % len(blocks)
- b1 := blocks[index]
+ b1 := int(sum[0]+sum[1]+sum[2]) % len(blocks)
+ b2 := int(sum[3]+sum[4]+sum[5]) % len(blocks)
+ c := int(sum[6]+sum[7]+sum[8]) % len(centerBlocks)
+ b1Angle := int(sum[9]+sum[10]) % 4
+ b2Angle := int(sum[11]+sum[12]) % 4
+ color := int(sum[11]+sum[12]+sum[15]) % len(i.foreColors)
- // 第二个方块
- index = int(sum[4]+sum[5]+sum[6]+sum[7]) % len(blocks)
- b2 := blocks[index]
+ return i.render(c, b1, b2, b1Angle, b2Angle, color)
+}
- // 中间方块
- index = int(sum[8]+sum[9]+sum[10]+sum[11]) % len(centerBlocks)
- c := centerBlocks[index]
+// Rand 随机生成图案
+func (i *Identicon) Rand(r *rand.Rand) image.Image {
+ b1 := r.Intn(len(blocks))
+ b2 := r.Intn(len(blocks))
+ c := r.Intn(len(centerBlocks))
+ b1Angle := r.Intn(4)
+ b2Angle := r.Intn(4)
+ color := r.Intn(len(i.foreColors))
- // 旋转角度
- angle := int(sum[12]+sum[13]+sum[14]) % 4
+ return i.render(c, b1, b2, b1Angle, b2Angle, color)
+}
- // 根据最后一个字段,获取前景颜色
- index = int(sum[15]) % len(i.foreColors)
-
- p := image.NewPaletted(i.rect, []color.Color{i.backColor, i.foreColors[index]})
- drawBlocks(p, i.size, c, b1, b2, angle)
+func (i *Identicon) render(c, b1, b2, b1Angle, b2Angle, foreColor int) image.Image {
+ p := image.NewPaletted(i.rect, []color.Color{i.backColor, i.foreColors[foreColor]})
+ drawBlocks(p, i.size, centerBlocks[c], blocks[b1], blocks[b2], b1Angle, b2Angle)
return p
}
-// Make 根据 data 数据产生一张唯一性的头像图片。
+// Make 根据 data 数据产生一张唯一性的头像图片
+//
// size 头像的大小。
// back, fore头像的背景和前景色。
func Make(size int, back, fore color.Color, data []byte) (image.Image, error) {
- if size < minSize {
- return nil, fmt.Errorf("参数size的值(%v)不能小于%v", size, minSize)
+ i, err := New(size, back, fore)
+ if err != nil {
+ return nil, err
}
-
- h := md5.New()
- h.Write(data)
- sum := h.Sum(nil)
-
- // 第一个方块
- index := int(sum[0]+sum[1]+sum[2]+sum[3]) % len(blocks)
- b1 := blocks[index]
-
- // 第二个方块
- index = int(sum[4]+sum[5]+sum[6]+sum[7]) % len(blocks)
- b2 := blocks[index]
-
- // 中间方块
- index = int(sum[8]+sum[9]+sum[10]+sum[11]) % len(centerBlocks)
- c := centerBlocks[index]
-
- // 旋转角度
- angle := int(sum[12]+sum[13]+sum[14]+sum[15]) % 4
-
- // 画布坐标从0开始,其长度应该是size-1
- p := image.NewPaletted(image.Rect(0, 0, size, size), []color.Color{back, fore})
- drawBlocks(p, size, c, b1, b2, angle)
- return p, nil
+ return i.Make(data), nil
}
// 将九个方格都填上内容。
// p 为画板;
// c 为中间方格的填充函数;
// b1、b2 为边上 8 格的填充函数;
-// angle 为 b1、b2 的起始旋转角度。
-func drawBlocks(p *image.Paletted, size int, c, b1, b2 blockFunc, angle int) {
- // 每个格子的长宽。先转换成 float,再计算!
- blockSize := float64(size) / 3
- twoBlockSize := 2 * blockSize
-
- incr := func() { // 增加 angle 的值,但不会大于 3
- angle++
- if angle > 3 {
- angle = 0
+// b1Angle 和 b2Angle 为 b1、b2 的起始旋转角度。
+func drawBlocks(p *image.Paletted, size int, c, b1, b2 blockFunc, b1Angle, b2Angle int) {
+ incr := func(a int) int {
+ if a >= 3 {
+ a = 0
+ } else {
+ a++
}
+ return a
}
- c(p, blockSize, blockSize, blockSize, 0)
+ padding := (size % 6) / 2 // 不能除尽的,边上留白。
- b1(p, 0, 0, blockSize, angle)
- b2(p, blockSize, 0, blockSize, angle)
+ blockSize := size / 3
+ twoBlockSize := 2 * blockSize
- incr()
- b1(p, twoBlockSize, 0, blockSize, angle)
- b2(p, twoBlockSize, blockSize, blockSize, angle)
+ c(p, blockSize+padding, blockSize+padding, blockSize, 0)
- incr()
- b1(p, twoBlockSize, twoBlockSize, blockSize, angle)
- b2(p, blockSize, twoBlockSize, blockSize, angle)
+ b1(p, 0+padding, 0+padding, blockSize, b1Angle)
+ b2(p, blockSize+padding, 0+padding, blockSize, b2Angle)
- incr()
- b1(p, 0, twoBlockSize, blockSize, angle)
- b2(p, 0, blockSize, blockSize, angle)
+ b1Angle = incr(b1Angle)
+ b2Angle = incr(b2Angle)
+ b1(p, twoBlockSize+padding, 0+padding, blockSize, b1Angle)
+ b2(p, twoBlockSize+padding, blockSize+padding, blockSize, b2Angle)
+
+ b1Angle = incr(b1Angle)
+ b2Angle = incr(b2Angle)
+ b1(p, twoBlockSize+padding, twoBlockSize+padding, blockSize, b1Angle)
+ b2(p, blockSize+padding, twoBlockSize+padding, blockSize, b2Angle)
+
+ b1Angle = incr(b1Angle)
+ b2Angle = incr(b2Angle)
+ b1(p, 0+padding, twoBlockSize+padding, blockSize, b1Angle)
+ b2(p, 0+padding, blockSize+padding, blockSize, b2Angle)
}
diff --git a/vendor/github.com/issue9/identicon/polygon.go b/vendor/github.com/issue9/identicon/polygon.go
index 7cd39e7c0..eedb98c83 100644
--- a/vendor/github.com/issue9/identicon/polygon.go
+++ b/vendor/github.com/issue9/identicon/polygon.go
@@ -1,27 +1,24 @@
-// Copyright 2015 by caixw, All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
+// SPDX-License-Identifier: MIT
package identicon
var (
- // 4个元素分别表示 cos(0),cos(90),cos(180),cos(270)
- cos = []float64{1, 0, -1, 0}
+ // 4 个元素分别表示 cos(0),cos(90),cos(180),cos(270)
+ cos = []int{1, 0, -1, 0}
- // 4个元素分别表示 sin(0),sin(90),sin(180),sin(270)
- sin = []float64{0, 1, 0, -1}
+ // 4 个元素分别表示 sin(0),sin(90),sin(180),sin(270)
+ sin = []int{0, 1, 0, -1}
)
// 将 points 中的所有点,以 x,y 为原点旋转 angle 个角度。
// angle 取值只能是 [0,1,2,3],分别表示 [0,90,180,270]
-func rotate(points []float64, x, y float64, angle int) {
+func rotate(points []int, x, y int, angle int) {
if angle < 0 || angle > 3 {
panic("rotate:参数angle必须0,1,2,3三值之一")
}
for i := 0; i < len(points); i += 2 {
- px := points[i] - x
- py := points[i+1] - y
+ px, py := points[i]-x, points[i+1]-y
points[i] = px*cos[angle] - py*sin[angle] + x
points[i+1] = px*sin[angle] + py*cos[angle] + y
}
@@ -30,7 +27,7 @@ func rotate(points []float64, x, y float64, angle int) {
// 判断某个点是否在多边形之内,不包含构成多边形的线和点
// x,y 需要判断的点坐标
// points 组成多边形的所顶点,每两个元素表示一点顶点,其中最后一个顶点必须与第一个顶点相同。
-func pointInPolygon(x float64, y float64, points []float64) bool {
+func pointInPolygon(x, y int, points []int) bool {
if len(points) < 8 { // 只有2个以上的点,才能组成闭合多边形
return false
}
@@ -55,8 +52,7 @@ func pointInPolygon(x float64, y float64, points []float64) bool {
continue
}
- mul := (x1-x)*(y2-y) - (x2-x)*(y1-y)
- if mul > 0 {
+ if mul := (x1-x)*(y2-y) - (x2-x)*(y1-y); mul >= 0 {
r++
} else if mul < 0 {
r--
diff --git a/vendor/github.com/jessevdk/go-flags/.travis.yml b/vendor/github.com/jessevdk/go-flags/.travis.yml
index 0f0728d2f..2fc5e5f5b 100644
--- a/vendor/github.com/jessevdk/go-flags/.travis.yml
+++ b/vendor/github.com/jessevdk/go-flags/.travis.yml
@@ -5,19 +5,14 @@ os:
- osx
go:
- - 1.x
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - 1.10.x
+ - 1.16.x
install:
# go-flags
- - go get -d -v ./...
- go build -v ./...
# linting
- - go get github.com/golang/lint/golint
+ - go get -v golang.org/x/lint/golint
# code coverage
- go get golang.org/x/tools/cmd/cover
diff --git a/vendor/github.com/jessevdk/go-flags/README.md b/vendor/github.com/jessevdk/go-flags/README.md
index 3b02394ed..f22650b20 100644
--- a/vendor/github.com/jessevdk/go-flags/README.md
+++ b/vendor/github.com/jessevdk/go-flags/README.md
@@ -61,6 +61,9 @@ var opts struct {
// Example of a required flag
Name string `short:"n" long:"name" description:"A name" required:"true"`
+ // Example of a flag restricted to a pre-defined set of strings
+ Animal string `long:"animal" choice:"cat" choice:"dog"`
+
// Example of a value name
File string `short:"f" long:"file" description:"A file" value-name:"FILE"`
@@ -91,6 +94,7 @@ args := []string{
"-vv",
"--offset=5",
"-n", "Me",
+ "--animal", "dog", // anything other than "cat" or "dog" will raise an error
"-p", "3",
"-s", "hello",
"-s", "world",
@@ -115,6 +119,7 @@ if err != nil {
fmt.Printf("Verbosity: %v\n", opts.Verbose)
fmt.Printf("Offset: %d\n", opts.Offset)
fmt.Printf("Name: %s\n", opts.Name)
+fmt.Printf("Animal: %s\n", opts.Animal)
fmt.Printf("Ptr: %d\n", *opts.Ptr)
fmt.Printf("StringSlice: %v\n", opts.StringSlice)
fmt.Printf("PtrSlice: [%v %v]\n", *opts.PtrSlice[0], *opts.PtrSlice[1])
diff --git a/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh b/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh
index c494f6119..5edc430ed 100644
--- a/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh
+++ b/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh
@@ -14,3 +14,7 @@ echo '# darwin'
GOARCH=amd64 GOOS=darwin go build
echo '# freebsd'
GOARCH=amd64 GOOS=freebsd go build
+echo '# aix ppc64'
+GOARCH=ppc64 GOOS=aix go build
+echo '# solaris amd64'
+GOARCH=amd64 GOOS=solaris go build
diff --git a/vendor/github.com/jessevdk/go-flags/command.go b/vendor/github.com/jessevdk/go-flags/command.go
index 486bacba1..879465d7a 100644
--- a/vendor/github.com/jessevdk/go-flags/command.go
+++ b/vendor/github.com/jessevdk/go-flags/command.go
@@ -438,7 +438,7 @@ func (c *Command) match(name string) bool {
return false
}
-func (c *Command) hasCliOptions() bool {
+func (c *Command) hasHelpOptions() bool {
ret := false
c.eachGroup(func(g *Group) {
@@ -447,7 +447,7 @@ func (c *Command) hasCliOptions() bool {
}
for _, opt := range g.options {
- if opt.canCli() {
+ if opt.showInHelp() {
ret = true
}
}
diff --git a/vendor/github.com/jessevdk/go-flags/completion.go b/vendor/github.com/jessevdk/go-flags/completion.go
index 7a7a08b93..8ed61f1db 100644
--- a/vendor/github.com/jessevdk/go-flags/completion.go
+++ b/vendor/github.com/jessevdk/go-flags/completion.go
@@ -2,6 +2,7 @@ package flags
import (
"fmt"
+ "os"
"path/filepath"
"reflect"
"sort"
@@ -62,6 +63,11 @@ func completionsWithoutDescriptions(items []string) []Completion {
// prefix.
func (f *Filename) Complete(match string) []Completion {
ret, _ := filepath.Glob(match + "*")
+ if len(ret) == 1 {
+ if info, err := os.Stat(ret[0]); err == nil && info.IsDir() {
+ ret[0] = ret[0] + "/"
+ }
+ }
return completionsWithoutDescriptions(ret)
}
@@ -76,7 +82,7 @@ func (c *completion) skipPositional(s *parseState, n int) {
func (c *completion) completeOptionNames(s *parseState, prefix string, match string, short bool) []Completion {
if short && len(match) != 0 {
return []Completion{
- Completion{
+ {
Item: prefix + match,
},
}
@@ -124,7 +130,7 @@ func (c *completion) completeCommands(s *parseState, match string) []Completion
n := make([]Completion, 0, len(s.command.commands))
for _, cmd := range s.command.commands {
- if cmd.data != c && strings.HasPrefix(cmd.Name, match) {
+ if cmd.data != c && !cmd.Hidden && strings.HasPrefix(cmd.Name, match) {
n = append(n, Completion{
Item: cmd.Name,
Description: cmd.ShortDescription,
diff --git a/vendor/github.com/jessevdk/go-flags/convert.go b/vendor/github.com/jessevdk/go-flags/convert.go
index 984aac89c..cda29b2f0 100644
--- a/vendor/github.com/jessevdk/go-flags/convert.go
+++ b/vendor/github.com/jessevdk/go-flags/convert.go
@@ -28,6 +28,15 @@ type Unmarshaler interface {
UnmarshalFlag(value string) error
}
+// ValueValidator is the interface implemented by types that can validate a
+// flag argument themselves. The provided value is directly passed from the
+// command line.
+type ValueValidator interface {
+ // IsValidValue returns an error if the provided string value is valid for
+ // the flag.
+ IsValidValue(value string) error
+}
+
func getBase(options multiTag, base int) (int, error) {
sbase := options.Get("base")
diff --git a/vendor/github.com/jessevdk/go-flags/error.go b/vendor/github.com/jessevdk/go-flags/error.go
index 05528d8d2..73e07cfc2 100644
--- a/vendor/github.com/jessevdk/go-flags/error.go
+++ b/vendor/github.com/jessevdk/go-flags/error.go
@@ -97,6 +97,10 @@ func (e ErrorType) String() string {
return "unrecognized error type"
}
+func (e ErrorType) Error() string {
+ return e.String()
+}
+
// Error represents a parser error. The error returned from Parse is of this
// type. The error contains both a Type and Message.
type Error struct {
diff --git a/vendor/github.com/jessevdk/go-flags/flags.go b/vendor/github.com/jessevdk/go-flags/flags.go
index 889762d10..ac2157dd6 100644
--- a/vendor/github.com/jessevdk/go-flags/flags.go
+++ b/vendor/github.com/jessevdk/go-flags/flags.go
@@ -109,7 +109,8 @@ The following is a list of tags for struct fields supported by go-flags:
value-name: the name of the argument value (to be shown in the help)
(optional)
choice: limits the values for an option to a set of values.
- This tag can be specified multiple times (optional)
+ Repeat this tag once for each allowable value.
+ e.g. `long:"animal" choice:"cat" choice:"dog"`
hidden: if non-empty, the option is not visible in the help or man page.
base: a base (radix) used to convert strings to integer values, the
@@ -125,6 +126,10 @@ The following is a list of tags for struct fields supported by go-flags:
gets prepended to every option's long name and
subgroup's namespace of this group, separated by
the parser's namespace delimiter (optional)
+ env-namespace: when specified on a group struct field, the env-namespace
+ gets prepended to every option's env key and
+ subgroup's env-namespace of this group, separated by
+ the parser's env-namespace delimiter (optional)
command: when specified on a struct field, makes the struct
field a (sub)command with the given name (optional)
subcommands-optional: when specified on a command struct field, makes
diff --git a/vendor/github.com/jessevdk/go-flags/go.mod b/vendor/github.com/jessevdk/go-flags/go.mod
new file mode 100644
index 000000000..a626c5d10
--- /dev/null
+++ b/vendor/github.com/jessevdk/go-flags/go.mod
@@ -0,0 +1,5 @@
+module github.com/jessevdk/go-flags
+
+go 1.15
+
+require golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4
diff --git a/vendor/github.com/jessevdk/go-flags/go.sum b/vendor/github.com/jessevdk/go-flags/go.sum
new file mode 100644
index 000000000..7503251e1
--- /dev/null
+++ b/vendor/github.com/jessevdk/go-flags/go.sum
@@ -0,0 +1,2 @@
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
diff --git a/vendor/github.com/jessevdk/go-flags/group.go b/vendor/github.com/jessevdk/go-flags/group.go
index 9e057abd9..181caabb2 100644
--- a/vendor/github.com/jessevdk/go-flags/group.go
+++ b/vendor/github.com/jessevdk/go-flags/group.go
@@ -34,6 +34,9 @@ type Group struct {
// The namespace of the group
Namespace string
+ // The environment namespace of the group
+ EnvNamespace string
+
// If true, the group is not displayed in the help or man page
Hidden bool
@@ -70,6 +73,13 @@ func (g *Group) AddGroup(shortDescription string, longDescription string, data i
return group, nil
}
+// AddOption adds a new option to this group.
+func (g *Group) AddOption(option *Option, data interface{}) {
+ option.value = reflect.ValueOf(data)
+ option.group = g
+ g.options = append(g.options, option)
+}
+
// Groups returns the list of groups embedded in this group.
func (g *Group) Groups() []*Group {
return g.groups
@@ -165,6 +175,18 @@ func (g *Group) optionByName(name string, namematch func(*Option, string) bool)
return retopt
}
+func (g *Group) showInHelp() bool {
+ if g.Hidden {
+ return false
+ }
+ for _, opt := range g.options {
+ if opt.showInHelp() {
+ return true
+ }
+ }
+ return false
+}
+
func (g *Group) eachGroup(f func(*Group)) {
f(g)
@@ -358,6 +380,7 @@ func (g *Group) scanSubGroupHandler(realval reflect.Value, sfield *reflect.Struc
}
group.Namespace = mtag.Get("namespace")
+ group.EnvNamespace = mtag.Get("env-namespace")
group.Hidden = mtag.Get("hidden") != ""
return true, nil
diff --git a/vendor/github.com/jessevdk/go-flags/help.go b/vendor/github.com/jessevdk/go-flags/help.go
index d38030500..068fce152 100644
--- a/vendor/github.com/jessevdk/go-flags/help.go
+++ b/vendor/github.com/jessevdk/go-flags/help.go
@@ -72,6 +72,9 @@ func (p *Parser) getAlignmentInfo() alignmentInfo {
var prevcmd *Command
p.eachActiveGroup(func(c *Command, grp *Group) {
+ if !grp.showInHelp() {
+ return
+ }
if c != prevcmd {
for _, arg := range c.args {
ret.updateLen(arg.Name, c != p.Command)
@@ -79,7 +82,7 @@ func (p *Parser) getAlignmentInfo() alignmentInfo {
}
for _, info := range grp.options {
- if !info.canCli() {
+ if !info.showInHelp() {
continue
}
@@ -225,12 +228,12 @@ func (p *Parser) writeHelpOption(writer *bufio.Writer, option *Option, info alig
}
var envDef string
- if option.EnvDefaultKey != "" {
+ if option.EnvKeyWithNamespace() != "" {
var envPrintable string
if runtime.GOOS == "windows" {
- envPrintable = "%" + option.EnvDefaultKey + "%"
+ envPrintable = "%" + option.EnvKeyWithNamespace() + "%"
} else {
- envPrintable = "$" + option.EnvDefaultKey
+ envPrintable = "$" + option.EnvKeyWithNamespace()
}
envDef = fmt.Sprintf(" [%s]", envPrintable)
}
@@ -305,7 +308,7 @@ func (p *Parser) WriteHelp(writer io.Writer) {
}
} else if us, ok := allcmd.data.(Usage); ok {
usage = us.Usage()
- } else if allcmd.hasCliOptions() {
+ } else if allcmd.hasHelpOptions() {
usage = fmt.Sprintf("[%s-OPTIONS]", allcmd.Name)
}
@@ -393,7 +396,7 @@ func (p *Parser) WriteHelp(writer io.Writer) {
}
for _, info := range grp.options {
- if !info.canCli() || info.Hidden {
+ if !info.showInHelp() {
continue
}
@@ -489,3 +492,23 @@ func (p *Parser) WriteHelp(writer io.Writer) {
wr.Flush()
}
+
+// WroteHelp is a helper to test the error from ParseArgs() to
+// determine if the help message was written. It is safe to
+// call without first checking that error is nil.
+func WroteHelp(err error) bool {
+ if err == nil { // No error
+ return false
+ }
+
+ flagError, ok := err.(*Error)
+ if !ok { // Not a go-flag error
+ return false
+ }
+
+ if flagError.Type != ErrHelp { // Did not print the help message
+ return false
+ }
+
+ return true
+}
diff --git a/vendor/github.com/jessevdk/go-flags/ini.go b/vendor/github.com/jessevdk/go-flags/ini.go
index e714d3d38..60b36c79c 100644
--- a/vendor/github.com/jessevdk/go-flags/ini.go
+++ b/vendor/github.com/jessevdk/go-flags/ini.go
@@ -325,19 +325,19 @@ func writeCommandIni(command *Command, namespace string, writer io.Writer, optio
})
for _, c := range command.commands {
- var nns string
+ var fqn string
if c.Hidden {
continue
}
if len(namespace) != 0 {
- nns = c.Name + "." + nns
+ fqn = namespace + "." + c.Name
} else {
- nns = c.Name
+ fqn = c.Name
}
- writeCommandIni(c, nns, writer, options)
+ writeCommandIni(c, fqn, writer, options)
}
}
@@ -499,13 +499,21 @@ func (i *IniParser) matchingGroups(name string) []*Group {
func (i *IniParser) parse(ini *ini) error {
p := i.parser
+ p.eachOption(func(cmd *Command, group *Group, option *Option) {
+ option.clearReferenceBeforeSet = true
+ })
+
var quotesLookup = make(map[*Option]bool)
for name, section := range ini.Sections {
groups := i.matchingGroups(name)
if len(groups) == 0 {
- return newErrorf(ErrUnknownGroup, "could not find option group `%s'", name)
+ if (p.Options & IgnoreUnknown) == None {
+ return newErrorf(ErrUnknownGroup, "could not find option group `%s'", name)
+ }
+
+ continue
}
for _, inival := range section {
@@ -537,9 +545,8 @@ func (i *IniParser) parse(ini *ini) error {
continue
}
- // ini value is ignored if override is set and
- // value was previously set from non default
- if i.ParseAsDefaults && !opt.isSetDefault {
+ // ini value is ignored if parsed as default but defaults are prevented
+ if i.ParseAsDefaults && opt.preventDefault {
continue
}
@@ -572,7 +579,15 @@ func (i *IniParser) parse(ini *ini) error {
}
}
- if err := opt.set(pval); err != nil {
+ var err error
+
+ if i.ParseAsDefaults {
+ err = opt.setDefault(pval)
+ } else {
+ err = opt.set(pval)
+ }
+
+ if err != nil {
return &IniError{
Message: err.Error(),
File: ini.File,
@@ -580,6 +595,9 @@ func (i *IniParser) parse(ini *ini) error {
}
}
+ // Defaults from ini files take precendence over defaults from parser
+ opt.preventDefault = true
+
// either all INI values are quoted or only values who need quoting
if _, ok := quotesLookup[opt]; !inival.Quoted || !ok {
quotesLookup[opt] = inival.Quoted
diff --git a/vendor/github.com/jessevdk/go-flags/man.go b/vendor/github.com/jessevdk/go-flags/man.go
index 0cb114e74..82572f9a7 100644
--- a/vendor/github.com/jessevdk/go-flags/man.go
+++ b/vendor/github.com/jessevdk/go-flags/man.go
@@ -3,42 +3,55 @@ package flags
import (
"fmt"
"io"
+ "os"
"runtime"
+ "strconv"
"strings"
"time"
)
+func manQuoteLines(s string) string {
+ lines := strings.Split(s, "\n")
+ parts := []string{}
+
+ for _, line := range lines {
+ parts = append(parts, manQuote(line))
+ }
+
+ return strings.Join(parts, "\n")
+}
+
func manQuote(s string) string {
return strings.Replace(s, "\\", "\\\\", -1)
}
-func formatForMan(wr io.Writer, s string) {
+func formatForMan(wr io.Writer, s string, quoter func(s string) string) {
for {
idx := strings.IndexRune(s, '`')
if idx < 0 {
- fmt.Fprintf(wr, "%s", manQuote(s))
+ fmt.Fprintf(wr, "%s", quoter(s))
break
}
- fmt.Fprintf(wr, "%s", manQuote(s[:idx]))
+ fmt.Fprintf(wr, "%s", quoter(s[:idx]))
s = s[idx+1:]
idx = strings.IndexRune(s, '\'')
if idx < 0 {
- fmt.Fprintf(wr, "%s", manQuote(s))
+ fmt.Fprintf(wr, "%s", quoter(s))
break
}
- fmt.Fprintf(wr, "\\fB%s\\fP", manQuote(s[:idx]))
+ fmt.Fprintf(wr, "\\fB%s\\fP", quoter(s[:idx]))
s = s[idx+1:]
}
}
func writeManPageOptions(wr io.Writer, grp *Group) {
grp.eachGroup(func(group *Group) {
- if group.Hidden || len(group.options) == 0 {
+ if !group.showInHelp() {
return
}
@@ -48,13 +61,13 @@ func writeManPageOptions(wr io.Writer, grp *Group) {
fmt.Fprintf(wr, ".SS %s\n", group.ShortDescription)
if group.LongDescription != "" {
- formatForMan(wr, group.LongDescription)
+ formatForMan(wr, group.LongDescription, manQuoteLines)
fmt.Fprintln(wr, "")
}
}
for _, opt := range group.options {
- if !opt.canCli() || opt.Hidden {
+ if !opt.showInHelp() {
continue
}
@@ -83,11 +96,11 @@ func writeManPageOptions(wr io.Writer, grp *Group) {
if len(opt.Default) != 0 {
fmt.Fprintf(wr, " ", manQuote(strings.Join(quoteV(opt.Default), ", ")))
- } else if len(opt.EnvDefaultKey) != 0 {
+ } else if len(opt.EnvKeyWithNamespace()) != 0 {
if runtime.GOOS == "windows" {
- fmt.Fprintf(wr, " ", manQuote(opt.EnvDefaultKey))
+ fmt.Fprintf(wr, " ", manQuote(opt.EnvKeyWithNamespace()))
} else {
- fmt.Fprintf(wr, " ", manQuote(opt.EnvDefaultKey))
+ fmt.Fprintf(wr, " ", manQuote(opt.EnvKeyWithNamespace()))
}
}
@@ -98,14 +111,14 @@ func writeManPageOptions(wr io.Writer, grp *Group) {
fmt.Fprintln(wr, "\\fP")
if len(opt.Description) != 0 {
- formatForMan(wr, opt.Description)
+ formatForMan(wr, opt.Description, manQuoteLines)
fmt.Fprintln(wr, "")
}
}
})
}
-func writeManPageSubcommands(wr io.Writer, name string, root *Command) {
+func writeManPageSubcommands(wr io.Writer, name string, usagePrefix string, root *Command) {
commands := root.sortedVisibleCommands()
for _, c := range commands {
@@ -121,11 +134,11 @@ func writeManPageSubcommands(wr io.Writer, name string, root *Command) {
nn = c.Name
}
- writeManPageCommand(wr, nn, root, c)
+ writeManPageCommand(wr, nn, usagePrefix, c)
}
}
-func writeManPageCommand(wr io.Writer, name string, root *Command, command *Command) {
+func writeManPageCommand(wr io.Writer, name string, usagePrefix string, command *Command) {
fmt.Fprintf(wr, ".SS %s\n", name)
fmt.Fprintln(wr, command.ShortDescription)
@@ -137,30 +150,27 @@ func writeManPageCommand(wr io.Writer, name string, root *Command, command *Comm
if strings.HasPrefix(command.LongDescription, cmdstart) {
fmt.Fprintf(wr, "The \\fI%s\\fP command", manQuote(command.Name))
- formatForMan(wr, command.LongDescription[len(cmdstart):])
+ formatForMan(wr, command.LongDescription[len(cmdstart):], manQuoteLines)
fmt.Fprintln(wr, "")
} else {
- formatForMan(wr, command.LongDescription)
+ formatForMan(wr, command.LongDescription, manQuoteLines)
fmt.Fprintln(wr, "")
}
}
+ var pre = usagePrefix + " " + command.Name
+
var usage string
if us, ok := command.data.(Usage); ok {
usage = us.Usage()
- } else if command.hasCliOptions() {
+ } else if command.hasHelpOptions() {
usage = fmt.Sprintf("[%s-OPTIONS]", command.Name)
}
- var pre string
- if root.hasCliOptions() {
- pre = fmt.Sprintf("%s [OPTIONS] %s", root.Name, command.Name)
- } else {
- pre = fmt.Sprintf("%s %s", root.Name, command.Name)
- }
-
+ var nextPrefix = pre
if len(usage) > 0 {
fmt.Fprintf(wr, "\n\\fBUsage\\fP: %s %s\n.TP\n", manQuote(pre), manQuote(usage))
+ nextPrefix = pre + " " + usage
}
if len(command.Aliases) > 0 {
@@ -168,17 +178,25 @@ func writeManPageCommand(wr io.Writer, name string, root *Command, command *Comm
}
writeManPageOptions(wr, command.Group)
- writeManPageSubcommands(wr, name, command)
+ writeManPageSubcommands(wr, name, nextPrefix, command)
}
// WriteManPage writes a basic man page in groff format to the specified
// writer.
func (p *Parser) WriteManPage(wr io.Writer) {
t := time.Now()
+ source_date_epoch := os.Getenv("SOURCE_DATE_EPOCH")
+ if source_date_epoch != "" {
+ sde, err := strconv.ParseInt(source_date_epoch, 10, 64)
+ if err != nil {
+ panic(fmt.Sprintf("Invalid SOURCE_DATE_EPOCH: %s", err))
+ }
+ t = time.Unix(sde, 0)
+ }
fmt.Fprintf(wr, ".TH %s 1 \"%s\"\n", manQuote(p.Name), t.Format("2 January 2006"))
fmt.Fprintln(wr, ".SH NAME")
- fmt.Fprintf(wr, "%s \\- %s\n", manQuote(p.Name), manQuote(p.ShortDescription))
+ fmt.Fprintf(wr, "%s \\- %s\n", manQuote(p.Name), manQuoteLines(p.ShortDescription))
fmt.Fprintln(wr, ".SH SYNOPSIS")
usage := p.Usage
@@ -190,7 +208,7 @@ func (p *Parser) WriteManPage(wr io.Writer) {
fmt.Fprintf(wr, "\\fB%s\\fP %s\n", manQuote(p.Name), manQuote(usage))
fmt.Fprintln(wr, ".SH DESCRIPTION")
- formatForMan(wr, p.LongDescription)
+ formatForMan(wr, p.LongDescription, manQuoteLines)
fmt.Fprintln(wr, "")
fmt.Fprintln(wr, ".SH OPTIONS")
@@ -200,6 +218,6 @@ func (p *Parser) WriteManPage(wr io.Writer) {
if len(p.visibleCommands()) > 0 {
fmt.Fprintln(wr, ".SH COMMANDS")
- writeManPageSubcommands(wr, "", p.Command)
+ writeManPageSubcommands(wr, "", p.Name+" "+usage, p.Command)
}
}
diff --git a/vendor/github.com/jessevdk/go-flags/option.go b/vendor/github.com/jessevdk/go-flags/option.go
index 5f8525019..f6d694181 100644
--- a/vendor/github.com/jessevdk/go-flags/option.go
+++ b/vendor/github.com/jessevdk/go-flags/option.go
@@ -80,10 +80,11 @@ type Option struct {
// Determines if the option will be always quoted in the INI output
iniQuote bool
- tag multiTag
- isSet bool
- isSetDefault bool
- preventDefault bool
+ tag multiTag
+ isSet bool
+ isSetDefault bool
+ preventDefault bool
+ clearReferenceBeforeSet bool
defaultLiteral string
}
@@ -139,6 +140,57 @@ func (option *Option) LongNameWithNamespace() string {
return longName
}
+// EnvKeyWithNamespace returns the option's env key with the group namespaces
+// prepended by walking up the option's group tree. Namespaces and the env key
+// itself are separated by the parser's namespace delimiter. If the env key is
+// empty an empty string is returned.
+func (option *Option) EnvKeyWithNamespace() string {
+ if len(option.EnvDefaultKey) == 0 {
+ return ""
+ }
+
+ // fetch the namespace delimiter from the parser which is always at the
+ // end of the group hierarchy
+ namespaceDelimiter := ""
+ g := option.group
+
+ for {
+ if p, ok := g.parent.(*Parser); ok {
+ namespaceDelimiter = p.EnvNamespaceDelimiter
+
+ break
+ }
+
+ switch i := g.parent.(type) {
+ case *Command:
+ g = i.Group
+ case *Group:
+ g = i
+ }
+ }
+
+ // concatenate long name with namespace
+ key := option.EnvDefaultKey
+ g = option.group
+
+ for g != nil {
+ if g.EnvNamespace != "" {
+ key = g.EnvNamespace + namespaceDelimiter + key
+ }
+
+ switch i := g.parent.(type) {
+ case *Command:
+ g = i.Group
+ case *Group:
+ g = i
+ case *Parser:
+ g = nil
+ }
+ }
+
+ return key
+}
+
// String converts an option to a human friendly readable string describing the
// option.
func (option *Option) String() string {
@@ -190,12 +242,13 @@ func (option *Option) IsSetDefault() bool {
func (option *Option) set(value *string) error {
kind := option.value.Type().Kind()
- if (kind == reflect.Map || kind == reflect.Slice) && !option.isSet {
+ if (kind == reflect.Map || kind == reflect.Slice) && option.clearReferenceBeforeSet {
option.empty()
}
option.isSet = true
option.preventDefault = true
+ option.clearReferenceBeforeSet = false
if len(option.Choices) != 0 {
found := false
@@ -229,8 +282,23 @@ func (option *Option) set(value *string) error {
return convert("", option.value, option.tag)
}
-func (option *Option) canCli() bool {
- return option.ShortName != 0 || len(option.LongName) != 0
+func (option *Option) setDefault(value *string) error {
+ if option.preventDefault {
+ return nil
+ }
+
+ if err := option.set(value); err != nil {
+ return err
+ }
+
+ option.isSetDefault = true
+ option.preventDefault = false
+
+ return nil
+}
+
+func (option *Option) showInHelp() bool {
+ return !option.Hidden && (option.ShortName != 0 || len(option.LongName) != 0)
}
func (option *Option) canArgument() bool {
@@ -257,14 +325,17 @@ func (option *Option) empty() {
}
}
-func (option *Option) clearDefault() {
+func (option *Option) clearDefault() error {
+ if option.preventDefault {
+ return nil
+ }
+
usedDefault := option.Default
- if envKey := option.EnvDefaultKey; envKey != "" {
+ if envKey := option.EnvKeyWithNamespace(); envKey != "" {
if value, ok := os.LookupEnv(envKey); ok {
if option.EnvDefaultDelim != "" {
- usedDefault = strings.Split(value,
- option.EnvDefaultDelim)
+ usedDefault = strings.Split(value, option.EnvDefaultDelim)
} else {
usedDefault = []string{value}
}
@@ -277,8 +348,11 @@ func (option *Option) clearDefault() {
option.empty()
for _, d := range usedDefault {
- option.set(&d)
- option.isSetDefault = true
+ err := option.setDefault(&d)
+
+ if err != nil {
+ return err
+ }
}
} else {
tp := option.value.Type()
@@ -294,6 +368,8 @@ func (option *Option) clearDefault() {
}
}
}
+
+ return nil
}
func (option *Option) valueIsDefault() bool {
@@ -339,6 +415,30 @@ func (option *Option) isUnmarshaler() Unmarshaler {
return nil
}
+func (option *Option) isValueValidator() ValueValidator {
+ v := option.value
+
+ for {
+ if !v.CanInterface() {
+ break
+ }
+
+ i := v.Interface()
+
+ if u, ok := i.(ValueValidator); ok {
+ return u
+ }
+
+ if !v.CanAddr() {
+ break
+ }
+
+ v = v.Addr()
+ }
+
+ return nil
+}
+
func (option *Option) isBool() bool {
tp := option.value.Type()
@@ -457,3 +557,13 @@ func (option *Option) shortAndLongName() string {
return ret.String()
}
+
+func (option *Option) isValidValue(arg string) error {
+ if validator := option.isValueValidator(); validator != nil {
+ return validator.IsValidValue(arg)
+ }
+ if argumentIsOption(arg) && !(option.isSignedNumber() && len(arg) > 1 && arg[0] == '-' && arg[1] >= '0' && arg[1] <= '9') {
+ return fmt.Errorf("expected argument for flag `%s', but got option `%s'", option, arg)
+ }
+ return nil
+}
diff --git a/vendor/github.com/jessevdk/go-flags/parser.go b/vendor/github.com/jessevdk/go-flags/parser.go
index 0a7922a08..3fc3f7ba1 100644
--- a/vendor/github.com/jessevdk/go-flags/parser.go
+++ b/vendor/github.com/jessevdk/go-flags/parser.go
@@ -9,6 +9,7 @@ import (
"fmt"
"os"
"path"
+ "reflect"
"sort"
"strings"
"unicode/utf8"
@@ -29,6 +30,9 @@ type Parser struct {
// NamespaceDelimiter separates group namespaces and option long names
NamespaceDelimiter string
+ // EnvNamespaceDelimiter separates group env namespaces and env keys
+ EnvNamespaceDelimiter string
+
// UnknownOptionsHandler is a function which gets called when the parser
// encounters an unknown option. The function receives the unknown option
// name, a SplitArgument which specifies its value if set with an argument
@@ -170,9 +174,10 @@ func NewParser(data interface{}, options Options) *Parser {
// be added to this parser by using AddGroup and AddCommand.
func NewNamedParser(appname string, options Options) *Parser {
p := &Parser{
- Command: newCommand(appname, "", "", nil),
- Options: options,
- NamespaceDelimiter: ".",
+ Command: newCommand(appname, "", "", nil),
+ Options: options,
+ NamespaceDelimiter: ".",
+ EnvNamespaceDelimiter: "_",
}
p.Command.parent = p
@@ -203,8 +208,7 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
}
p.eachOption(func(c *Command, g *Group, option *Option) {
- option.isSet = false
- option.isSetDefault = false
+ option.clearReferenceBeforeSet = true
option.updateDefaultLiteral()
})
@@ -237,6 +241,7 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
p.fillParseState(s)
for !s.eof() {
+ var err error
arg := s.pop()
// When PassDoubleDash is set and we encounter a --, then
@@ -247,6 +252,20 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
}
if !argumentIsOption(arg) {
+ if (p.Options&PassAfterNonOption) != None && s.lookup.commands[arg] == nil {
+ // If PassAfterNonOption is set then all remaining arguments
+ // are considered positional
+ if err = s.addArgs(s.arg); err != nil {
+ break
+ }
+
+ if err = s.addArgs(s.args...); err != nil {
+ break
+ }
+
+ break
+ }
+
// Note: this also sets s.err, so we can just check for
// nil here and use s.err later
if p.parseNonOption(s) != nil {
@@ -256,8 +275,6 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
continue
}
- var err error
-
prefix, optname, islong := stripOptionPrefix(arg)
optname, _, argument := splitOption(prefix, optname, islong)
@@ -293,11 +310,13 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
if s.err == nil {
p.eachOption(func(c *Command, g *Group, option *Option) {
- if option.preventDefault {
- return
+ err := option.clearDefault()
+ if err != nil {
+ if _, ok := err.(*Error); !ok {
+ err = p.marshalError(option, err)
+ }
+ s.err = err
}
-
- option.clearDefault()
})
s.checkRequired(p)
@@ -515,8 +534,8 @@ func (p *Parser) parseOption(s *parseState, name string, option *Option, canarg
} else {
arg = s.pop()
- if argumentIsOption(arg) && !(option.isSignedNumber() && len(arg) > 1 && arg[0] == '-' && arg[1] >= '0' && arg[1] <= '9') {
- return newErrorf(ErrExpectedArgument, "expected argument for flag `%s', but got option `%s'", option, arg)
+ if validationErr := option.isValidValue(arg); validationErr != nil {
+ return newErrorf(ErrExpectedArgument, validationErr.Error())
} else if p.Options&PassDoubleDash != 0 && arg == "--" {
return newErrorf(ErrExpectedArgument, "expected argument for flag `%s', but got double dash `--'", option)
}
@@ -545,16 +564,37 @@ func (p *Parser) parseOption(s *parseState, name string, option *Option, canarg
if err != nil {
if _, ok := err.(*Error); !ok {
- err = newErrorf(ErrMarshal, "invalid argument for flag `%s' (expected %s): %s",
- option,
- option.value.Type(),
- err.Error())
+ err = p.marshalError(option, err)
}
}
return err
}
+func (p *Parser) marshalError(option *Option, err error) *Error {
+ s := "invalid argument for flag `%s'"
+
+ expected := p.expectedType(option)
+
+ if expected != "" {
+ s = s + " (expected " + expected + ")"
+ }
+
+ return newErrorf(ErrMarshal, s+": %s",
+ option,
+ err.Error())
+}
+
+func (p *Parser) expectedType(option *Option) string {
+ valueType := option.value.Type()
+
+ if valueType.Kind() == reflect.Func {
+ return ""
+ }
+
+ return valueType.String()
+}
+
func (p *Parser) parseLong(s *parseState, name string, argument *string) error {
if option := s.lookup.longNames[name]; option != nil {
// Only long options that are required can consume an argument
@@ -649,23 +689,7 @@ func (p *Parser) parseNonOption(s *parseState) error {
}
}
- if (p.Options & PassAfterNonOption) != None {
- // If PassAfterNonOption is set then all remaining arguments
- // are considered positional
- if err := s.addArgs(s.arg); err != nil {
- return err
- }
-
- if err := s.addArgs(s.args...); err != nil {
- return err
- }
-
- s.args = []string{}
- } else {
- return s.addArgs(s.arg)
- }
-
- return nil
+ return s.addArgs(s.arg)
}
func (p *Parser) showBuiltinHelp() error {
@@ -688,13 +712,3 @@ func (p *Parser) printError(err error) error {
return err
}
-
-func (p *Parser) clearIsSet() {
- p.eachCommand(func(c *Command) {
- c.eachGroup(func(g *Group) {
- for _, option := range g.options {
- option.isSet = false
- }
- })
- }, true)
-}
diff --git a/vendor/github.com/jessevdk/go-flags/termsize.go b/vendor/github.com/jessevdk/go-flags/termsize.go
index 1ca6a8503..829e477ad 100644
--- a/vendor/github.com/jessevdk/go-flags/termsize.go
+++ b/vendor/github.com/jessevdk/go-flags/termsize.go
@@ -1,28 +1,15 @@
-// +build !windows,!plan9,!solaris,!appengine
+// +build !windows,!plan9,!appengine,!wasm
package flags
import (
- "syscall"
- "unsafe"
+ "golang.org/x/sys/unix"
)
-type winsize struct {
- row, col uint16
- xpixel, ypixel uint16
-}
-
func getTerminalColumns() int {
- ws := winsize{}
-
- if tIOCGWINSZ != 0 {
- syscall.Syscall(syscall.SYS_IOCTL,
- uintptr(0),
- uintptr(tIOCGWINSZ),
- uintptr(unsafe.Pointer(&ws)))
-
- return int(ws.col)
+ ws, err := unix.IoctlGetWinsize(0, unix.TIOCGWINSZ)
+ if err != nil {
+ return 80
}
-
- return 80
+ return int(ws.Col)
}
diff --git a/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go b/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go
index 3d5385b0b..c1ff18673 100644
--- a/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go
+++ b/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go
@@ -1,4 +1,4 @@
-// +build windows plan9 solaris appengine
+// +build plan9 appengine wasm
package flags
diff --git a/vendor/github.com/jessevdk/go-flags/termsize_windows.go b/vendor/github.com/jessevdk/go-flags/termsize_windows.go
new file mode 100644
index 000000000..5c0fa6ba2
--- /dev/null
+++ b/vendor/github.com/jessevdk/go-flags/termsize_windows.go
@@ -0,0 +1,85 @@
+// +build windows
+
+package flags
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+type (
+ SHORT int16
+ WORD uint16
+
+ SMALL_RECT struct {
+ Left SHORT
+ Top SHORT
+ Right SHORT
+ Bottom SHORT
+ }
+
+ COORD struct {
+ X SHORT
+ Y SHORT
+ }
+
+ CONSOLE_SCREEN_BUFFER_INFO struct {
+ Size COORD
+ CursorPosition COORD
+ Attributes WORD
+ Window SMALL_RECT
+ MaximumWindowSize COORD
+ }
+)
+
+var kernel32DLL = syscall.NewLazyDLL("kernel32.dll")
+var getConsoleScreenBufferInfoProc = kernel32DLL.NewProc("GetConsoleScreenBufferInfo")
+
+func getError(r1, r2 uintptr, lastErr error) error {
+ // If the function fails, the return value is zero.
+ if r1 == 0 {
+ if lastErr != nil {
+ return lastErr
+ }
+ return syscall.EINVAL
+ }
+ return nil
+}
+
+func getStdHandle(stdhandle int) (uintptr, error) {
+ handle, err := syscall.GetStdHandle(stdhandle)
+ if err != nil {
+ return 0, err
+ }
+ return uintptr(handle), nil
+}
+
+// GetConsoleScreenBufferInfo retrieves information about the specified console screen buffer.
+// http://msdn.microsoft.com/en-us/library/windows/desktop/ms683171(v=vs.85).aspx
+func GetConsoleScreenBufferInfo(handle uintptr) (*CONSOLE_SCREEN_BUFFER_INFO, error) {
+ var info CONSOLE_SCREEN_BUFFER_INFO
+ if err := getError(getConsoleScreenBufferInfoProc.Call(handle, uintptr(unsafe.Pointer(&info)), 0)); err != nil {
+ return nil, err
+ }
+ return &info, nil
+}
+
+func getTerminalColumns() int {
+ defaultWidth := 80
+
+ stdoutHandle, err := getStdHandle(syscall.STD_OUTPUT_HANDLE)
+ if err != nil {
+ return defaultWidth
+ }
+
+ info, err := GetConsoleScreenBufferInfo(stdoutHandle)
+ if err != nil {
+ return defaultWidth
+ }
+
+ if info.MaximumWindowSize.X > 0 {
+ return int(info.MaximumWindowSize.X)
+ }
+
+ return defaultWidth
+}
diff --git a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_bsdish.go b/vendor/github.com/jessevdk/go-flags/tiocgwinsz_bsdish.go
deleted file mode 100644
index fcc118601..000000000
--- a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_bsdish.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build darwin freebsd netbsd openbsd
-
-package flags
-
-const (
- tIOCGWINSZ = 0x40087468
-)
diff --git a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_linux.go b/vendor/github.com/jessevdk/go-flags/tiocgwinsz_linux.go
deleted file mode 100644
index e3975e283..000000000
--- a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_linux.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build linux
-
-package flags
-
-const (
- tIOCGWINSZ = 0x5413
-)
diff --git a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_other.go b/vendor/github.com/jessevdk/go-flags/tiocgwinsz_other.go
deleted file mode 100644
index 308215155..000000000
--- a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_other.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build !darwin,!freebsd,!netbsd,!openbsd,!linux
-
-package flags
-
-const (
- tIOCGWINSZ = 0
-)
diff --git a/vendor/github.com/kevinburke/ssh_config/.travis.yml b/vendor/github.com/kevinburke/ssh_config/.travis.yml
deleted file mode 100644
index 3475d143a..000000000
--- a/vendor/github.com/kevinburke/ssh_config/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-arch:
- - amd64
- - ppc64le
-
-go_import_path: github.com/kevinburke/ssh_config
-
-language: go
-dist: bionic
-
-go:
- - 1.13.x
- - 1.14.x
- - 1.15.x
- - master
-
-before_script:
- - go get -u ./...
-
-script:
- - make race-test
diff --git a/vendor/github.com/kevinburke/ssh_config/README.md b/vendor/github.com/kevinburke/ssh_config/README.md
index 52cc1eac4..d1adfed7c 100644
--- a/vendor/github.com/kevinburke/ssh_config/README.md
+++ b/vendor/github.com/kevinburke/ssh_config/README.md
@@ -17,6 +17,14 @@ want to retrieve.
port := ssh_config.Get("myhost", "Port")
```
+Certain directives can occur multiple times for a host (such as `IdentityFile`),
+so you should use the `GetAll` or `GetAllStrict` directive to retrieve those
+instead.
+
+```go
+files := ssh_config.GetAll("myhost", "IdentityFile")
+```
+
You can also load a config file and read values from it.
```go
diff --git a/vendor/github.com/kevinburke/ssh_config/config.go b/vendor/github.com/kevinburke/ssh_config/config.go
index 136f0c35c..7c2c8b679 100644
--- a/vendor/github.com/kevinburke/ssh_config/config.go
+++ b/vendor/github.com/kevinburke/ssh_config/config.go
@@ -102,6 +102,13 @@ func findVal(c *Config, alias, key string) (string, error) {
return val, nil
}
+func findAll(c *Config, alias, key string) ([]string, error) {
+ if c == nil {
+ return nil, nil
+ }
+ return c.GetAll(alias, key)
+}
+
// Get finds the first value for key within a declaration that matches the
// alias. Get returns the empty string if no value was found, or if IgnoreErrors
// is false and we could not parse the configuration file. Use GetStrict to
@@ -114,19 +121,51 @@ func Get(alias, key string) string {
return DefaultUserSettings.Get(alias, key)
}
+// GetAll retrieves zero or more directives for key for the given alias. GetAll
+// returns nil if no value was found, or if IgnoreErrors is false and we could
+// not parse the configuration file. Use GetAllStrict to disambiguate the
+// latter cases.
+//
+// In most cases you want to use Get or GetStrict, which returns a single value.
+// However, a subset of ssh configuration values (IdentityFile, for example)
+// allow you to specify multiple directives.
+//
+// The match for key is case insensitive.
+//
+// GetAll is a wrapper around DefaultUserSettings.GetAll.
+func GetAll(alias, key string) []string {
+ return DefaultUserSettings.GetAll(alias, key)
+}
+
// GetStrict finds the first value for key within a declaration that matches the
// alias. If key has a default value and no matching configuration is found, the
// default will be returned. For more information on default values and the way
// patterns are matched, see the manpage for ssh_config.
//
-// error will be non-nil if and only if a user's configuration file or the
-// system configuration file could not be parsed, and u.IgnoreErrors is false.
+// The returned error will be non-nil if and only if a user's configuration file
+// or the system configuration file could not be parsed, and u.IgnoreErrors is
+// false.
//
// GetStrict is a wrapper around DefaultUserSettings.GetStrict.
func GetStrict(alias, key string) (string, error) {
return DefaultUserSettings.GetStrict(alias, key)
}
+// GetAllStrict retrieves zero or more directives for key for the given alias.
+//
+// In most cases you want to use Get or GetStrict, which returns a single value.
+// However, a subset of ssh configuration values (IdentityFile, for example)
+// allow you to specify multiple directives.
+//
+// The returned error will be non-nil if and only if a user's configuration file
+// or the system configuration file could not be parsed, and u.IgnoreErrors is
+// false.
+//
+// GetAllStrict is a wrapper around DefaultUserSettings.GetAllStrict.
+func GetAllStrict(alias, key string) ([]string, error) {
+ return DefaultUserSettings.GetAllStrict(alias, key)
+}
+
// Get finds the first value for key within a declaration that matches the
// alias. Get returns the empty string if no value was found, or if IgnoreErrors
// is false and we could not parse the configuration file. Use GetStrict to
@@ -141,6 +180,17 @@ func (u *UserSettings) Get(alias, key string) string {
return val
}
+// GetAll retrieves zero or more directives for key for the given alias. GetAll
+// returns nil if no value was found, or if IgnoreErrors is false and we could
+// not parse the configuration file. Use GetStrict to disambiguate the latter
+// cases.
+//
+// The match for key is case insensitive.
+func (u *UserSettings) GetAll(alias, key string) []string {
+ val, _ := u.GetAllStrict(alias, key)
+ return val
+}
+
// GetStrict finds the first value for key within a declaration that matches the
// alias. If key has a default value and no matching configuration is found, the
// default will be returned. For more information on default values and the way
@@ -149,6 +199,52 @@ func (u *UserSettings) Get(alias, key string) string {
// error will be non-nil if and only if a user's configuration file or the
// system configuration file could not be parsed, and u.IgnoreErrors is false.
func (u *UserSettings) GetStrict(alias, key string) (string, error) {
+ u.doLoadConfigs()
+ //lint:ignore S1002 I prefer it this way
+ if u.onceErr != nil && u.IgnoreErrors == false {
+ return "", u.onceErr
+ }
+ val, err := findVal(u.userConfig, alias, key)
+ if err != nil || val != "" {
+ return val, err
+ }
+ val2, err2 := findVal(u.systemConfig, alias, key)
+ if err2 != nil || val2 != "" {
+ return val2, err2
+ }
+ return Default(key), nil
+}
+
+// GetAllStrict retrieves zero or more directives for key for the given alias.
+// If key has a default value and no matching configuration is found, the
+// default will be returned. For more information on default values and the way
+// patterns are matched, see the manpage for ssh_config.
+//
+// The returned error will be non-nil if and only if a user's configuration file
+// or the system configuration file could not be parsed, and u.IgnoreErrors is
+// false.
+func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) {
+ u.doLoadConfigs()
+ //lint:ignore S1002 I prefer it this way
+ if u.onceErr != nil && u.IgnoreErrors == false {
+ return nil, u.onceErr
+ }
+ val, err := findAll(u.userConfig, alias, key)
+ if err != nil || val != nil {
+ return val, err
+ }
+ val2, err2 := findAll(u.systemConfig, alias, key)
+ if err2 != nil || val2 != nil {
+ return val2, err2
+ }
+ // TODO: IdentityFile has multiple default values that we should return.
+ if def := Default(key); def != "" {
+ return []string{def}, nil
+ }
+ return []string{}, nil
+}
+
+func (u *UserSettings) doLoadConfigs() {
u.loadConfigs.Do(func() {
// can't parse user file, that's ok.
var filename string
@@ -176,19 +272,6 @@ func (u *UserSettings) GetStrict(alias, key string) (string, error) {
return
}
})
- //lint:ignore S1002 I prefer it this way
- if u.onceErr != nil && u.IgnoreErrors == false {
- return "", u.onceErr
- }
- val, err := findVal(u.userConfig, alias, key)
- if err != nil || val != "" {
- return val, err
- }
- val2, err2 := findVal(u.systemConfig, alias, key)
- if err2 != nil || val2 != "" {
- return val2, err2
- }
- return Default(key), nil
}
func parseFile(filename string) (*Config, error) {
@@ -282,6 +365,42 @@ func (c *Config) Get(alias, key string) (string, error) {
return "", nil
}
+// GetAll returns all values in the configuration that match the alias and
+// contains key, or nil if none are present.
+func (c *Config) GetAll(alias, key string) ([]string, error) {
+ lowerKey := strings.ToLower(key)
+ all := []string(nil)
+ for _, host := range c.Hosts {
+ if !host.Matches(alias) {
+ continue
+ }
+ for _, node := range host.Nodes {
+ switch t := node.(type) {
+ case *Empty:
+ continue
+ case *KV:
+ // "keys are case insensitive" per the spec
+ lkey := strings.ToLower(t.Key)
+ if lkey == "match" {
+ panic("can't handle Match directives")
+ }
+ if lkey == lowerKey {
+ all = append(all, t.Value)
+ }
+ case *Include:
+ val, _ := t.GetAll(alias, key)
+ if len(val) > 0 {
+ all = append(all, val...)
+ }
+ default:
+ return nil, fmt.Errorf("unknown Node type %v", t)
+ }
+ }
+ }
+
+ return all, nil
+}
+
// String returns a string representation of the Config file.
func (c Config) String() string {
return marshal(c).String()
@@ -611,6 +730,31 @@ func (inc *Include) Get(alias, key string) string {
return ""
}
+// GetAll finds all values in the Include statement matching the alias and the
+// given key.
+func (inc *Include) GetAll(alias, key string) ([]string, error) {
+ inc.mu.Lock()
+ defer inc.mu.Unlock()
+ var vals []string
+
+ // TODO: we search files in any order which is not correct
+ for i := range inc.matches {
+ cfg := inc.files[inc.matches[i]]
+ if cfg == nil {
+ panic("nil cfg")
+ }
+ val, err := cfg.GetAll(alias, key)
+ if err == nil && len(val) != 0 {
+ // In theory if SupportsMultiple was false for this key we could
+ // stop looking here. But the caller has asked us to find all
+ // instances of the keyword (and could use Get() if they wanted) so
+ // let's keep looking.
+ vals = append(vals, val...)
+ }
+ }
+ return vals, nil
+}
+
// String prints out a string representation of this Include directive. Note
// included Config files are not printed as part of this representation.
func (inc *Include) String() string {
diff --git a/vendor/github.com/kevinburke/ssh_config/validators.go b/vendor/github.com/kevinburke/ssh_config/validators.go
index 29fab6a9d..5977f9096 100644
--- a/vendor/github.com/kevinburke/ssh_config/validators.go
+++ b/vendor/github.com/kevinburke/ssh_config/validators.go
@@ -160,3 +160,27 @@ var defaults = map[string]string{
strings.ToLower("VisualHostKey"): "no",
strings.ToLower("XAuthLocation"): "/usr/X11R6/bin/xauth",
}
+
+// these identities are used for SSH protocol 2
+var defaultProtocol2Identities = []string{
+ "~/.ssh/id_dsa",
+ "~/.ssh/id_ecdsa",
+ "~/.ssh/id_ed25519",
+ "~/.ssh/id_rsa",
+}
+
+// these directives support multiple items that can be collected
+// across multiple files
+var pluralDirectives = map[string]bool{
+ "CertificateFile": true,
+ "IdentityFile": true,
+ "DynamicForward": true,
+ "RemoteForward": true,
+ "SendEnv": true,
+ "SetEnv": true,
+}
+
+// SupportsMultiple reports whether a directive can be specified multiple times.
+func SupportsMultiple(key string) bool {
+ return pluralDirectives[strings.ToLower(key)]
+}
diff --git a/vendor/github.com/klauspost/compress/flate/deflate.go b/vendor/github.com/klauspost/compress/flate/deflate.go
index 25dbe3e15..40b5802de 100644
--- a/vendor/github.com/klauspost/compress/flate/deflate.go
+++ b/vendor/github.com/klauspost/compress/flate/deflate.go
@@ -440,8 +440,7 @@ func (d *compressor) deflateLazy() {
// index and index-1 are already inserted. If there is not enough
// lookahead, the last two strings are not inserted into the hash
// table.
- var newIndex int
- newIndex = s.index + prevLength - 1
+ newIndex := s.index + prevLength - 1
// Calculate missing hashes
end := newIndex
if end > s.maxInsertIndex {
@@ -645,15 +644,15 @@ func (d *compressor) init(w io.Writer, level int) (err error) {
d.fill = (*compressor).fillBlock
d.step = (*compressor).store
case level == ConstantCompression:
- d.w.logNewTablePenalty = 4
- d.window = make([]byte, maxStoreBlockSize)
+ d.w.logNewTablePenalty = 8
+ d.window = make([]byte, 32<<10)
d.fill = (*compressor).fillBlock
d.step = (*compressor).storeHuff
case level == DefaultCompression:
level = 5
fallthrough
case level >= 1 && level <= 6:
- d.w.logNewTablePenalty = 6
+ d.w.logNewTablePenalty = 8
d.fast = newFastEnc(level)
d.window = make([]byte, maxStoreBlockSize)
d.fill = (*compressor).fillBlock
diff --git a/vendor/github.com/klauspost/compress/flate/fast_encoder.go b/vendor/github.com/klauspost/compress/flate/fast_encoder.go
index 4a73e1bdd..678f08105 100644
--- a/vendor/github.com/klauspost/compress/flate/fast_encoder.go
+++ b/vendor/github.com/klauspost/compress/flate/fast_encoder.go
@@ -6,6 +6,7 @@
package flate
import (
+ "encoding/binary"
"fmt"
"math/bits"
)
@@ -65,26 +66,15 @@ func load32(b []byte, i int) uint32 {
}
func load64(b []byte, i int) uint64 {
- // Help the compiler eliminate bounds checks on the read so it can be done in a single read.
- b = b[i:]
- b = b[:8]
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
+ return binary.LittleEndian.Uint64(b[i:])
}
func load3232(b []byte, i int32) uint32 {
- // Help the compiler eliminate bounds checks on the read so it can be done in a single read.
- b = b[i:]
- b = b[:4]
- return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
+ return binary.LittleEndian.Uint32(b[i:])
}
func load6432(b []byte, i int32) uint64 {
- // Help the compiler eliminate bounds checks on the read so it can be done in a single read.
- b = b[i:]
- b = b[:8]
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
+ return binary.LittleEndian.Uint64(b[i:])
}
func hash(u uint32) uint32 {
@@ -225,9 +215,9 @@ func (e *fastGen) Reset() {
func matchLen(a, b []byte) int {
b = b[:len(a)]
var checked int
- if len(a) > 4 {
+ if len(a) >= 4 {
// Try 4 bytes first
- if diff := load32(a, 0) ^ load32(b, 0); diff != 0 {
+ if diff := binary.LittleEndian.Uint32(a) ^ binary.LittleEndian.Uint32(b); diff != 0 {
return bits.TrailingZeros32(diff) >> 3
}
// Switch to 8 byte matching.
@@ -236,7 +226,7 @@ func matchLen(a, b []byte) int {
b = b[4:]
for len(a) >= 8 {
b = b[:len(a)]
- if diff := load64(a, 0) ^ load64(b, 0); diff != 0 {
+ if diff := binary.LittleEndian.Uint64(a) ^ binary.LittleEndian.Uint64(b); diff != 0 {
return checked + (bits.TrailingZeros64(diff) >> 3)
}
checked += 8
@@ -247,7 +237,7 @@ func matchLen(a, b []byte) int {
b = b[:len(a)]
for i := range a {
if a[i] != b[i] {
- return int(i) + checked
+ return i + checked
}
}
return len(a) + checked
diff --git a/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go b/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go
index 208d66711..db54be139 100644
--- a/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go
+++ b/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go
@@ -5,6 +5,7 @@
package flate
import (
+ "encoding/binary"
"io"
)
@@ -206,7 +207,7 @@ func (w *huffmanBitWriter) write(b []byte) {
}
func (w *huffmanBitWriter) writeBits(b int32, nb uint16) {
- w.bits |= uint64(b) << (w.nbits & reg16SizeMask64)
+ w.bits |= uint64(b) << w.nbits
w.nbits += nb
if w.nbits >= 48 {
w.writeOutBits()
@@ -420,13 +421,11 @@ func (w *huffmanBitWriter) writeOutBits() {
w.bits >>= 48
w.nbits -= 48
n := w.nbytes
- w.bytes[n] = byte(bits)
- w.bytes[n+1] = byte(bits >> 8)
- w.bytes[n+2] = byte(bits >> 16)
- w.bytes[n+3] = byte(bits >> 24)
- w.bytes[n+4] = byte(bits >> 32)
- w.bytes[n+5] = byte(bits >> 40)
+
+ // We over-write, but faster...
+ binary.LittleEndian.PutUint64(w.bytes[n:], bits)
n += 6
+
if n >= bufferFlushSize {
if w.err != nil {
n = 0
@@ -435,6 +434,7 @@ func (w *huffmanBitWriter) writeOutBits() {
w.write(w.bytes[:n])
n = 0
}
+
w.nbytes = n
}
@@ -759,7 +759,7 @@ func (w *huffmanBitWriter) writeTokens(tokens []token, leCodes, oeCodes []hcode)
} else {
// inlined
c := lengths[lengthCode&31]
- w.bits |= uint64(c.code) << (w.nbits & reg16SizeMask64)
+ w.bits |= uint64(c.code) << w.nbits
w.nbits += c.len
if w.nbits >= 48 {
w.writeOutBits()
@@ -779,7 +779,7 @@ func (w *huffmanBitWriter) writeTokens(tokens []token, leCodes, oeCodes []hcode)
} else {
// inlined
c := offs[offsetCode&31]
- w.bits |= uint64(c.code) << (w.nbits & reg16SizeMask64)
+ w.bits |= uint64(c.code) << w.nbits
w.nbits += c.len
if w.nbits >= 48 {
w.writeOutBits()
@@ -830,8 +830,8 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
// Assume header is around 70 bytes:
// https://stackoverflow.com/a/25454430
const guessHeaderSizeBits = 70 * 8
- estBits, estExtra := histogramSize(input, w.literalFreq[:], !eof && !sync)
- estBits += w.lastHeader + 15
+ estBits := histogramSize(input, w.literalFreq[:], !eof && !sync)
+ estBits += w.lastHeader + len(input)/32
if w.lastHeader == 0 {
estBits += guessHeaderSizeBits
}
@@ -845,9 +845,9 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
return
}
+ reuseSize := 0
if w.lastHeader > 0 {
- reuseSize := w.literalEncoding.bitLength(w.literalFreq[:256])
- estBits += estExtra
+ reuseSize = w.literalEncoding.bitLength(w.literalFreq[:256])
if estBits < reuseSize {
// We owe an EOB
@@ -859,6 +859,10 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
const numLiterals = endBlockMarker + 1
const numOffsets = 1
if w.lastHeader == 0 {
+ if !eof && !sync {
+ // Generate a slightly suboptimal tree that can be used for all.
+ fillHist(w.literalFreq[:numLiterals])
+ }
w.literalFreq[endBlockMarker] = 1
w.literalEncoding.generate(w.literalFreq[:numLiterals], 15)
@@ -878,19 +882,14 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
for _, t := range input {
// Bitwriting inlined, ~30% speedup
c := encoding[t]
- w.bits |= uint64(c.code) << ((w.nbits) & reg16SizeMask64)
+ w.bits |= uint64(c.code) << w.nbits
w.nbits += c.len
if w.nbits >= 48 {
bits := w.bits
w.bits >>= 48
w.nbits -= 48
n := w.nbytes
- w.bytes[n] = byte(bits)
- w.bytes[n+1] = byte(bits >> 8)
- w.bytes[n+2] = byte(bits >> 16)
- w.bytes[n+3] = byte(bits >> 24)
- w.bytes[n+4] = byte(bits >> 32)
- w.bytes[n+5] = byte(bits >> 40)
+ binary.LittleEndian.PutUint64(w.bytes[n:], bits)
n += 6
if n >= bufferFlushSize {
if w.err != nil {
diff --git a/vendor/github.com/klauspost/compress/flate/huffman_code.go b/vendor/github.com/klauspost/compress/flate/huffman_code.go
index 4c39a3018..0d3445a1c 100644
--- a/vendor/github.com/klauspost/compress/flate/huffman_code.go
+++ b/vendor/github.com/klauspost/compress/flate/huffman_code.go
@@ -122,6 +122,16 @@ func (h *huffmanEncoder) bitLength(freq []uint16) int {
return total
}
+func (h *huffmanEncoder) bitLengthRaw(b []byte) int {
+ var total int
+ for _, f := range b {
+ if f != 0 {
+ total += int(h.codes[f].len)
+ }
+ }
+ return total
+}
+
// Return the number of literals assigned to each bit size in the Huffman encoding
//
// This method is only called when list.length >= 3
@@ -327,37 +337,40 @@ func atLeastOne(v float32) float32 {
return v
}
+// Unassigned values are assigned '1' in the histogram.
+func fillHist(b []uint16) {
+ for i, v := range b {
+ if v == 0 {
+ b[i] = 1
+ }
+ }
+}
+
// histogramSize accumulates a histogram of b in h.
// An estimated size in bits is returned.
-// Unassigned values are assigned '1' in the histogram.
// len(h) must be >= 256, and h's elements must be all zeroes.
-func histogramSize(b []byte, h []uint16, fill bool) (int, int) {
+func histogramSize(b []byte, h []uint16, fill bool) (bits int) {
h = h[:256]
for _, t := range b {
h[t]++
}
- invTotal := 1.0 / float32(len(b))
- shannon := float32(0.0)
- var extra float32
+ total := len(b)
if fill {
- oneBits := atLeastOne(-mFastLog2(invTotal))
- for i, v := range h[:] {
- if v > 0 {
- n := float32(v)
- shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
- } else {
- h[i] = 1
- extra += oneBits
- }
- }
- } else {
- for _, v := range h[:] {
- if v > 0 {
- n := float32(v)
- shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
+ for _, v := range h {
+ if v == 0 {
+ total++
}
}
}
- return int(shannon + 0.99), int(extra + 0.99)
+ invTotal := 1.0 / float32(total)
+ shannon := float32(0.0)
+ for _, v := range h {
+ if v > 0 {
+ n := float32(v)
+ shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
+ }
+ }
+
+ return int(shannon + 0.99)
}
diff --git a/vendor/github.com/klauspost/compress/flate/level2.go b/vendor/github.com/klauspost/compress/flate/level2.go
index 5b986a194..234c4389a 100644
--- a/vendor/github.com/klauspost/compress/flate/level2.go
+++ b/vendor/github.com/klauspost/compress/flate/level2.go
@@ -155,7 +155,7 @@ func (e *fastEncL2) Encode(dst *tokens, src []byte) {
// Store every second hash in-between, but offset by 1.
for i := s - l + 2; i < s-5; i += 7 {
- x := load6432(src, int32(i))
+ x := load6432(src, i)
nextHash := hash4u(uint32(x), bTableBits)
e.table[nextHash] = tableEntry{offset: e.cur + i}
// Skip one
diff --git a/vendor/github.com/klauspost/compress/fse/compress.go b/vendor/github.com/klauspost/compress/fse/compress.go
index b69237c9b..6f341914c 100644
--- a/vendor/github.com/klauspost/compress/fse/compress.go
+++ b/vendor/github.com/klauspost/compress/fse/compress.go
@@ -92,7 +92,6 @@ func (c *cState) init(bw *bitWriter, ct *cTable, tableLog uint8, first symbolTra
im := int32((nbBitsOut << 16) - first.deltaNbBits)
lu := (im >> nbBitsOut) + first.deltaFindState
c.state = c.stateTable[lu]
- return
}
// encode the output symbol provided and write it to the bitstream.
@@ -301,7 +300,7 @@ func (s *Scratch) writeCount() error {
out[outP+1] = byte(bitStream >> 8)
outP += (bitCount + 7) / 8
- if uint16(charnum) > s.symbolLen {
+ if charnum > s.symbolLen {
return errors.New("internal error: charnum > s.symbolLen")
}
s.Out = out[:outP]
@@ -331,7 +330,7 @@ type cTable struct {
func (s *Scratch) allocCtable() {
tableSize := 1 << s.actualTableLog
// get tableSymbol that is big enough.
- if cap(s.ct.tableSymbol) < int(tableSize) {
+ if cap(s.ct.tableSymbol) < tableSize {
s.ct.tableSymbol = make([]byte, tableSize)
}
s.ct.tableSymbol = s.ct.tableSymbol[:tableSize]
@@ -565,8 +564,8 @@ func (s *Scratch) normalizeCount2() error {
distributed uint32
total = uint32(s.br.remain())
tableLog = s.actualTableLog
- lowThreshold = uint32(total >> tableLog)
- lowOne = uint32((total * 3) >> (tableLog + 1))
+ lowThreshold = total >> tableLog
+ lowOne = (total * 3) >> (tableLog + 1)
)
for i, cnt := range s.count[:s.symbolLen] {
if cnt == 0 {
@@ -591,7 +590,7 @@ func (s *Scratch) normalizeCount2() error {
if (total / toDistribute) > lowOne {
// risk of rounding to zero
- lowOne = uint32((total * 3) / (toDistribute * 2))
+ lowOne = (total * 3) / (toDistribute * 2)
for i, cnt := range s.count[:s.symbolLen] {
if (s.norm[i] == notYetAssigned) && (cnt <= lowOne) {
s.norm[i] = 1
diff --git a/vendor/github.com/klauspost/compress/fse/decompress.go b/vendor/github.com/klauspost/compress/fse/decompress.go
index 413ec3b3c..926f5f153 100644
--- a/vendor/github.com/klauspost/compress/fse/decompress.go
+++ b/vendor/github.com/klauspost/compress/fse/decompress.go
@@ -172,7 +172,7 @@ type decSymbol struct {
// allocDtable will allocate decoding tables if they are not big enough.
func (s *Scratch) allocDtable() {
tableSize := 1 << s.actualTableLog
- if cap(s.decTable) < int(tableSize) {
+ if cap(s.decTable) < tableSize {
s.decTable = make([]decSymbol, tableSize)
}
s.decTable = s.decTable[:tableSize]
@@ -340,7 +340,7 @@ type decoder struct {
func (d *decoder) init(in *bitReader, dt []decSymbol, tableLog uint8) {
d.dt = dt
d.br = in
- d.state = uint16(in.getBits(tableLog))
+ d.state = in.getBits(tableLog)
}
// next returns the next symbol and sets the next state.
diff --git a/vendor/github.com/klauspost/compress/huff0/compress.go b/vendor/github.com/klauspost/compress/huff0/compress.go
index f9ed5f830..0823c928c 100644
--- a/vendor/github.com/klauspost/compress/huff0/compress.go
+++ b/vendor/github.com/klauspost/compress/huff0/compress.go
@@ -403,7 +403,7 @@ func (s *Scratch) buildCTable() error {
var startNode = int16(s.symbolLen)
nonNullRank := s.symbolLen - 1
- nodeNb := int16(startNode)
+ nodeNb := startNode
huffNode := s.nodes[1 : huffNodesLen+1]
// This overlays the slice above, but allows "-1" index lookups.
@@ -536,7 +536,6 @@ func (s *Scratch) huffSort() {
}
nodes[pos&huffNodesMask] = nodeElt{count: c, symbol: byte(n)}
}
- return
}
func (s *Scratch) setMaxHeight(lastNonNull int) uint8 {
@@ -580,7 +579,7 @@ func (s *Scratch) setMaxHeight(lastNonNull int) uint8 {
// Get pos of last (smallest) symbol per rank
{
- currentNbBits := uint8(maxNbBits)
+ currentNbBits := maxNbBits
for pos := int(n); pos >= 0; pos-- {
if huffNode[pos].nbBits >= currentNbBits {
continue
diff --git a/vendor/github.com/klauspost/compress/snappy/.gitignore b/vendor/github.com/klauspost/compress/snappy/.gitignore
deleted file mode 100644
index 042091d9b..000000000
--- a/vendor/github.com/klauspost/compress/snappy/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-cmd/snappytool/snappytool
-testdata/bench
-
-# These explicitly listed benchmark data files are for an obsolete version of
-# snappy_test.go.
-testdata/alice29.txt
-testdata/asyoulik.txt
-testdata/fireworks.jpeg
-testdata/geo.protodata
-testdata/html
-testdata/html_x_4
-testdata/kppkn.gtb
-testdata/lcet10.txt
-testdata/paper-100k.pdf
-testdata/plrabn12.txt
-testdata/urls.10K
diff --git a/vendor/github.com/klauspost/compress/snappy/AUTHORS b/vendor/github.com/klauspost/compress/snappy/AUTHORS
deleted file mode 100644
index bcfa19520..000000000
--- a/vendor/github.com/klauspost/compress/snappy/AUTHORS
+++ /dev/null
@@ -1,15 +0,0 @@
-# This is the official list of Snappy-Go authors for copyright purposes.
-# This file is distinct from the CONTRIBUTORS files.
-# See the latter for an explanation.
-
-# Names should be added to this file as
-# Name or Organization
-# The email address is not required for organizations.
-
-# Please keep the list sorted.
-
-Damian Gryski
-Google Inc.
-Jan Mercl <0xjnml@gmail.com>
-Rodolfo Carvalho
-Sebastien Binet
diff --git a/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS b/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS
deleted file mode 100644
index 931ae3160..000000000
--- a/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS
+++ /dev/null
@@ -1,37 +0,0 @@
-# This is the official list of people who can contribute
-# (and typically have contributed) code to the Snappy-Go repository.
-# The AUTHORS file lists the copyright holders; this file
-# lists people. For example, Google employees are listed here
-# but not in AUTHORS, because Google holds the copyright.
-#
-# The submission process automatically checks to make sure
-# that people submitting code are listed in this file (by email address).
-#
-# Names should be added to this file only after verifying that
-# the individual or the individual's organization has agreed to
-# the appropriate Contributor License Agreement, found here:
-#
-# http://code.google.com/legal/individual-cla-v1.0.html
-# http://code.google.com/legal/corporate-cla-v1.0.html
-#
-# The agreement for individuals can be filled out on the web.
-#
-# When adding J Random Contributor's name to this file,
-# either J's name or J's organization's name should be
-# added to the AUTHORS file, depending on whether the
-# individual or corporate CLA was used.
-
-# Names should be added to this file like so:
-# Name
-
-# Please keep the list sorted.
-
-Damian Gryski
-Jan Mercl <0xjnml@gmail.com>
-Kai Backman
-Marc-Antoine Ruel
-Nigel Tao
-Rob Pike
-Rodolfo Carvalho
-Russ Cox
-Sebastien Binet
diff --git a/vendor/github.com/klauspost/compress/snappy/LICENSE b/vendor/github.com/klauspost/compress/snappy/LICENSE
deleted file mode 100644
index 6050c10f4..000000000
--- a/vendor/github.com/klauspost/compress/snappy/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2011 The Snappy-Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/klauspost/compress/snappy/README b/vendor/github.com/klauspost/compress/snappy/README
deleted file mode 100644
index cea12879a..000000000
--- a/vendor/github.com/klauspost/compress/snappy/README
+++ /dev/null
@@ -1,107 +0,0 @@
-The Snappy compression format in the Go programming language.
-
-To download and install from source:
-$ go get github.com/golang/snappy
-
-Unless otherwise noted, the Snappy-Go source files are distributed
-under the BSD-style license found in the LICENSE file.
-
-
-
-Benchmarks.
-
-The golang/snappy benchmarks include compressing (Z) and decompressing (U) ten
-or so files, the same set used by the C++ Snappy code (github.com/google/snappy
-and note the "google", not "golang"). On an "Intel(R) Core(TM) i7-3770 CPU @
-3.40GHz", Go's GOARCH=amd64 numbers as of 2016-05-29:
-
-"go test -test.bench=."
-
-_UFlat0-8 2.19GB/s ± 0% html
-_UFlat1-8 1.41GB/s ± 0% urls
-_UFlat2-8 23.5GB/s ± 2% jpg
-_UFlat3-8 1.91GB/s ± 0% jpg_200
-_UFlat4-8 14.0GB/s ± 1% pdf
-_UFlat5-8 1.97GB/s ± 0% html4
-_UFlat6-8 814MB/s ± 0% txt1
-_UFlat7-8 785MB/s ± 0% txt2
-_UFlat8-8 857MB/s ± 0% txt3
-_UFlat9-8 719MB/s ± 1% txt4
-_UFlat10-8 2.84GB/s ± 0% pb
-_UFlat11-8 1.05GB/s ± 0% gaviota
-
-_ZFlat0-8 1.04GB/s ± 0% html
-_ZFlat1-8 534MB/s ± 0% urls
-_ZFlat2-8 15.7GB/s ± 1% jpg
-_ZFlat3-8 740MB/s ± 3% jpg_200
-_ZFlat4-8 9.20GB/s ± 1% pdf
-_ZFlat5-8 991MB/s ± 0% html4
-_ZFlat6-8 379MB/s ± 0% txt1
-_ZFlat7-8 352MB/s ± 0% txt2
-_ZFlat8-8 396MB/s ± 1% txt3
-_ZFlat9-8 327MB/s ± 1% txt4
-_ZFlat10-8 1.33GB/s ± 1% pb
-_ZFlat11-8 605MB/s ± 1% gaviota
-
-
-
-"go test -test.bench=. -tags=noasm"
-
-_UFlat0-8 621MB/s ± 2% html
-_UFlat1-8 494MB/s ± 1% urls
-_UFlat2-8 23.2GB/s ± 1% jpg
-_UFlat3-8 1.12GB/s ± 1% jpg_200
-_UFlat4-8 4.35GB/s ± 1% pdf
-_UFlat5-8 609MB/s ± 0% html4
-_UFlat6-8 296MB/s ± 0% txt1
-_UFlat7-8 288MB/s ± 0% txt2
-_UFlat8-8 309MB/s ± 1% txt3
-_UFlat9-8 280MB/s ± 1% txt4
-_UFlat10-8 753MB/s ± 0% pb
-_UFlat11-8 400MB/s ± 0% gaviota
-
-_ZFlat0-8 409MB/s ± 1% html
-_ZFlat1-8 250MB/s ± 1% urls
-_ZFlat2-8 12.3GB/s ± 1% jpg
-_ZFlat3-8 132MB/s ± 0% jpg_200
-_ZFlat4-8 2.92GB/s ± 0% pdf
-_ZFlat5-8 405MB/s ± 1% html4
-_ZFlat6-8 179MB/s ± 1% txt1
-_ZFlat7-8 170MB/s ± 1% txt2
-_ZFlat8-8 189MB/s ± 1% txt3
-_ZFlat9-8 164MB/s ± 1% txt4
-_ZFlat10-8 479MB/s ± 1% pb
-_ZFlat11-8 270MB/s ± 1% gaviota
-
-
-
-For comparison (Go's encoded output is byte-for-byte identical to C++'s), here
-are the numbers from C++ Snappy's
-
-make CXXFLAGS="-O2 -DNDEBUG -g" clean snappy_unittest.log && cat snappy_unittest.log
-
-BM_UFlat/0 2.4GB/s html
-BM_UFlat/1 1.4GB/s urls
-BM_UFlat/2 21.8GB/s jpg
-BM_UFlat/3 1.5GB/s jpg_200
-BM_UFlat/4 13.3GB/s pdf
-BM_UFlat/5 2.1GB/s html4
-BM_UFlat/6 1.0GB/s txt1
-BM_UFlat/7 959.4MB/s txt2
-BM_UFlat/8 1.0GB/s txt3
-BM_UFlat/9 864.5MB/s txt4
-BM_UFlat/10 2.9GB/s pb
-BM_UFlat/11 1.2GB/s gaviota
-
-BM_ZFlat/0 944.3MB/s html (22.31 %)
-BM_ZFlat/1 501.6MB/s urls (47.78 %)
-BM_ZFlat/2 14.3GB/s jpg (99.95 %)
-BM_ZFlat/3 538.3MB/s jpg_200 (73.00 %)
-BM_ZFlat/4 8.3GB/s pdf (83.30 %)
-BM_ZFlat/5 903.5MB/s html4 (22.52 %)
-BM_ZFlat/6 336.0MB/s txt1 (57.88 %)
-BM_ZFlat/7 312.3MB/s txt2 (61.91 %)
-BM_ZFlat/8 353.1MB/s txt3 (54.99 %)
-BM_ZFlat/9 289.9MB/s txt4 (66.26 %)
-BM_ZFlat/10 1.2GB/s pb (19.68 %)
-BM_ZFlat/11 527.4MB/s gaviota (37.72 %)
diff --git a/vendor/github.com/klauspost/compress/snappy/decode.go b/vendor/github.com/klauspost/compress/snappy/decode.go
deleted file mode 100644
index 72efb0353..000000000
--- a/vendor/github.com/klauspost/compress/snappy/decode.go
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package snappy
-
-import (
- "encoding/binary"
- "errors"
- "io"
-)
-
-var (
- // ErrCorrupt reports that the input is invalid.
- ErrCorrupt = errors.New("snappy: corrupt input")
- // ErrTooLarge reports that the uncompressed length is too large.
- ErrTooLarge = errors.New("snappy: decoded block is too large")
- // ErrUnsupported reports that the input isn't supported.
- ErrUnsupported = errors.New("snappy: unsupported input")
-
- errUnsupportedLiteralLength = errors.New("snappy: unsupported literal length")
-)
-
-// DecodedLen returns the length of the decoded block.
-func DecodedLen(src []byte) (int, error) {
- v, _, err := decodedLen(src)
- return v, err
-}
-
-// decodedLen returns the length of the decoded block and the number of bytes
-// that the length header occupied.
-func decodedLen(src []byte) (blockLen, headerLen int, err error) {
- v, n := binary.Uvarint(src)
- if n <= 0 || v > 0xffffffff {
- return 0, 0, ErrCorrupt
- }
-
- const wordSize = 32 << (^uint(0) >> 32 & 1)
- if wordSize == 32 && v > 0x7fffffff {
- return 0, 0, ErrTooLarge
- }
- return int(v), n, nil
-}
-
-const (
- decodeErrCodeCorrupt = 1
- decodeErrCodeUnsupportedLiteralLength = 2
-)
-
-// Decode returns the decoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire decoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-func Decode(dst, src []byte) ([]byte, error) {
- dLen, s, err := decodedLen(src)
- if err != nil {
- return nil, err
- }
- if dLen <= len(dst) {
- dst = dst[:dLen]
- } else {
- dst = make([]byte, dLen)
- }
- switch decode(dst, src[s:]) {
- case 0:
- return dst, nil
- case decodeErrCodeUnsupportedLiteralLength:
- return nil, errUnsupportedLiteralLength
- }
- return nil, ErrCorrupt
-}
-
-// NewReader returns a new Reader that decompresses from r, using the framing
-// format described at
-// https://github.com/google/snappy/blob/master/framing_format.txt
-func NewReader(r io.Reader) *Reader {
- return &Reader{
- r: r,
- decoded: make([]byte, maxBlockSize),
- buf: make([]byte, maxEncodedLenOfMaxBlockSize+checksumSize),
- }
-}
-
-// Reader is an io.Reader that can read Snappy-compressed bytes.
-type Reader struct {
- r io.Reader
- err error
- decoded []byte
- buf []byte
- // decoded[i:j] contains decoded bytes that have not yet been passed on.
- i, j int
- readHeader bool
-}
-
-// Reset discards any buffered data, resets all state, and switches the Snappy
-// reader to read from r. This permits reusing a Reader rather than allocating
-// a new one.
-func (r *Reader) Reset(reader io.Reader) {
- r.r = reader
- r.err = nil
- r.i = 0
- r.j = 0
- r.readHeader = false
-}
-
-func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) {
- if _, r.err = io.ReadFull(r.r, p); r.err != nil {
- if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) {
- r.err = ErrCorrupt
- }
- return false
- }
- return true
-}
-
-// Read satisfies the io.Reader interface.
-func (r *Reader) Read(p []byte) (int, error) {
- if r.err != nil {
- return 0, r.err
- }
- for {
- if r.i < r.j {
- n := copy(p, r.decoded[r.i:r.j])
- r.i += n
- return n, nil
- }
- if !r.readFull(r.buf[:4], true) {
- return 0, r.err
- }
- chunkType := r.buf[0]
- if !r.readHeader {
- if chunkType != chunkTypeStreamIdentifier {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.readHeader = true
- }
- chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16
- if chunkLen > len(r.buf) {
- r.err = ErrUnsupported
- return 0, r.err
- }
-
- // The chunk types are specified at
- // https://github.com/google/snappy/blob/master/framing_format.txt
- switch chunkType {
- case chunkTypeCompressedData:
- // Section 4.2. Compressed data (chunk type 0x00).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- buf := r.buf[:chunkLen]
- if !r.readFull(buf, false) {
- return 0, r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- buf = buf[checksumSize:]
-
- n, err := DecodedLen(buf)
- if err != nil {
- r.err = err
- return 0, r.err
- }
- if n > len(r.decoded) {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if _, err := Decode(r.decoded, buf); err != nil {
- r.err = err
- return 0, r.err
- }
- if crc(r.decoded[:n]) != checksum {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.i, r.j = 0, n
- continue
-
- case chunkTypeUncompressedData:
- // Section 4.3. Uncompressed data (chunk type 0x01).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- buf := r.buf[:checksumSize]
- if !r.readFull(buf, false) {
- return 0, r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- // Read directly into r.decoded instead of via r.buf.
- n := chunkLen - checksumSize
- if n > len(r.decoded) {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if !r.readFull(r.decoded[:n], false) {
- return 0, r.err
- }
- if crc(r.decoded[:n]) != checksum {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.i, r.j = 0, n
- continue
-
- case chunkTypeStreamIdentifier:
- // Section 4.1. Stream identifier (chunk type 0xff).
- if chunkLen != len(magicBody) {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if !r.readFull(r.buf[:len(magicBody)], false) {
- return 0, r.err
- }
- for i := 0; i < len(magicBody); i++ {
- if r.buf[i] != magicBody[i] {
- r.err = ErrCorrupt
- return 0, r.err
- }
- }
- continue
- }
-
- if chunkType <= 0x7f {
- // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f).
- r.err = ErrUnsupported
- return 0, r.err
- }
- // Section 4.4 Padding (chunk type 0xfe).
- // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
- if !r.readFull(r.buf[:chunkLen], false) {
- return 0, r.err
- }
- }
-}
diff --git a/vendor/github.com/klauspost/compress/snappy/decode_amd64.go b/vendor/github.com/klauspost/compress/snappy/decode_amd64.go
deleted file mode 100644
index fcd192b84..000000000
--- a/vendor/github.com/klauspost/compress/snappy/decode_amd64.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-// +build gc
-// +build !noasm
-
-package snappy
-
-// decode has the same semantics as in decode_other.go.
-//
-//go:noescape
-func decode(dst, src []byte) int
diff --git a/vendor/github.com/klauspost/compress/snappy/decode_amd64.s b/vendor/github.com/klauspost/compress/snappy/decode_amd64.s
deleted file mode 100644
index 1c66e3723..000000000
--- a/vendor/github.com/klauspost/compress/snappy/decode_amd64.s
+++ /dev/null
@@ -1,482 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-// +build gc
-// +build !noasm
-
-#include "textflag.h"
-
-// The asm code generally follows the pure Go code in decode_other.go, except
-// where marked with a "!!!".
-
-// func decode(dst, src []byte) int
-//
-// All local variables fit into registers. The non-zero stack size is only to
-// spill registers and push args when issuing a CALL. The register allocation:
-// - AX scratch
-// - BX scratch
-// - CX length or x
-// - DX offset
-// - SI &src[s]
-// - DI &dst[d]
-// + R8 dst_base
-// + R9 dst_len
-// + R10 dst_base + dst_len
-// + R11 src_base
-// + R12 src_len
-// + R13 src_base + src_len
-// - R14 used by doCopy
-// - R15 used by doCopy
-//
-// The registers R8-R13 (marked with a "+") are set at the start of the
-// function, and after a CALL returns, and are not otherwise modified.
-//
-// The d variable is implicitly DI - R8, and len(dst)-d is R10 - DI.
-// The s variable is implicitly SI - R11, and len(src)-s is R13 - SI.
-TEXT ·decode(SB), NOSPLIT, $48-56
- // Initialize SI, DI and R8-R13.
- MOVQ dst_base+0(FP), R8
- MOVQ dst_len+8(FP), R9
- MOVQ R8, DI
- MOVQ R8, R10
- ADDQ R9, R10
- MOVQ src_base+24(FP), R11
- MOVQ src_len+32(FP), R12
- MOVQ R11, SI
- MOVQ R11, R13
- ADDQ R12, R13
-
-loop:
- // for s < len(src)
- CMPQ SI, R13
- JEQ end
-
- // CX = uint32(src[s])
- //
- // switch src[s] & 0x03
- MOVBLZX (SI), CX
- MOVL CX, BX
- ANDL $3, BX
- CMPL BX, $1
- JAE tagCopy
-
- // ----------------------------------------
- // The code below handles literal tags.
-
- // case tagLiteral:
- // x := uint32(src[s] >> 2)
- // switch
- SHRL $2, CX
- CMPL CX, $60
- JAE tagLit60Plus
-
- // case x < 60:
- // s++
- INCQ SI
-
-doLit:
- // This is the end of the inner "switch", when we have a literal tag.
- //
- // We assume that CX == x and x fits in a uint32, where x is the variable
- // used in the pure Go decode_other.go code.
-
- // length = int(x) + 1
- //
- // Unlike the pure Go code, we don't need to check if length <= 0 because
- // CX can hold 64 bits, so the increment cannot overflow.
- INCQ CX
-
- // Prepare to check if copying length bytes will run past the end of dst or
- // src.
- //
- // AX = len(dst) - d
- // BX = len(src) - s
- MOVQ R10, AX
- SUBQ DI, AX
- MOVQ R13, BX
- SUBQ SI, BX
-
- // !!! Try a faster technique for short (16 or fewer bytes) copies.
- //
- // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 {
- // goto callMemmove // Fall back on calling runtime·memmove.
- // }
- //
- // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s
- // against 21 instead of 16, because it cannot assume that all of its input
- // is contiguous in memory and so it needs to leave enough source bytes to
- // read the next tag without refilling buffers, but Go's Decode assumes
- // contiguousness (the src argument is a []byte).
- CMPQ CX, $16
- JGT callMemmove
- CMPQ AX, $16
- JLT callMemmove
- CMPQ BX, $16
- JLT callMemmove
-
- // !!! Implement the copy from src to dst as a 16-byte load and store.
- // (Decode's documentation says that dst and src must not overlap.)
- //
- // This always copies 16 bytes, instead of only length bytes, but that's
- // OK. If the input is a valid Snappy encoding then subsequent iterations
- // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a
- // non-nil error), so the overrun will be ignored.
- //
- // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or
- // 16-byte loads and stores. This technique probably wouldn't be as
- // effective on architectures that are fussier about alignment.
- MOVOU 0(SI), X0
- MOVOU X0, 0(DI)
-
- // d += length
- // s += length
- ADDQ CX, DI
- ADDQ CX, SI
- JMP loop
-
-callMemmove:
- // if length > len(dst)-d || length > len(src)-s { etc }
- CMPQ CX, AX
- JGT errCorrupt
- CMPQ CX, BX
- JGT errCorrupt
-
- // copy(dst[d:], src[s:s+length])
- //
- // This means calling runtime·memmove(&dst[d], &src[s], length), so we push
- // DI, SI and CX as arguments. Coincidentally, we also need to spill those
- // three registers to the stack, to save local variables across the CALL.
- MOVQ DI, 0(SP)
- MOVQ SI, 8(SP)
- MOVQ CX, 16(SP)
- MOVQ DI, 24(SP)
- MOVQ SI, 32(SP)
- MOVQ CX, 40(SP)
- CALL runtime·memmove(SB)
-
- // Restore local variables: unspill registers from the stack and
- // re-calculate R8-R13.
- MOVQ 24(SP), DI
- MOVQ 32(SP), SI
- MOVQ 40(SP), CX
- MOVQ dst_base+0(FP), R8
- MOVQ dst_len+8(FP), R9
- MOVQ R8, R10
- ADDQ R9, R10
- MOVQ src_base+24(FP), R11
- MOVQ src_len+32(FP), R12
- MOVQ R11, R13
- ADDQ R12, R13
-
- // d += length
- // s += length
- ADDQ CX, DI
- ADDQ CX, SI
- JMP loop
-
-tagLit60Plus:
- // !!! This fragment does the
- //
- // s += x - 58; if uint(s) > uint(len(src)) { etc }
- //
- // checks. In the asm version, we code it once instead of once per switch case.
- ADDQ CX, SI
- SUBQ $58, SI
- CMPQ SI, R13
- JA errCorrupt
-
- // case x == 60:
- CMPL CX, $61
- JEQ tagLit61
- JA tagLit62Plus
-
- // x = uint32(src[s-1])
- MOVBLZX -1(SI), CX
- JMP doLit
-
-tagLit61:
- // case x == 61:
- // x = uint32(src[s-2]) | uint32(src[s-1])<<8
- MOVWLZX -2(SI), CX
- JMP doLit
-
-tagLit62Plus:
- CMPL CX, $62
- JA tagLit63
-
- // case x == 62:
- // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16
- MOVWLZX -3(SI), CX
- MOVBLZX -1(SI), BX
- SHLL $16, BX
- ORL BX, CX
- JMP doLit
-
-tagLit63:
- // case x == 63:
- // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24
- MOVL -4(SI), CX
- JMP doLit
-
-// The code above handles literal tags.
-// ----------------------------------------
-// The code below handles copy tags.
-
-tagCopy4:
- // case tagCopy4:
- // s += 5
- ADDQ $5, SI
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ SI, R13
- JA errCorrupt
-
- // length = 1 + int(src[s-5])>>2
- SHRQ $2, CX
- INCQ CX
-
- // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24)
- MOVLQZX -4(SI), DX
- JMP doCopy
-
-tagCopy2:
- // case tagCopy2:
- // s += 3
- ADDQ $3, SI
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ SI, R13
- JA errCorrupt
-
- // length = 1 + int(src[s-3])>>2
- SHRQ $2, CX
- INCQ CX
-
- // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8)
- MOVWQZX -2(SI), DX
- JMP doCopy
-
-tagCopy:
- // We have a copy tag. We assume that:
- // - BX == src[s] & 0x03
- // - CX == src[s]
- CMPQ BX, $2
- JEQ tagCopy2
- JA tagCopy4
-
- // case tagCopy1:
- // s += 2
- ADDQ $2, SI
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ SI, R13
- JA errCorrupt
-
- // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- MOVQ CX, DX
- ANDQ $0xe0, DX
- SHLQ $3, DX
- MOVBQZX -1(SI), BX
- ORQ BX, DX
-
- // length = 4 + int(src[s-2])>>2&0x7
- SHRQ $2, CX
- ANDQ $7, CX
- ADDQ $4, CX
-
-doCopy:
- // This is the end of the outer "switch", when we have a copy tag.
- //
- // We assume that:
- // - CX == length && CX > 0
- // - DX == offset
-
- // if offset <= 0 { etc }
- CMPQ DX, $0
- JLE errCorrupt
-
- // if d < offset { etc }
- MOVQ DI, BX
- SUBQ R8, BX
- CMPQ BX, DX
- JLT errCorrupt
-
- // if length > len(dst)-d { etc }
- MOVQ R10, BX
- SUBQ DI, BX
- CMPQ CX, BX
- JGT errCorrupt
-
- // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length
- //
- // Set:
- // - R14 = len(dst)-d
- // - R15 = &dst[d-offset]
- MOVQ R10, R14
- SUBQ DI, R14
- MOVQ DI, R15
- SUBQ DX, R15
-
- // !!! Try a faster technique for short (16 or fewer bytes) forward copies.
- //
- // First, try using two 8-byte load/stores, similar to the doLit technique
- // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is
- // still OK if offset >= 8. Note that this has to be two 8-byte load/stores
- // and not one 16-byte load/store, and the first store has to be before the
- // second load, due to the overlap if offset is in the range [8, 16).
- //
- // if length > 16 || offset < 8 || len(dst)-d < 16 {
- // goto slowForwardCopy
- // }
- // copy 16 bytes
- // d += length
- CMPQ CX, $16
- JGT slowForwardCopy
- CMPQ DX, $8
- JLT slowForwardCopy
- CMPQ R14, $16
- JLT slowForwardCopy
- MOVQ 0(R15), AX
- MOVQ AX, 0(DI)
- MOVQ 8(R15), BX
- MOVQ BX, 8(DI)
- ADDQ CX, DI
- JMP loop
-
-slowForwardCopy:
- // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we
- // can still try 8-byte load stores, provided we can overrun up to 10 extra
- // bytes. As above, the overrun will be fixed up by subsequent iterations
- // of the outermost loop.
- //
- // The C++ snappy code calls this technique IncrementalCopyFastPath. Its
- // commentary says:
- //
- // ----
- //
- // The main part of this loop is a simple copy of eight bytes at a time
- // until we've copied (at least) the requested amount of bytes. However,
- // if d and d-offset are less than eight bytes apart (indicating a
- // repeating pattern of length < 8), we first need to expand the pattern in
- // order to get the correct results. For instance, if the buffer looks like
- // this, with the eight-byte and patterns marked as
- // intervals:
- //
- // abxxxxxxxxxxxx
- // [------] d-offset
- // [------] d
- //
- // a single eight-byte copy from to will repeat the pattern
- // once, after which we can move two bytes without moving :
- //
- // ababxxxxxxxxxx
- // [------] d-offset
- // [------] d
- //
- // and repeat the exercise until the two no longer overlap.
- //
- // This allows us to do very well in the special case of one single byte
- // repeated many times, without taking a big hit for more general cases.
- //
- // The worst case of extra writing past the end of the match occurs when
- // offset == 1 and length == 1; the last copy will read from byte positions
- // [0..7] and write to [4..11], whereas it was only supposed to write to
- // position 1. Thus, ten excess bytes.
- //
- // ----
- //
- // That "10 byte overrun" worst case is confirmed by Go's
- // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy
- // and finishSlowForwardCopy algorithm.
- //
- // if length > len(dst)-d-10 {
- // goto verySlowForwardCopy
- // }
- SUBQ $10, R14
- CMPQ CX, R14
- JGT verySlowForwardCopy
-
-makeOffsetAtLeast8:
- // !!! As above, expand the pattern so that offset >= 8 and we can use
- // 8-byte load/stores.
- //
- // for offset < 8 {
- // copy 8 bytes from dst[d-offset:] to dst[d:]
- // length -= offset
- // d += offset
- // offset += offset
- // // The two previous lines together means that d-offset, and therefore
- // // R15, is unchanged.
- // }
- CMPQ DX, $8
- JGE fixUpSlowForwardCopy
- MOVQ (R15), BX
- MOVQ BX, (DI)
- SUBQ DX, CX
- ADDQ DX, DI
- ADDQ DX, DX
- JMP makeOffsetAtLeast8
-
-fixUpSlowForwardCopy:
- // !!! Add length (which might be negative now) to d (implied by DI being
- // &dst[d]) so that d ends up at the right place when we jump back to the
- // top of the loop. Before we do that, though, we save DI to AX so that, if
- // length is positive, copying the remaining length bytes will write to the
- // right place.
- MOVQ DI, AX
- ADDQ CX, DI
-
-finishSlowForwardCopy:
- // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative
- // length means that we overrun, but as above, that will be fixed up by
- // subsequent iterations of the outermost loop.
- CMPQ CX, $0
- JLE loop
- MOVQ (R15), BX
- MOVQ BX, (AX)
- ADDQ $8, R15
- ADDQ $8, AX
- SUBQ $8, CX
- JMP finishSlowForwardCopy
-
-verySlowForwardCopy:
- // verySlowForwardCopy is a simple implementation of forward copy. In C
- // parlance, this is a do/while loop instead of a while loop, since we know
- // that length > 0. In Go syntax:
- //
- // for {
- // dst[d] = dst[d - offset]
- // d++
- // length--
- // if length == 0 {
- // break
- // }
- // }
- MOVB (R15), BX
- MOVB BX, (DI)
- INCQ R15
- INCQ DI
- DECQ CX
- JNZ verySlowForwardCopy
- JMP loop
-
-// The code above handles copy tags.
-// ----------------------------------------
-
-end:
- // This is the end of the "for s < len(src)".
- //
- // if d != len(dst) { etc }
- CMPQ DI, R10
- JNE errCorrupt
-
- // return 0
- MOVQ $0, ret+48(FP)
- RET
-
-errCorrupt:
- // return decodeErrCodeCorrupt
- MOVQ $1, ret+48(FP)
- RET
diff --git a/vendor/github.com/klauspost/compress/snappy/decode_other.go b/vendor/github.com/klauspost/compress/snappy/decode_other.go
deleted file mode 100644
index 94a96c5d7..000000000
--- a/vendor/github.com/klauspost/compress/snappy/decode_other.go
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !amd64 appengine !gc noasm
-
-package snappy
-
-// decode writes the decoding of src to dst. It assumes that the varint-encoded
-// length of the decompressed bytes has already been read, and that len(dst)
-// equals that length.
-//
-// It returns 0 on success or a decodeErrCodeXxx error code on failure.
-func decode(dst, src []byte) int {
- var d, s, offset, length int
- for s < len(src) {
- switch src[s] & 0x03 {
- case tagLiteral:
- x := uint32(src[s] >> 2)
- switch {
- case x < 60:
- s++
- case x == 60:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-1])
- case x == 61:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-2]) | uint32(src[s-1])<<8
- case x == 62:
- s += 4
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16
- case x == 63:
- s += 5
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24
- }
- length = int(x) + 1
- if length <= 0 {
- return decodeErrCodeUnsupportedLiteralLength
- }
- if length > len(dst)-d || length > len(src)-s {
- return decodeErrCodeCorrupt
- }
- copy(dst[d:], src[s:s+length])
- d += length
- s += length
- continue
-
- case tagCopy1:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = 4 + int(src[s-2])>>2&0x7
- offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
-
- case tagCopy2:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = 1 + int(src[s-3])>>2
- offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8)
-
- case tagCopy4:
- s += 5
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = 1 + int(src[s-5])>>2
- offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24)
- }
-
- if offset <= 0 || d < offset || length > len(dst)-d {
- return decodeErrCodeCorrupt
- }
- // Copy from an earlier sub-slice of dst to a later sub-slice.
- // If no overlap, use the built-in copy:
- if offset > length {
- copy(dst[d:d+length], dst[d-offset:])
- d += length
- continue
- }
-
- // Unlike the built-in copy function, this byte-by-byte copy always runs
- // forwards, even if the slices overlap. Conceptually, this is:
- //
- // d += forwardCopy(dst[d:d+length], dst[d-offset:])
- //
- // We align the slices into a and b and show the compiler they are the same size.
- // This allows the loop to run without bounds checks.
- a := dst[d : d+length]
- b := dst[d-offset:]
- b = b[:len(a)]
- for i := range a {
- a[i] = b[i]
- }
- d += length
- }
- if d != len(dst) {
- return decodeErrCodeCorrupt
- }
- return 0
-}
diff --git a/vendor/github.com/klauspost/compress/snappy/encode.go b/vendor/github.com/klauspost/compress/snappy/encode.go
deleted file mode 100644
index 8d393e904..000000000
--- a/vendor/github.com/klauspost/compress/snappy/encode.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package snappy
-
-import (
- "encoding/binary"
- "errors"
- "io"
-)
-
-// Encode returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-func Encode(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if len(dst) < n {
- dst = make([]byte, n)
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- for len(src) > 0 {
- p := src
- src = nil
- if len(p) > maxBlockSize {
- p, src = p[:maxBlockSize], p[maxBlockSize:]
- }
- if len(p) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], p)
- } else {
- d += encodeBlock(dst[d:], p)
- }
- }
- return dst[:d]
-}
-
-// inputMargin is the minimum number of extra input bytes to keep, inside
-// encodeBlock's inner loop. On some architectures, this margin lets us
-// implement a fast path for emitLiteral, where the copy of short (<= 16 byte)
-// literals can be implemented as a single load to and store from a 16-byte
-// register. That literal's actual length can be as short as 1 byte, so this
-// can copy up to 15 bytes too much, but that's OK as subsequent iterations of
-// the encoding loop will fix up the copy overrun, and this inputMargin ensures
-// that we don't overrun the dst and src buffers.
-const inputMargin = 16 - 1
-
-// minNonLiteralBlockSize is the minimum size of the input to encodeBlock that
-// could be encoded with a copy tag. This is the minimum with respect to the
-// algorithm used by encodeBlock, not a minimum enforced by the file format.
-//
-// The encoded output must start with at least a 1 byte literal, as there are
-// no previous bytes to copy. A minimal (1 byte) copy after that, generated
-// from an emitCopy call in encodeBlock's main loop, would require at least
-// another inputMargin bytes, for the reason above: we want any emitLiteral
-// calls inside encodeBlock's main loop to use the fast path if possible, which
-// requires being able to overrun by inputMargin bytes. Thus,
-// minNonLiteralBlockSize equals 1 + 1 + inputMargin.
-//
-// The C++ code doesn't use this exact threshold, but it could, as discussed at
-// https://groups.google.com/d/topic/snappy-compression/oGbhsdIJSJ8/discussion
-// The difference between Go (2+inputMargin) and C++ (inputMargin) is purely an
-// optimization. It should not affect the encoded form. This is tested by
-// TestSameEncodingAsCppShortCopies.
-const minNonLiteralBlockSize = 1 + 1 + inputMargin
-
-// MaxEncodedLen returns the maximum length of a snappy block, given its
-// uncompressed length.
-//
-// It will return a negative value if srcLen is too large to encode.
-func MaxEncodedLen(srcLen int) int {
- n := uint64(srcLen)
- if n > 0xffffffff {
- return -1
- }
- // Compressed data can be defined as:
- // compressed := item* literal*
- // item := literal* copy
- //
- // The trailing literal sequence has a space blowup of at most 62/60
- // since a literal of length 60 needs one tag byte + one extra byte
- // for length information.
- //
- // Item blowup is trickier to measure. Suppose the "copy" op copies
- // 4 bytes of data. Because of a special check in the encoding code,
- // we produce a 4-byte copy only if the offset is < 65536. Therefore
- // the copy op takes 3 bytes to encode, and this type of item leads
- // to at most the 62/60 blowup for representing literals.
- //
- // Suppose the "copy" op copies 5 bytes of data. If the offset is big
- // enough, it will take 5 bytes to encode the copy op. Therefore the
- // worst case here is a one-byte literal followed by a five-byte copy.
- // That is, 6 bytes of input turn into 7 bytes of "compressed" data.
- //
- // This last factor dominates the blowup, so the final estimate is:
- n = 32 + n + n/6
- if n > 0xffffffff {
- return -1
- }
- return int(n)
-}
-
-var errClosed = errors.New("snappy: Writer is closed")
-
-// NewWriter returns a new Writer that compresses to w.
-//
-// The Writer returned does not buffer writes. There is no need to Flush or
-// Close such a Writer.
-//
-// Deprecated: the Writer returned is not suitable for many small writes, only
-// for few large writes. Use NewBufferedWriter instead, which is efficient
-// regardless of the frequency and shape of the writes, and remember to Close
-// that Writer when done.
-func NewWriter(w io.Writer) *Writer {
- return &Writer{
- w: w,
- obuf: make([]byte, obufLen),
- }
-}
-
-// NewBufferedWriter returns a new Writer that compresses to w, using the
-// framing format described at
-// https://github.com/google/snappy/blob/master/framing_format.txt
-//
-// The Writer returned buffers writes. Users must call Close to guarantee all
-// data has been forwarded to the underlying io.Writer. They may also call
-// Flush zero or more times before calling Close.
-func NewBufferedWriter(w io.Writer) *Writer {
- return &Writer{
- w: w,
- ibuf: make([]byte, 0, maxBlockSize),
- obuf: make([]byte, obufLen),
- }
-}
-
-// Writer is an io.Writer that can write Snappy-compressed bytes.
-type Writer struct {
- w io.Writer
- err error
-
- // ibuf is a buffer for the incoming (uncompressed) bytes.
- //
- // Its use is optional. For backwards compatibility, Writers created by the
- // NewWriter function have ibuf == nil, do not buffer incoming bytes, and
- // therefore do not need to be Flush'ed or Close'd.
- ibuf []byte
-
- // obuf is a buffer for the outgoing (compressed) bytes.
- obuf []byte
-
- // wroteStreamHeader is whether we have written the stream header.
- wroteStreamHeader bool
-}
-
-// Reset discards the writer's state and switches the Snappy writer to write to
-// w. This permits reusing a Writer rather than allocating a new one.
-func (w *Writer) Reset(writer io.Writer) {
- w.w = writer
- w.err = nil
- if w.ibuf != nil {
- w.ibuf = w.ibuf[:0]
- }
- w.wroteStreamHeader = false
-}
-
-// Write satisfies the io.Writer interface.
-func (w *Writer) Write(p []byte) (nRet int, errRet error) {
- if w.ibuf == nil {
- // Do not buffer incoming bytes. This does not perform or compress well
- // if the caller of Writer.Write writes many small slices. This
- // behavior is therefore deprecated, but still supported for backwards
- // compatibility with code that doesn't explicitly Flush or Close.
- return w.write(p)
- }
-
- // The remainder of this method is based on bufio.Writer.Write from the
- // standard library.
-
- for len(p) > (cap(w.ibuf)-len(w.ibuf)) && w.err == nil {
- var n int
- if len(w.ibuf) == 0 {
- // Large write, empty buffer.
- // Write directly from p to avoid copy.
- n, _ = w.write(p)
- } else {
- n = copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p)
- w.ibuf = w.ibuf[:len(w.ibuf)+n]
- w.Flush()
- }
- nRet += n
- p = p[n:]
- }
- if w.err != nil {
- return nRet, w.err
- }
- n := copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p)
- w.ibuf = w.ibuf[:len(w.ibuf)+n]
- nRet += n
- return nRet, nil
-}
-
-func (w *Writer) write(p []byte) (nRet int, errRet error) {
- if w.err != nil {
- return 0, w.err
- }
- for len(p) > 0 {
- obufStart := len(magicChunk)
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- copy(w.obuf, magicChunk)
- obufStart = 0
- }
-
- var uncompressed []byte
- if len(p) > maxBlockSize {
- uncompressed, p = p[:maxBlockSize], p[maxBlockSize:]
- } else {
- uncompressed, p = p, nil
- }
- checksum := crc(uncompressed)
-
- // Compress the buffer, discarding the result if the improvement
- // isn't at least 12.5%.
- compressed := Encode(w.obuf[obufHeaderLen:], uncompressed)
- chunkType := uint8(chunkTypeCompressedData)
- chunkLen := 4 + len(compressed)
- obufEnd := obufHeaderLen + len(compressed)
- if len(compressed) >= len(uncompressed)-len(uncompressed)/8 {
- chunkType = chunkTypeUncompressedData
- chunkLen = 4 + len(uncompressed)
- obufEnd = obufHeaderLen
- }
-
- // Fill in the per-chunk header that comes before the body.
- w.obuf[len(magicChunk)+0] = chunkType
- w.obuf[len(magicChunk)+1] = uint8(chunkLen >> 0)
- w.obuf[len(magicChunk)+2] = uint8(chunkLen >> 8)
- w.obuf[len(magicChunk)+3] = uint8(chunkLen >> 16)
- w.obuf[len(magicChunk)+4] = uint8(checksum >> 0)
- w.obuf[len(magicChunk)+5] = uint8(checksum >> 8)
- w.obuf[len(magicChunk)+6] = uint8(checksum >> 16)
- w.obuf[len(magicChunk)+7] = uint8(checksum >> 24)
-
- if _, err := w.w.Write(w.obuf[obufStart:obufEnd]); err != nil {
- w.err = err
- return nRet, err
- }
- if chunkType == chunkTypeUncompressedData {
- if _, err := w.w.Write(uncompressed); err != nil {
- w.err = err
- return nRet, err
- }
- }
- nRet += len(uncompressed)
- }
- return nRet, nil
-}
-
-// Flush flushes the Writer to its underlying io.Writer.
-func (w *Writer) Flush() error {
- if w.err != nil {
- return w.err
- }
- if len(w.ibuf) == 0 {
- return nil
- }
- w.write(w.ibuf)
- w.ibuf = w.ibuf[:0]
- return w.err
-}
-
-// Close calls Flush and then closes the Writer.
-func (w *Writer) Close() error {
- w.Flush()
- ret := w.err
- if w.err == nil {
- w.err = errClosed
- }
- return ret
-}
diff --git a/vendor/github.com/klauspost/compress/snappy/encode_amd64.go b/vendor/github.com/klauspost/compress/snappy/encode_amd64.go
deleted file mode 100644
index 150d91bc8..000000000
--- a/vendor/github.com/klauspost/compress/snappy/encode_amd64.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-// +build gc
-// +build !noasm
-
-package snappy
-
-// emitLiteral has the same semantics as in encode_other.go.
-//
-//go:noescape
-func emitLiteral(dst, lit []byte) int
-
-// emitCopy has the same semantics as in encode_other.go.
-//
-//go:noescape
-func emitCopy(dst []byte, offset, length int) int
-
-// extendMatch has the same semantics as in encode_other.go.
-//
-//go:noescape
-func extendMatch(src []byte, i, j int) int
-
-// encodeBlock has the same semantics as in encode_other.go.
-//
-//go:noescape
-func encodeBlock(dst, src []byte) (d int)
diff --git a/vendor/github.com/klauspost/compress/snappy/encode_amd64.s b/vendor/github.com/klauspost/compress/snappy/encode_amd64.s
deleted file mode 100644
index adfd979fe..000000000
--- a/vendor/github.com/klauspost/compress/snappy/encode_amd64.s
+++ /dev/null
@@ -1,730 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-// +build gc
-// +build !noasm
-
-#include "textflag.h"
-
-// The XXX lines assemble on Go 1.4, 1.5 and 1.7, but not 1.6, due to a
-// Go toolchain regression. See https://github.com/golang/go/issues/15426 and
-// https://github.com/golang/snappy/issues/29
-//
-// As a workaround, the package was built with a known good assembler, and
-// those instructions were disassembled by "objdump -d" to yield the
-// 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15
-// style comments, in AT&T asm syntax. Note that rsp here is a physical
-// register, not Go/asm's SP pseudo-register (see https://golang.org/doc/asm).
-// The instructions were then encoded as "BYTE $0x.." sequences, which assemble
-// fine on Go 1.6.
-
-// The asm code generally follows the pure Go code in encode_other.go, except
-// where marked with a "!!!".
-
-// ----------------------------------------------------------------------------
-
-// func emitLiteral(dst, lit []byte) int
-//
-// All local variables fit into registers. The register allocation:
-// - AX len(lit)
-// - BX n
-// - DX return value
-// - DI &dst[i]
-// - R10 &lit[0]
-//
-// The 24 bytes of stack space is to call runtime·memmove.
-//
-// The unusual register allocation of local variables, such as R10 for the
-// source pointer, matches the allocation used at the call site in encodeBlock,
-// which makes it easier to manually inline this function.
-TEXT ·emitLiteral(SB), NOSPLIT, $24-56
- MOVQ dst_base+0(FP), DI
- MOVQ lit_base+24(FP), R10
- MOVQ lit_len+32(FP), AX
- MOVQ AX, DX
- MOVL AX, BX
- SUBL $1, BX
-
- CMPL BX, $60
- JLT oneByte
- CMPL BX, $256
- JLT twoBytes
-
-threeBytes:
- MOVB $0xf4, 0(DI)
- MOVW BX, 1(DI)
- ADDQ $3, DI
- ADDQ $3, DX
- JMP memmove
-
-twoBytes:
- MOVB $0xf0, 0(DI)
- MOVB BX, 1(DI)
- ADDQ $2, DI
- ADDQ $2, DX
- JMP memmove
-
-oneByte:
- SHLB $2, BX
- MOVB BX, 0(DI)
- ADDQ $1, DI
- ADDQ $1, DX
-
-memmove:
- MOVQ DX, ret+48(FP)
-
- // copy(dst[i:], lit)
- //
- // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push
- // DI, R10 and AX as arguments.
- MOVQ DI, 0(SP)
- MOVQ R10, 8(SP)
- MOVQ AX, 16(SP)
- CALL runtime·memmove(SB)
- RET
-
-// ----------------------------------------------------------------------------
-
-// func emitCopy(dst []byte, offset, length int) int
-//
-// All local variables fit into registers. The register allocation:
-// - AX length
-// - SI &dst[0]
-// - DI &dst[i]
-// - R11 offset
-//
-// The unusual register allocation of local variables, such as R11 for the
-// offset, matches the allocation used at the call site in encodeBlock, which
-// makes it easier to manually inline this function.
-TEXT ·emitCopy(SB), NOSPLIT, $0-48
- MOVQ dst_base+0(FP), DI
- MOVQ DI, SI
- MOVQ offset+24(FP), R11
- MOVQ length+32(FP), AX
-
-loop0:
- // for length >= 68 { etc }
- CMPL AX, $68
- JLT step1
-
- // Emit a length 64 copy, encoded as 3 bytes.
- MOVB $0xfe, 0(DI)
- MOVW R11, 1(DI)
- ADDQ $3, DI
- SUBL $64, AX
- JMP loop0
-
-step1:
- // if length > 64 { etc }
- CMPL AX, $64
- JLE step2
-
- // Emit a length 60 copy, encoded as 3 bytes.
- MOVB $0xee, 0(DI)
- MOVW R11, 1(DI)
- ADDQ $3, DI
- SUBL $60, AX
-
-step2:
- // if length >= 12 || offset >= 2048 { goto step3 }
- CMPL AX, $12
- JGE step3
- CMPL R11, $2048
- JGE step3
-
- // Emit the remaining copy, encoded as 2 bytes.
- MOVB R11, 1(DI)
- SHRL $8, R11
- SHLB $5, R11
- SUBB $4, AX
- SHLB $2, AX
- ORB AX, R11
- ORB $1, R11
- MOVB R11, 0(DI)
- ADDQ $2, DI
-
- // Return the number of bytes written.
- SUBQ SI, DI
- MOVQ DI, ret+40(FP)
- RET
-
-step3:
- // Emit the remaining copy, encoded as 3 bytes.
- SUBL $1, AX
- SHLB $2, AX
- ORB $2, AX
- MOVB AX, 0(DI)
- MOVW R11, 1(DI)
- ADDQ $3, DI
-
- // Return the number of bytes written.
- SUBQ SI, DI
- MOVQ DI, ret+40(FP)
- RET
-
-// ----------------------------------------------------------------------------
-
-// func extendMatch(src []byte, i, j int) int
-//
-// All local variables fit into registers. The register allocation:
-// - DX &src[0]
-// - SI &src[j]
-// - R13 &src[len(src) - 8]
-// - R14 &src[len(src)]
-// - R15 &src[i]
-//
-// The unusual register allocation of local variables, such as R15 for a source
-// pointer, matches the allocation used at the call site in encodeBlock, which
-// makes it easier to manually inline this function.
-TEXT ·extendMatch(SB), NOSPLIT, $0-48
- MOVQ src_base+0(FP), DX
- MOVQ src_len+8(FP), R14
- MOVQ i+24(FP), R15
- MOVQ j+32(FP), SI
- ADDQ DX, R14
- ADDQ DX, R15
- ADDQ DX, SI
- MOVQ R14, R13
- SUBQ $8, R13
-
-cmp8:
- // As long as we are 8 or more bytes before the end of src, we can load and
- // compare 8 bytes at a time. If those 8 bytes are equal, repeat.
- CMPQ SI, R13
- JA cmp1
- MOVQ (R15), AX
- MOVQ (SI), BX
- CMPQ AX, BX
- JNE bsf
- ADDQ $8, R15
- ADDQ $8, SI
- JMP cmp8
-
-bsf:
- // If those 8 bytes were not equal, XOR the two 8 byte values, and return
- // the index of the first byte that differs. The BSF instruction finds the
- // least significant 1 bit, the amd64 architecture is little-endian, and
- // the shift by 3 converts a bit index to a byte index.
- XORQ AX, BX
- BSFQ BX, BX
- SHRQ $3, BX
- ADDQ BX, SI
-
- // Convert from &src[ret] to ret.
- SUBQ DX, SI
- MOVQ SI, ret+40(FP)
- RET
-
-cmp1:
- // In src's tail, compare 1 byte at a time.
- CMPQ SI, R14
- JAE extendMatchEnd
- MOVB (R15), AX
- MOVB (SI), BX
- CMPB AX, BX
- JNE extendMatchEnd
- ADDQ $1, R15
- ADDQ $1, SI
- JMP cmp1
-
-extendMatchEnd:
- // Convert from &src[ret] to ret.
- SUBQ DX, SI
- MOVQ SI, ret+40(FP)
- RET
-
-// ----------------------------------------------------------------------------
-
-// func encodeBlock(dst, src []byte) (d int)
-//
-// All local variables fit into registers, other than "var table". The register
-// allocation:
-// - AX . .
-// - BX . .
-// - CX 56 shift (note that amd64 shifts by non-immediates must use CX).
-// - DX 64 &src[0], tableSize
-// - SI 72 &src[s]
-// - DI 80 &dst[d]
-// - R9 88 sLimit
-// - R10 . &src[nextEmit]
-// - R11 96 prevHash, currHash, nextHash, offset
-// - R12 104 &src[base], skip
-// - R13 . &src[nextS], &src[len(src) - 8]
-// - R14 . len(src), bytesBetweenHashLookups, &src[len(src)], x
-// - R15 112 candidate
-//
-// The second column (56, 64, etc) is the stack offset to spill the registers
-// when calling other functions. We could pack this slightly tighter, but it's
-// simpler to have a dedicated spill map independent of the function called.
-//
-// "var table [maxTableSize]uint16" takes up 32768 bytes of stack space. An
-// extra 56 bytes, to call other functions, and an extra 64 bytes, to spill
-// local variables (registers) during calls gives 32768 + 56 + 64 = 32888.
-TEXT ·encodeBlock(SB), 0, $32888-56
- MOVQ dst_base+0(FP), DI
- MOVQ src_base+24(FP), SI
- MOVQ src_len+32(FP), R14
-
- // shift, tableSize := uint32(32-8), 1<<8
- MOVQ $24, CX
- MOVQ $256, DX
-
-calcShift:
- // for ; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 {
- // shift--
- // }
- CMPQ DX, $16384
- JGE varTable
- CMPQ DX, R14
- JGE varTable
- SUBQ $1, CX
- SHLQ $1, DX
- JMP calcShift
-
-varTable:
- // var table [maxTableSize]uint16
- //
- // In the asm code, unlike the Go code, we can zero-initialize only the
- // first tableSize elements. Each uint16 element is 2 bytes and each MOVOU
- // writes 16 bytes, so we can do only tableSize/8 writes instead of the
- // 2048 writes that would zero-initialize all of table's 32768 bytes.
- SHRQ $3, DX
- LEAQ table-32768(SP), BX
- PXOR X0, X0
-
-memclr:
- MOVOU X0, 0(BX)
- ADDQ $16, BX
- SUBQ $1, DX
- JNZ memclr
-
- // !!! DX = &src[0]
- MOVQ SI, DX
-
- // sLimit := len(src) - inputMargin
- MOVQ R14, R9
- SUBQ $15, R9
-
- // !!! Pre-emptively spill CX, DX and R9 to the stack. Their values don't
- // change for the rest of the function.
- MOVQ CX, 56(SP)
- MOVQ DX, 64(SP)
- MOVQ R9, 88(SP)
-
- // nextEmit := 0
- MOVQ DX, R10
-
- // s := 1
- ADDQ $1, SI
-
- // nextHash := hash(load32(src, s), shift)
- MOVL 0(SI), R11
- IMULL $0x1e35a7bd, R11
- SHRL CX, R11
-
-outer:
- // for { etc }
-
- // skip := 32
- MOVQ $32, R12
-
- // nextS := s
- MOVQ SI, R13
-
- // candidate := 0
- MOVQ $0, R15
-
-inner0:
- // for { etc }
-
- // s := nextS
- MOVQ R13, SI
-
- // bytesBetweenHashLookups := skip >> 5
- MOVQ R12, R14
- SHRQ $5, R14
-
- // nextS = s + bytesBetweenHashLookups
- ADDQ R14, R13
-
- // skip += bytesBetweenHashLookups
- ADDQ R14, R12
-
- // if nextS > sLimit { goto emitRemainder }
- MOVQ R13, AX
- SUBQ DX, AX
- CMPQ AX, R9
- JA emitRemainder
-
- // candidate = int(table[nextHash])
- // XXX: MOVWQZX table-32768(SP)(R11*2), R15
- // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15
- BYTE $0x4e
- BYTE $0x0f
- BYTE $0xb7
- BYTE $0x7c
- BYTE $0x5c
- BYTE $0x78
-
- // table[nextHash] = uint16(s)
- MOVQ SI, AX
- SUBQ DX, AX
-
- // XXX: MOVW AX, table-32768(SP)(R11*2)
- // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2)
- BYTE $0x66
- BYTE $0x42
- BYTE $0x89
- BYTE $0x44
- BYTE $0x5c
- BYTE $0x78
-
- // nextHash = hash(load32(src, nextS), shift)
- MOVL 0(R13), R11
- IMULL $0x1e35a7bd, R11
- SHRL CX, R11
-
- // if load32(src, s) != load32(src, candidate) { continue } break
- MOVL 0(SI), AX
- MOVL (DX)(R15*1), BX
- CMPL AX, BX
- JNE inner0
-
-fourByteMatch:
- // As per the encode_other.go code:
- //
- // A 4-byte match has been found. We'll later see etc.
-
- // !!! Jump to a fast path for short (<= 16 byte) literals. See the comment
- // on inputMargin in encode.go.
- MOVQ SI, AX
- SUBQ R10, AX
- CMPQ AX, $16
- JLE emitLiteralFastPath
-
- // ----------------------------------------
- // Begin inline of the emitLiteral call.
- //
- // d += emitLiteral(dst[d:], src[nextEmit:s])
-
- MOVL AX, BX
- SUBL $1, BX
-
- CMPL BX, $60
- JLT inlineEmitLiteralOneByte
- CMPL BX, $256
- JLT inlineEmitLiteralTwoBytes
-
-inlineEmitLiteralThreeBytes:
- MOVB $0xf4, 0(DI)
- MOVW BX, 1(DI)
- ADDQ $3, DI
- JMP inlineEmitLiteralMemmove
-
-inlineEmitLiteralTwoBytes:
- MOVB $0xf0, 0(DI)
- MOVB BX, 1(DI)
- ADDQ $2, DI
- JMP inlineEmitLiteralMemmove
-
-inlineEmitLiteralOneByte:
- SHLB $2, BX
- MOVB BX, 0(DI)
- ADDQ $1, DI
-
-inlineEmitLiteralMemmove:
- // Spill local variables (registers) onto the stack; call; unspill.
- //
- // copy(dst[i:], lit)
- //
- // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push
- // DI, R10 and AX as arguments.
- MOVQ DI, 0(SP)
- MOVQ R10, 8(SP)
- MOVQ AX, 16(SP)
- ADDQ AX, DI // Finish the "d +=" part of "d += emitLiteral(etc)".
- MOVQ SI, 72(SP)
- MOVQ DI, 80(SP)
- MOVQ R15, 112(SP)
- CALL runtime·memmove(SB)
- MOVQ 56(SP), CX
- MOVQ 64(SP), DX
- MOVQ 72(SP), SI
- MOVQ 80(SP), DI
- MOVQ 88(SP), R9
- MOVQ 112(SP), R15
- JMP inner1
-
-inlineEmitLiteralEnd:
- // End inline of the emitLiteral call.
- // ----------------------------------------
-
-emitLiteralFastPath:
- // !!! Emit the 1-byte encoding "uint8(len(lit)-1)<<2".
- MOVB AX, BX
- SUBB $1, BX
- SHLB $2, BX
- MOVB BX, (DI)
- ADDQ $1, DI
-
- // !!! Implement the copy from lit to dst as a 16-byte load and store.
- // (Encode's documentation says that dst and src must not overlap.)
- //
- // This always copies 16 bytes, instead of only len(lit) bytes, but that's
- // OK. Subsequent iterations will fix up the overrun.
- //
- // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or
- // 16-byte loads and stores. This technique probably wouldn't be as
- // effective on architectures that are fussier about alignment.
- MOVOU 0(R10), X0
- MOVOU X0, 0(DI)
- ADDQ AX, DI
-
-inner1:
- // for { etc }
-
- // base := s
- MOVQ SI, R12
-
- // !!! offset := base - candidate
- MOVQ R12, R11
- SUBQ R15, R11
- SUBQ DX, R11
-
- // ----------------------------------------
- // Begin inline of the extendMatch call.
- //
- // s = extendMatch(src, candidate+4, s+4)
-
- // !!! R14 = &src[len(src)]
- MOVQ src_len+32(FP), R14
- ADDQ DX, R14
-
- // !!! R13 = &src[len(src) - 8]
- MOVQ R14, R13
- SUBQ $8, R13
-
- // !!! R15 = &src[candidate + 4]
- ADDQ $4, R15
- ADDQ DX, R15
-
- // !!! s += 4
- ADDQ $4, SI
-
-inlineExtendMatchCmp8:
- // As long as we are 8 or more bytes before the end of src, we can load and
- // compare 8 bytes at a time. If those 8 bytes are equal, repeat.
- CMPQ SI, R13
- JA inlineExtendMatchCmp1
- MOVQ (R15), AX
- MOVQ (SI), BX
- CMPQ AX, BX
- JNE inlineExtendMatchBSF
- ADDQ $8, R15
- ADDQ $8, SI
- JMP inlineExtendMatchCmp8
-
-inlineExtendMatchBSF:
- // If those 8 bytes were not equal, XOR the two 8 byte values, and return
- // the index of the first byte that differs. The BSF instruction finds the
- // least significant 1 bit, the amd64 architecture is little-endian, and
- // the shift by 3 converts a bit index to a byte index.
- XORQ AX, BX
- BSFQ BX, BX
- SHRQ $3, BX
- ADDQ BX, SI
- JMP inlineExtendMatchEnd
-
-inlineExtendMatchCmp1:
- // In src's tail, compare 1 byte at a time.
- CMPQ SI, R14
- JAE inlineExtendMatchEnd
- MOVB (R15), AX
- MOVB (SI), BX
- CMPB AX, BX
- JNE inlineExtendMatchEnd
- ADDQ $1, R15
- ADDQ $1, SI
- JMP inlineExtendMatchCmp1
-
-inlineExtendMatchEnd:
- // End inline of the extendMatch call.
- // ----------------------------------------
-
- // ----------------------------------------
- // Begin inline of the emitCopy call.
- //
- // d += emitCopy(dst[d:], base-candidate, s-base)
-
- // !!! length := s - base
- MOVQ SI, AX
- SUBQ R12, AX
-
-inlineEmitCopyLoop0:
- // for length >= 68 { etc }
- CMPL AX, $68
- JLT inlineEmitCopyStep1
-
- // Emit a length 64 copy, encoded as 3 bytes.
- MOVB $0xfe, 0(DI)
- MOVW R11, 1(DI)
- ADDQ $3, DI
- SUBL $64, AX
- JMP inlineEmitCopyLoop0
-
-inlineEmitCopyStep1:
- // if length > 64 { etc }
- CMPL AX, $64
- JLE inlineEmitCopyStep2
-
- // Emit a length 60 copy, encoded as 3 bytes.
- MOVB $0xee, 0(DI)
- MOVW R11, 1(DI)
- ADDQ $3, DI
- SUBL $60, AX
-
-inlineEmitCopyStep2:
- // if length >= 12 || offset >= 2048 { goto inlineEmitCopyStep3 }
- CMPL AX, $12
- JGE inlineEmitCopyStep3
- CMPL R11, $2048
- JGE inlineEmitCopyStep3
-
- // Emit the remaining copy, encoded as 2 bytes.
- MOVB R11, 1(DI)
- SHRL $8, R11
- SHLB $5, R11
- SUBB $4, AX
- SHLB $2, AX
- ORB AX, R11
- ORB $1, R11
- MOVB R11, 0(DI)
- ADDQ $2, DI
- JMP inlineEmitCopyEnd
-
-inlineEmitCopyStep3:
- // Emit the remaining copy, encoded as 3 bytes.
- SUBL $1, AX
- SHLB $2, AX
- ORB $2, AX
- MOVB AX, 0(DI)
- MOVW R11, 1(DI)
- ADDQ $3, DI
-
-inlineEmitCopyEnd:
- // End inline of the emitCopy call.
- // ----------------------------------------
-
- // nextEmit = s
- MOVQ SI, R10
-
- // if s >= sLimit { goto emitRemainder }
- MOVQ SI, AX
- SUBQ DX, AX
- CMPQ AX, R9
- JAE emitRemainder
-
- // As per the encode_other.go code:
- //
- // We could immediately etc.
-
- // x := load64(src, s-1)
- MOVQ -1(SI), R14
-
- // prevHash := hash(uint32(x>>0), shift)
- MOVL R14, R11
- IMULL $0x1e35a7bd, R11
- SHRL CX, R11
-
- // table[prevHash] = uint16(s-1)
- MOVQ SI, AX
- SUBQ DX, AX
- SUBQ $1, AX
-
- // XXX: MOVW AX, table-32768(SP)(R11*2)
- // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2)
- BYTE $0x66
- BYTE $0x42
- BYTE $0x89
- BYTE $0x44
- BYTE $0x5c
- BYTE $0x78
-
- // currHash := hash(uint32(x>>8), shift)
- SHRQ $8, R14
- MOVL R14, R11
- IMULL $0x1e35a7bd, R11
- SHRL CX, R11
-
- // candidate = int(table[currHash])
- // XXX: MOVWQZX table-32768(SP)(R11*2), R15
- // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15
- BYTE $0x4e
- BYTE $0x0f
- BYTE $0xb7
- BYTE $0x7c
- BYTE $0x5c
- BYTE $0x78
-
- // table[currHash] = uint16(s)
- ADDQ $1, AX
-
- // XXX: MOVW AX, table-32768(SP)(R11*2)
- // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2)
- BYTE $0x66
- BYTE $0x42
- BYTE $0x89
- BYTE $0x44
- BYTE $0x5c
- BYTE $0x78
-
- // if uint32(x>>8) == load32(src, candidate) { continue }
- MOVL (DX)(R15*1), BX
- CMPL R14, BX
- JEQ inner1
-
- // nextHash = hash(uint32(x>>16), shift)
- SHRQ $8, R14
- MOVL R14, R11
- IMULL $0x1e35a7bd, R11
- SHRL CX, R11
-
- // s++
- ADDQ $1, SI
-
- // break out of the inner1 for loop, i.e. continue the outer loop.
- JMP outer
-
-emitRemainder:
- // if nextEmit < len(src) { etc }
- MOVQ src_len+32(FP), AX
- ADDQ DX, AX
- CMPQ R10, AX
- JEQ encodeBlockEnd
-
- // d += emitLiteral(dst[d:], src[nextEmit:])
- //
- // Push args.
- MOVQ DI, 0(SP)
- MOVQ $0, 8(SP) // Unnecessary, as the callee ignores it, but conservative.
- MOVQ $0, 16(SP) // Unnecessary, as the callee ignores it, but conservative.
- MOVQ R10, 24(SP)
- SUBQ R10, AX
- MOVQ AX, 32(SP)
- MOVQ AX, 40(SP) // Unnecessary, as the callee ignores it, but conservative.
-
- // Spill local variables (registers) onto the stack; call; unspill.
- MOVQ DI, 80(SP)
- CALL ·emitLiteral(SB)
- MOVQ 80(SP), DI
-
- // Finish the "d +=" part of "d += emitLiteral(etc)".
- ADDQ 48(SP), DI
-
-encodeBlockEnd:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, DI
- MOVQ DI, d+48(FP)
- RET
diff --git a/vendor/github.com/klauspost/compress/snappy/encode_other.go b/vendor/github.com/klauspost/compress/snappy/encode_other.go
deleted file mode 100644
index dbcae905e..000000000
--- a/vendor/github.com/klauspost/compress/snappy/encode_other.go
+++ /dev/null
@@ -1,238 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !amd64 appengine !gc noasm
-
-package snappy
-
-func load32(b []byte, i int) uint32 {
- b = b[i : i+4 : len(b)] // Help the compiler eliminate bounds checks on the next line.
- return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
-}
-
-func load64(b []byte, i int) uint64 {
- b = b[i : i+8 : len(b)] // Help the compiler eliminate bounds checks on the next line.
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
-}
-
-// emitLiteral writes a literal chunk and returns the number of bytes written.
-//
-// It assumes that:
-// dst is long enough to hold the encoded bytes
-// 1 <= len(lit) && len(lit) <= 65536
-func emitLiteral(dst, lit []byte) int {
- i, n := 0, uint(len(lit)-1)
- switch {
- case n < 60:
- dst[0] = uint8(n)<<2 | tagLiteral
- i = 1
- case n < 1<<8:
- dst[0] = 60<<2 | tagLiteral
- dst[1] = uint8(n)
- i = 2
- default:
- dst[0] = 61<<2 | tagLiteral
- dst[1] = uint8(n)
- dst[2] = uint8(n >> 8)
- i = 3
- }
- return i + copy(dst[i:], lit)
-}
-
-// emitCopy writes a copy chunk and returns the number of bytes written.
-//
-// It assumes that:
-// dst is long enough to hold the encoded bytes
-// 1 <= offset && offset <= 65535
-// 4 <= length && length <= 65535
-func emitCopy(dst []byte, offset, length int) int {
- i := 0
- // The maximum length for a single tagCopy1 or tagCopy2 op is 64 bytes. The
- // threshold for this loop is a little higher (at 68 = 64 + 4), and the
- // length emitted down below is is a little lower (at 60 = 64 - 4), because
- // it's shorter to encode a length 67 copy as a length 60 tagCopy2 followed
- // by a length 7 tagCopy1 (which encodes as 3+2 bytes) than to encode it as
- // a length 64 tagCopy2 followed by a length 3 tagCopy2 (which encodes as
- // 3+3 bytes). The magic 4 in the 64±4 is because the minimum length for a
- // tagCopy1 op is 4 bytes, which is why a length 3 copy has to be an
- // encodes-as-3-bytes tagCopy2 instead of an encodes-as-2-bytes tagCopy1.
- for length >= 68 {
- // Emit a length 64 copy, encoded as 3 bytes.
- dst[i+0] = 63<<2 | tagCopy2
- dst[i+1] = uint8(offset)
- dst[i+2] = uint8(offset >> 8)
- i += 3
- length -= 64
- }
- if length > 64 {
- // Emit a length 60 copy, encoded as 3 bytes.
- dst[i+0] = 59<<2 | tagCopy2
- dst[i+1] = uint8(offset)
- dst[i+2] = uint8(offset >> 8)
- i += 3
- length -= 60
- }
- if length >= 12 || offset >= 2048 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[i+0] = uint8(length-1)<<2 | tagCopy2
- dst[i+1] = uint8(offset)
- dst[i+2] = uint8(offset >> 8)
- return i + 3
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[i+0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- dst[i+1] = uint8(offset)
- return i + 2
-}
-
-// extendMatch returns the largest k such that k <= len(src) and that
-// src[i:i+k-j] and src[j:k] have the same contents.
-//
-// It assumes that:
-// 0 <= i && i < j && j <= len(src)
-func extendMatch(src []byte, i, j int) int {
- for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 {
- }
- return j
-}
-
-func hash(u, shift uint32) uint32 {
- return (u * 0x1e35a7bd) >> shift
-}
-
-// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlock(dst, src []byte) (d int) {
- // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive.
- // The table element type is uint16, as s < sLimit and sLimit < len(src)
- // and len(src) <= maxBlockSize and maxBlockSize == 65536.
- const (
- maxTableSize = 1 << 14
- // tableMask is redundant, but helps the compiler eliminate bounds
- // checks.
- tableMask = maxTableSize - 1
- )
- shift := uint32(32 - 8)
- for tableSize := 1 << 8; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 {
- shift--
- }
- // In Go, all array elements are zero-initialized, so there is no advantage
- // to a smaller tableSize per se. However, it matches the C++ algorithm,
- // and in the asm versions of this code, we can get away with zeroing only
- // the first tableSize elements.
- var table [maxTableSize]uint16
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- nextHash := hash(load32(src, s), shift)
-
- for {
- // Copied from the C++ snappy implementation:
- //
- // Heuristic match skipping: If 32 bytes are scanned with no matches
- // found, start looking only at every other byte. If 32 more bytes are
- // scanned (or skipped), look at every third byte, etc.. When a match
- // is found, immediately go back to looking at every byte. This is a
- // small loss (~5% performance, ~0.1% density) for compressible data
- // due to more bookkeeping, but for non-compressible data (such as
- // JPEG) it's a huge win since the compressor quickly "realizes" the
- // data is incompressible and doesn't bother looking for matches
- // everywhere.
- //
- // The "skip" variable keeps track of how many bytes there are since
- // the last match; dividing it by 32 (ie. right-shifting by five) gives
- // the number of bytes to move ahead for each iteration.
- skip := 32
-
- nextS := s
- candidate := 0
- for {
- s = nextS
- bytesBetweenHashLookups := skip >> 5
- nextS = s + bytesBetweenHashLookups
- skip += bytesBetweenHashLookups
- if nextS > sLimit {
- goto emitRemainder
- }
- candidate = int(table[nextHash&tableMask])
- table[nextHash&tableMask] = uint16(s)
- nextHash = hash(load32(src, nextS), shift)
- if load32(src, s) == load32(src, candidate) {
- break
- }
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
- d += emitLiteral(dst[d:], src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
-
- // Extend the 4-byte match as long as possible.
- //
- // This is an inlined version of:
- // s = extendMatch(src, candidate+4, s+4)
- s += 4
- for i := candidate + 4; s < len(src) && src[i] == src[s]; i, s = i+1, s+1 {
- }
-
- d += emitCopy(dst[d:], base-candidate, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- // We could immediately start working at s now, but to improve
- // compression we first update the hash table at s-1 and at s. If
- // another emitCopy is not our next move, also calculate nextHash
- // at s+1. At least on GOARCH=amd64, these three hash calculations
- // are faster as one load64 call (with some shifts) instead of
- // three load32 calls.
- x := load64(src, s-1)
- prevHash := hash(uint32(x>>0), shift)
- table[prevHash&tableMask] = uint16(s - 1)
- currHash := hash(uint32(x>>8), shift)
- candidate = int(table[currHash&tableMask])
- table[currHash&tableMask] = uint16(s)
- if uint32(x>>8) != load32(src, candidate) {
- nextHash = hash(uint32(x>>16), shift)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
diff --git a/vendor/github.com/klauspost/compress/snappy/runbench.cmd b/vendor/github.com/klauspost/compress/snappy/runbench.cmd
deleted file mode 100644
index d24eb4b47..000000000
--- a/vendor/github.com/klauspost/compress/snappy/runbench.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-del old.txt
-go test -bench=. >>old.txt && go test -bench=. >>old.txt && go test -bench=. >>old.txt && benchstat -delta-test=ttest old.txt new.txt
diff --git a/vendor/github.com/klauspost/compress/snappy/snappy.go b/vendor/github.com/klauspost/compress/snappy/snappy.go
deleted file mode 100644
index 74a36689e..000000000
--- a/vendor/github.com/klauspost/compress/snappy/snappy.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package snappy implements the Snappy compression format. It aims for very
-// high speeds and reasonable compression.
-//
-// There are actually two Snappy formats: block and stream. They are related,
-// but different: trying to decompress block-compressed data as a Snappy stream
-// will fail, and vice versa. The block format is the Decode and Encode
-// functions and the stream format is the Reader and Writer types.
-//
-// The block format, the more common case, is used when the complete size (the
-// number of bytes) of the original data is known upfront, at the time
-// compression starts. The stream format, also known as the framing format, is
-// for when that isn't always true.
-//
-// The canonical, C++ implementation is at https://github.com/google/snappy and
-// it only implements the block format.
-package snappy
-
-import (
- "hash/crc32"
-)
-
-/*
-Each encoded block begins with the varint-encoded length of the decoded data,
-followed by a sequence of chunks. Chunks begin and end on byte boundaries. The
-first byte of each chunk is broken into its 2 least and 6 most significant bits
-called l and m: l ranges in [0, 4) and m ranges in [0, 64). l is the chunk tag.
-Zero means a literal tag. All other values mean a copy tag.
-
-For literal tags:
- - If m < 60, the next 1 + m bytes are literal bytes.
- - Otherwise, let n be the little-endian unsigned integer denoted by the next
- m - 59 bytes. The next 1 + n bytes after that are literal bytes.
-
-For copy tags, length bytes are copied from offset bytes ago, in the style of
-Lempel-Ziv compression algorithms. In particular:
- - For l == 1, the offset ranges in [0, 1<<11) and the length in [4, 12).
- The length is 4 + the low 3 bits of m. The high 3 bits of m form bits 8-10
- of the offset. The next byte is bits 0-7 of the offset.
- - For l == 2, the offset ranges in [0, 1<<16) and the length in [1, 65).
- The length is 1 + m. The offset is the little-endian unsigned integer
- denoted by the next 2 bytes.
- - For l == 3, this tag is a legacy format that is no longer issued by most
- encoders. Nonetheless, the offset ranges in [0, 1<<32) and the length in
- [1, 65). The length is 1 + m. The offset is the little-endian unsigned
- integer denoted by the next 4 bytes.
-*/
-const (
- tagLiteral = 0x00
- tagCopy1 = 0x01
- tagCopy2 = 0x02
- tagCopy4 = 0x03
-)
-
-const (
- checksumSize = 4
- chunkHeaderSize = 4
- magicChunk = "\xff\x06\x00\x00" + magicBody
- magicBody = "sNaPpY"
-
- // maxBlockSize is the maximum size of the input to encodeBlock. It is not
- // part of the wire format per se, but some parts of the encoder assume
- // that an offset fits into a uint16.
- //
- // Also, for the framing format (Writer type instead of Encode function),
- // https://github.com/google/snappy/blob/master/framing_format.txt says
- // that "the uncompressed data in a chunk must be no longer than 65536
- // bytes".
- maxBlockSize = 65536
-
- // maxEncodedLenOfMaxBlockSize equals MaxEncodedLen(maxBlockSize), but is
- // hard coded to be a const instead of a variable, so that obufLen can also
- // be a const. Their equivalence is confirmed by
- // TestMaxEncodedLenOfMaxBlockSize.
- maxEncodedLenOfMaxBlockSize = 76490
-
- obufHeaderLen = len(magicChunk) + checksumSize + chunkHeaderSize
- obufLen = obufHeaderLen + maxEncodedLenOfMaxBlockSize
-)
-
-const (
- chunkTypeCompressedData = 0x00
- chunkTypeUncompressedData = 0x01
- chunkTypePadding = 0xfe
- chunkTypeStreamIdentifier = 0xff
-)
-
-var crcTable = crc32.MakeTable(crc32.Castagnoli)
-
-// crc implements the checksum specified in section 3 of
-// https://github.com/google/snappy/blob/master/framing_format.txt
-func crc(b []byte) uint32 {
- c := crc32.Update(0, crcTable, b)
- return uint32(c>>15|c<<17) + 0xa282ead8
-}
diff --git a/vendor/github.com/klauspost/compress/zstd/blockenc.go b/vendor/github.com/klauspost/compress/zstd/blockenc.go
index c85c40255..e1be092f3 100644
--- a/vendor/github.com/klauspost/compress/zstd/blockenc.go
+++ b/vendor/github.com/klauspost/compress/zstd/blockenc.go
@@ -22,28 +22,44 @@ type blockEnc struct {
dictLitEnc *huff0.Scratch
wr bitWriter
- extraLits int
- last bool
-
+ extraLits int
output []byte
recentOffsets [3]uint32
prevRecentOffsets [3]uint32
+
+ last bool
+ lowMem bool
}
// init should be used once the block has been created.
// If called more than once, the effect is the same as calling reset.
func (b *blockEnc) init() {
- if cap(b.literals) < maxCompressedLiteralSize {
- b.literals = make([]byte, 0, maxCompressedLiteralSize)
- }
- const defSeqs = 200
- b.literals = b.literals[:0]
- if cap(b.sequences) < defSeqs {
- b.sequences = make([]seq, 0, defSeqs)
- }
- if cap(b.output) < maxCompressedBlockSize {
- b.output = make([]byte, 0, maxCompressedBlockSize)
+ if b.lowMem {
+ // 1K literals
+ if cap(b.literals) < 1<<10 {
+ b.literals = make([]byte, 0, 1<<10)
+ }
+ const defSeqs = 20
+ if cap(b.sequences) < defSeqs {
+ b.sequences = make([]seq, 0, defSeqs)
+ }
+ // 1K
+ if cap(b.output) < 1<<10 {
+ b.output = make([]byte, 0, 1<<10)
+ }
+ } else {
+ if cap(b.literals) < maxCompressedBlockSize {
+ b.literals = make([]byte, 0, maxCompressedBlockSize)
+ }
+ const defSeqs = 200
+ if cap(b.sequences) < defSeqs {
+ b.sequences = make([]seq, 0, defSeqs)
+ }
+ if cap(b.output) < maxCompressedBlockSize {
+ b.output = make([]byte, 0, maxCompressedBlockSize)
+ }
}
+
if b.coders.mlEnc == nil {
b.coders.mlEnc = &fseEncoder{}
b.coders.mlPrev = &fseEncoder{}
@@ -370,9 +386,9 @@ func (b *blockEnc) encodeLits(lits []byte, raw bool) error {
b.output = bh.appendTo(b.output)
b.output = append(b.output, lits[0])
return nil
+ case nil:
default:
return err
- case nil:
}
// Compressed...
// Now, allow reuse
@@ -512,11 +528,6 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
if debug {
println("Adding literals RLE")
}
- default:
- if debug {
- println("Adding literals ERROR:", err)
- }
- return err
case nil:
// Compressed litLen...
if reUsed {
@@ -547,6 +558,11 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
if debug {
println("Adding literals compressed")
}
+ default:
+ if debug {
+ println("Adding literals ERROR:", err)
+ }
+ return err
}
// Sequence compression
diff --git a/vendor/github.com/klauspost/compress/zstd/decodeheader.go b/vendor/github.com/klauspost/compress/zstd/decodeheader.go
index 87896c5ea..69736e8d4 100644
--- a/vendor/github.com/klauspost/compress/zstd/decodeheader.go
+++ b/vendor/github.com/klauspost/compress/zstd/decodeheader.go
@@ -93,7 +93,7 @@ func (h *Header) Decode(in []byte) error {
h.HasCheckSum = fhd&(1<<2) != 0
if fhd&(1<<3) != 0 {
- return errors.New("Reserved bit set on frame header")
+ return errors.New("reserved bit set on frame header")
}
// Read Window_Descriptor
@@ -174,7 +174,7 @@ func (h *Header) Decode(in []byte) error {
if len(in) < 3 {
return nil
}
- tmp, in := in[:3], in[3:]
+ tmp := in[:3]
bh := uint32(tmp[0]) | (uint32(tmp[1]) << 8) | (uint32(tmp[2]) << 16)
h.FirstBlock.Last = bh&1 != 0
blockType := blockType((bh >> 1) & 3)
diff --git a/vendor/github.com/klauspost/compress/zstd/decoder.go b/vendor/github.com/klauspost/compress/zstd/decoder.go
index 1d41c25d2..f593e464b 100644
--- a/vendor/github.com/klauspost/compress/zstd/decoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/decoder.go
@@ -179,8 +179,7 @@ func (d *Decoder) Reset(r io.Reader) error {
// If bytes buffer and < 1MB, do sync decoding anyway.
if bb, ok := r.(byter); ok && bb.Len() < 1<<20 {
- var bb2 byter
- bb2 = bb
+ bb2 := bb
if debug {
println("*bytes.Buffer detected, doing sync decode, len:", bb.Len())
}
@@ -237,20 +236,17 @@ func (d *Decoder) drainOutput() {
println("current already flushed")
return
}
- for {
- select {
- case v := <-d.current.output:
- if v.d != nil {
- if debug {
- printf("re-adding decoder %p", v.d)
- }
- d.decoders <- v.d
- }
- if v.err == errEndOfStream {
- println("current flushed")
- d.current.flushed = true
- return
+ for v := range d.current.output {
+ if v.d != nil {
+ if debug {
+ printf("re-adding decoder %p", v.d)
}
+ d.decoders <- v.d
+ }
+ if v.err == errEndOfStream {
+ println("current flushed")
+ d.current.flushed = true
+ return
}
}
}
diff --git a/vendor/github.com/klauspost/compress/zstd/decoder_options.go b/vendor/github.com/klauspost/compress/zstd/decoder_options.go
index 284d38449..c0fd058c2 100644
--- a/vendor/github.com/klauspost/compress/zstd/decoder_options.go
+++ b/vendor/github.com/klauspost/compress/zstd/decoder_options.go
@@ -6,7 +6,6 @@ package zstd
import (
"errors"
- "fmt"
"runtime"
)
@@ -43,7 +42,7 @@ func WithDecoderLowmem(b bool) DOption {
func WithDecoderConcurrency(n int) DOption {
return func(o *decoderOptions) error {
if n <= 0 {
- return fmt.Errorf("Concurrency must be at least 1")
+ return errors.New("concurrency must be at least 1")
}
o.concurrent = n
return nil
@@ -61,7 +60,7 @@ func WithDecoderMaxMemory(n uint64) DOption {
return errors.New("WithDecoderMaxMemory must be at least 1")
}
if n > 1<<63 {
- return fmt.Errorf("WithDecoderMaxmemory must be less than 1 << 63")
+ return errors.New("WithDecoderMaxmemory must be less than 1 << 63")
}
o.maxDecodedSize = n
return nil
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_base.go b/vendor/github.com/klauspost/compress/zstd/enc_base.go
index b1b7c6e6a..60f298648 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_base.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_base.go
@@ -7,6 +7,10 @@ import (
"github.com/klauspost/compress/zstd/internal/xxhash"
)
+const (
+ dictShardBits = 6
+)
+
type fastBase struct {
// cur is the offset at the start of hist
cur int32
@@ -17,6 +21,7 @@ type fastBase struct {
tmp [8]byte
blk *blockEnc
lastDictID uint32
+ lowMem bool
}
// CRC returns the underlying CRC writer.
@@ -57,15 +62,10 @@ func (e *fastBase) addBlock(src []byte) int32 {
// check if we have space already
if len(e.hist)+len(src) > cap(e.hist) {
if cap(e.hist) == 0 {
- l := e.maxMatchOff * 2
- // Make it at least 1MB.
- if l < 1<<20 {
- l = 1 << 20
- }
- e.hist = make([]byte, 0, l)
+ e.ensureHist(len(src))
} else {
- if cap(e.hist) < int(e.maxMatchOff*2) {
- panic("unexpected buffer size")
+ if cap(e.hist) < int(e.maxMatchOff+maxCompressedBlockSize) {
+ panic(fmt.Errorf("unexpected buffer cap %d, want at least %d with window %d", cap(e.hist), e.maxMatchOff+maxCompressedBlockSize, e.maxMatchOff))
}
// Move down
offset := int32(len(e.hist)) - e.maxMatchOff
@@ -79,6 +79,28 @@ func (e *fastBase) addBlock(src []byte) int32 {
return s
}
+// ensureHist will ensure that history can keep at least this many bytes.
+func (e *fastBase) ensureHist(n int) {
+ if cap(e.hist) >= n {
+ return
+ }
+ l := e.maxMatchOff
+ if (e.lowMem && e.maxMatchOff > maxCompressedBlockSize) || e.maxMatchOff <= maxCompressedBlockSize {
+ l += maxCompressedBlockSize
+ } else {
+ l += e.maxMatchOff
+ }
+ // Make it at least 1MB.
+ if l < 1<<20 && !e.lowMem {
+ l = 1 << 20
+ }
+ // Make it at least the requested size.
+ if l < int32(n) {
+ l = int32(n)
+ }
+ e.hist = make([]byte, 0, l)
+}
+
// useBlock will replace the block with the provided one,
// but transfer recent offsets from the previous.
func (e *fastBase) UseBlock(enc *blockEnc) {
@@ -117,7 +139,7 @@ func (e *fastBase) matchlen(s, t int32, src []byte) int32 {
// Reset the encoding table.
func (e *fastBase) resetBase(d *dict, singleBlock bool) {
if e.blk == nil {
- e.blk = &blockEnc{}
+ e.blk = &blockEnc{lowMem: e.lowMem}
e.blk.init()
} else {
e.blk.reset(nil)
@@ -128,14 +150,15 @@ func (e *fastBase) resetBase(d *dict, singleBlock bool) {
} else {
e.crc.Reset()
}
- if (!singleBlock || d.DictContentSize() > 0) && cap(e.hist) < int(e.maxMatchOff*2)+d.DictContentSize() {
- l := e.maxMatchOff*2 + int32(d.DictContentSize())
- // Make it at least 1MB.
- if l < 1<<20 {
- l = 1 << 20
+ if d != nil {
+ low := e.lowMem
+ if singleBlock {
+ e.lowMem = true
}
- e.hist = make([]byte, 0, l)
+ e.ensureHist(d.DictContentSize() + maxCompressedBlockSize)
+ e.lowMem = low
}
+
// We offset current position so everything will be out of reach.
// If above reset line, history will be purged.
if e.cur < bufferReset {
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_best.go b/vendor/github.com/klauspost/compress/zstd/enc_best.go
index bb71d1eea..fe3625c5f 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_best.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_best.go
@@ -407,6 +407,7 @@ encodeLoop:
// Most notable difference is that src will not be copied for history and
// we do not need to check for max match length.
func (e *bestFastEncoder) EncodeNoHist(blk *blockEnc, src []byte) {
+ e.ensureHist(len(src))
e.Encode(blk, src)
}
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_better.go b/vendor/github.com/klauspost/compress/zstd/enc_better.go
index 94a5343d0..c2ce4a2ba 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_better.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_better.go
@@ -16,6 +16,12 @@ const (
// This greatly depends on the type of input.
betterShortTableBits = 13 // Bits used in the short match table
betterShortTableSize = 1 << betterShortTableBits // Size of the table
+
+ betterLongTableShardCnt = 1 << (betterLongTableBits - dictShardBits) // Number of shards in the table
+ betterLongTableShardSize = betterLongTableSize / betterLongTableShardCnt // Size of an individual shard
+
+ betterShortTableShardCnt = 1 << (betterShortTableBits - dictShardBits) // Number of shards in the table
+ betterShortTableShardSize = betterShortTableSize / betterShortTableShardCnt // Size of an individual shard
)
type prevEntry struct {
@@ -31,10 +37,17 @@ type prevEntry struct {
// and that it is longer (lazy matching).
type betterFastEncoder struct {
fastBase
- table [betterShortTableSize]tableEntry
- longTable [betterLongTableSize]prevEntry
- dictTable []tableEntry
- dictLongTable []prevEntry
+ table [betterShortTableSize]tableEntry
+ longTable [betterLongTableSize]prevEntry
+}
+
+type betterFastEncoderDict struct {
+ betterFastEncoder
+ dictTable []tableEntry
+ dictLongTable []prevEntry
+ shortTableShardDirty [betterShortTableShardCnt]bool
+ longTableShardDirty [betterLongTableShardCnt]bool
+ allDirty bool
}
// Encode improves compression...
@@ -516,11 +529,511 @@ encodeLoop:
// Most notable difference is that src will not be copied for history and
// we do not need to check for max match length.
func (e *betterFastEncoder) EncodeNoHist(blk *blockEnc, src []byte) {
+ e.ensureHist(len(src))
e.Encode(blk, src)
}
+// Encode improves compression...
+func (e *betterFastEncoderDict) Encode(blk *blockEnc, src []byte) {
+ const (
+ // Input margin is the number of bytes we read (8)
+ // and the maximum we will read ahead (2)
+ inputMargin = 8 + 2
+ minNonLiteralBlockSize = 16
+ )
+
+ // Protect against e.cur wraparound.
+ for e.cur >= bufferReset {
+ if len(e.hist) == 0 {
+ for i := range e.table[:] {
+ e.table[i] = tableEntry{}
+ }
+ for i := range e.longTable[:] {
+ e.longTable[i] = prevEntry{}
+ }
+ e.cur = e.maxMatchOff
+ e.allDirty = true
+ break
+ }
+ // Shift down everything in the table that isn't already too far away.
+ minOff := e.cur + int32(len(e.hist)) - e.maxMatchOff
+ for i := range e.table[:] {
+ v := e.table[i].offset
+ if v < minOff {
+ v = 0
+ } else {
+ v = v - e.cur + e.maxMatchOff
+ }
+ e.table[i].offset = v
+ }
+ for i := range e.longTable[:] {
+ v := e.longTable[i].offset
+ v2 := e.longTable[i].prev
+ if v < minOff {
+ v = 0
+ v2 = 0
+ } else {
+ v = v - e.cur + e.maxMatchOff
+ if v2 < minOff {
+ v2 = 0
+ } else {
+ v2 = v2 - e.cur + e.maxMatchOff
+ }
+ }
+ e.longTable[i] = prevEntry{
+ offset: v,
+ prev: v2,
+ }
+ }
+ e.allDirty = true
+ e.cur = e.maxMatchOff
+ break
+ }
+
+ s := e.addBlock(src)
+ blk.size = len(src)
+ if len(src) < minNonLiteralBlockSize {
+ blk.extraLits = len(src)
+ blk.literals = blk.literals[:len(src)]
+ copy(blk.literals, src)
+ return
+ }
+
+ // Override src
+ src = e.hist
+ sLimit := int32(len(src)) - inputMargin
+ // stepSize is the number of bytes to skip on every main loop iteration.
+ // It should be >= 1.
+ const stepSize = 1
+
+ const kSearchStrength = 9
+
+ // nextEmit is where in src the next emitLiteral should start from.
+ nextEmit := s
+ cv := load6432(src, s)
+
+ // Relative offsets
+ offset1 := int32(blk.recentOffsets[0])
+ offset2 := int32(blk.recentOffsets[1])
+
+ addLiterals := func(s *seq, until int32) {
+ if until == nextEmit {
+ return
+ }
+ blk.literals = append(blk.literals, src[nextEmit:until]...)
+ s.litLen = uint32(until - nextEmit)
+ }
+ if debug {
+ println("recent offsets:", blk.recentOffsets)
+ }
+
+encodeLoop:
+ for {
+ var t int32
+ // We allow the encoder to optionally turn off repeat offsets across blocks
+ canRepeat := len(blk.sequences) > 2
+ var matched int32
+
+ for {
+ if debugAsserts && canRepeat && offset1 == 0 {
+ panic("offset0 was 0")
+ }
+
+ nextHashS := hash5(cv, betterShortTableBits)
+ nextHashL := hash8(cv, betterLongTableBits)
+ candidateL := e.longTable[nextHashL]
+ candidateS := e.table[nextHashS]
+
+ const repOff = 1
+ repIndex := s - offset1 + repOff
+ off := s + e.cur
+ e.longTable[nextHashL] = prevEntry{offset: off, prev: candidateL.offset}
+ e.markLongShardDirty(nextHashL)
+ e.table[nextHashS] = tableEntry{offset: off, val: uint32(cv)}
+ e.markShortShardDirty(nextHashS)
+
+ if canRepeat {
+ if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) {
+ // Consider history as well.
+ var seq seq
+ lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src)
+
+ seq.matchLen = uint32(lenght - zstdMinMatch)
+
+ // We might be able to match backwards.
+ // Extend as long as we can.
+ start := s + repOff
+ // We end the search early, so we don't risk 0 literals
+ // and have to do special offset treatment.
+ startLimit := nextEmit + 1
+
+ tMin := s - e.maxMatchOff
+ if tMin < 0 {
+ tMin = 0
+ }
+ for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 {
+ repIndex--
+ start--
+ seq.matchLen++
+ }
+ addLiterals(&seq, start)
+
+ // rep 0
+ seq.offset = 1
+ if debugSequences {
+ println("repeat sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+
+ // Index match start+1 (long) -> s - 1
+ index0 := s + repOff
+ s += lenght + repOff
+
+ nextEmit = s
+ if s >= sLimit {
+ if debug {
+ println("repeat ended", s, lenght)
+
+ }
+ break encodeLoop
+ }
+ // Index skipped...
+ for index0 < s-1 {
+ cv0 := load6432(src, index0)
+ cv1 := cv0 >> 8
+ h0 := hash8(cv0, betterLongTableBits)
+ off := index0 + e.cur
+ e.longTable[h0] = prevEntry{offset: off, prev: e.longTable[h0].offset}
+ e.markLongShardDirty(h0)
+ h1 := hash5(cv1, betterShortTableBits)
+ e.table[h1] = tableEntry{offset: off + 1, val: uint32(cv1)}
+ e.markShortShardDirty(h1)
+ index0 += 2
+ }
+ cv = load6432(src, s)
+ continue
+ }
+ const repOff2 = 1
+
+ // We deviate from the reference encoder and also check offset 2.
+ // Still slower and not much better, so disabled.
+ // repIndex = s - offset2 + repOff2
+ if false && repIndex >= 0 && load6432(src, repIndex) == load6432(src, s+repOff) {
+ // Consider history as well.
+ var seq seq
+ lenght := 8 + e.matchlen(s+8+repOff2, repIndex+8, src)
+
+ seq.matchLen = uint32(lenght - zstdMinMatch)
+
+ // We might be able to match backwards.
+ // Extend as long as we can.
+ start := s + repOff2
+ // We end the search early, so we don't risk 0 literals
+ // and have to do special offset treatment.
+ startLimit := nextEmit + 1
+
+ tMin := s - e.maxMatchOff
+ if tMin < 0 {
+ tMin = 0
+ }
+ for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 {
+ repIndex--
+ start--
+ seq.matchLen++
+ }
+ addLiterals(&seq, start)
+
+ // rep 2
+ seq.offset = 2
+ if debugSequences {
+ println("repeat sequence 2", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+
+ index0 := s + repOff2
+ s += lenght + repOff2
+ nextEmit = s
+ if s >= sLimit {
+ if debug {
+ println("repeat ended", s, lenght)
+
+ }
+ break encodeLoop
+ }
+
+ // Index skipped...
+ for index0 < s-1 {
+ cv0 := load6432(src, index0)
+ cv1 := cv0 >> 8
+ h0 := hash8(cv0, betterLongTableBits)
+ off := index0 + e.cur
+ e.longTable[h0] = prevEntry{offset: off, prev: e.longTable[h0].offset}
+ e.markLongShardDirty(h0)
+ h1 := hash5(cv1, betterShortTableBits)
+ e.table[h1] = tableEntry{offset: off + 1, val: uint32(cv1)}
+ e.markShortShardDirty(h1)
+ index0 += 2
+ }
+ cv = load6432(src, s)
+ // Swap offsets
+ offset1, offset2 = offset2, offset1
+ continue
+ }
+ }
+ // Find the offsets of our two matches.
+ coffsetL := candidateL.offset - e.cur
+ coffsetLP := candidateL.prev - e.cur
+
+ // Check if we have a long match.
+ if s-coffsetL < e.maxMatchOff && cv == load6432(src, coffsetL) {
+ // Found a long match, at least 8 bytes.
+ matched = e.matchlen(s+8, coffsetL+8, src) + 8
+ t = coffsetL
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugMatches {
+ println("long match")
+ }
+
+ if s-coffsetLP < e.maxMatchOff && cv == load6432(src, coffsetLP) {
+ // Found a long match, at least 8 bytes.
+ prevMatch := e.matchlen(s+8, coffsetLP+8, src) + 8
+ if prevMatch > matched {
+ matched = prevMatch
+ t = coffsetLP
+ }
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugMatches {
+ println("long match")
+ }
+ }
+ break
+ }
+
+ // Check if we have a long match on prev.
+ if s-coffsetLP < e.maxMatchOff && cv == load6432(src, coffsetLP) {
+ // Found a long match, at least 8 bytes.
+ matched = e.matchlen(s+8, coffsetLP+8, src) + 8
+ t = coffsetLP
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugMatches {
+ println("long match")
+ }
+ break
+ }
+
+ coffsetS := candidateS.offset - e.cur
+
+ // Check if we have a short match.
+ if s-coffsetS < e.maxMatchOff && uint32(cv) == candidateS.val {
+ // found a regular match
+ matched = e.matchlen(s+4, coffsetS+4, src) + 4
+
+ // See if we can find a long match at s+1
+ const checkAt = 1
+ cv := load6432(src, s+checkAt)
+ nextHashL = hash8(cv, betterLongTableBits)
+ candidateL = e.longTable[nextHashL]
+ coffsetL = candidateL.offset - e.cur
+
+ // We can store it, since we have at least a 4 byte match.
+ e.longTable[nextHashL] = prevEntry{offset: s + checkAt + e.cur, prev: candidateL.offset}
+ e.markLongShardDirty(nextHashL)
+ if s-coffsetL < e.maxMatchOff && cv == load6432(src, coffsetL) {
+ // Found a long match, at least 8 bytes.
+ matchedNext := e.matchlen(s+8+checkAt, coffsetL+8, src) + 8
+ if matchedNext > matched {
+ t = coffsetL
+ s += checkAt
+ matched = matchedNext
+ if debugMatches {
+ println("long match (after short)")
+ }
+ break
+ }
+ }
+
+ // Check prev long...
+ coffsetL = candidateL.prev - e.cur
+ if s-coffsetL < e.maxMatchOff && cv == load6432(src, coffsetL) {
+ // Found a long match, at least 8 bytes.
+ matchedNext := e.matchlen(s+8+checkAt, coffsetL+8, src) + 8
+ if matchedNext > matched {
+ t = coffsetL
+ s += checkAt
+ matched = matchedNext
+ if debugMatches {
+ println("prev long match (after short)")
+ }
+ break
+ }
+ }
+ t = coffsetS
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugAsserts && t < 0 {
+ panic("t<0")
+ }
+ if debugMatches {
+ println("short match")
+ }
+ break
+ }
+
+ // No match found, move forward in input.
+ s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1))
+ if s >= sLimit {
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ }
+
+ // A 4-byte match has been found. Update recent offsets.
+ // We'll later see if more than 4 bytes.
+ offset2 = offset1
+ offset1 = s - t
+
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+
+ if debugAsserts && canRepeat && int(offset1) > len(src) {
+ panic("invalid offset")
+ }
+
+ // Extend the n-byte match as long as possible.
+ l := matched
+
+ // Extend backwards
+ tMin := s - e.maxMatchOff
+ if tMin < 0 {
+ tMin = 0
+ }
+ for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength {
+ s--
+ t--
+ l++
+ }
+
+ // Write our sequence
+ var seq seq
+ seq.litLen = uint32(s - nextEmit)
+ seq.matchLen = uint32(l - zstdMinMatch)
+ if seq.litLen > 0 {
+ blk.literals = append(blk.literals, src[nextEmit:s]...)
+ }
+ seq.offset = uint32(s-t) + 3
+ s += l
+ if debugSequences {
+ println("sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+ nextEmit = s
+ if s >= sLimit {
+ break encodeLoop
+ }
+
+ // Index match start+1 (long) -> s - 1
+ index0 := s - l + 1
+ for index0 < s-1 {
+ cv0 := load6432(src, index0)
+ cv1 := cv0 >> 8
+ h0 := hash8(cv0, betterLongTableBits)
+ off := index0 + e.cur
+ e.longTable[h0] = prevEntry{offset: off, prev: e.longTable[h0].offset}
+ e.markLongShardDirty(h0)
+ h1 := hash5(cv1, betterShortTableBits)
+ e.table[h1] = tableEntry{offset: off + 1, val: uint32(cv1)}
+ e.markShortShardDirty(h1)
+ index0 += 2
+ }
+
+ cv = load6432(src, s)
+ if !canRepeat {
+ continue
+ }
+
+ // Check offset 2
+ for {
+ o2 := s - offset2
+ if load3232(src, o2) != uint32(cv) {
+ // Do regular search
+ break
+ }
+
+ // Store this, since we have it.
+ nextHashS := hash5(cv, betterShortTableBits)
+ nextHashL := hash8(cv, betterLongTableBits)
+
+ // We have at least 4 byte match.
+ // No need to check backwards. We come straight from a match
+ l := 4 + e.matchlen(s+4, o2+4, src)
+
+ e.longTable[nextHashL] = prevEntry{offset: s + e.cur, prev: e.longTable[nextHashL].offset}
+ e.markLongShardDirty(nextHashL)
+ e.table[nextHashS] = tableEntry{offset: s + e.cur, val: uint32(cv)}
+ e.markShortShardDirty(nextHashS)
+ seq.matchLen = uint32(l) - zstdMinMatch
+ seq.litLen = 0
+
+ // Since litlen is always 0, this is offset 1.
+ seq.offset = 1
+ s += l
+ nextEmit = s
+ if debugSequences {
+ println("sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+
+ // Swap offset 1 and 2.
+ offset1, offset2 = offset2, offset1
+ if s >= sLimit {
+ // Finished
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ }
+ }
+
+ if int(nextEmit) < len(src) {
+ blk.literals = append(blk.literals, src[nextEmit:]...)
+ blk.extraLits = len(src) - int(nextEmit)
+ }
+ blk.recentOffsets[0] = uint32(offset1)
+ blk.recentOffsets[1] = uint32(offset2)
+ if debug {
+ println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
+ }
+}
+
// ResetDict will reset and set a dictionary if not nil
func (e *betterFastEncoder) Reset(d *dict, singleBlock bool) {
+ e.resetBase(d, singleBlock)
+ if d != nil {
+ panic("betterFastEncoder: Reset with dict")
+ }
+}
+
+// ResetDict will reset and set a dictionary if not nil
+func (e *betterFastEncoderDict) Reset(d *dict, singleBlock bool) {
e.resetBase(d, singleBlock)
if d == nil {
return
@@ -557,6 +1070,7 @@ func (e *betterFastEncoder) Reset(d *dict, singleBlock bool) {
}
}
e.lastDictID = d.id
+ e.allDirty = true
}
// Init or copy dict table
@@ -585,11 +1099,72 @@ func (e *betterFastEncoder) Reset(d *dict, singleBlock bool) {
}
}
e.lastDictID = d.id
+ e.allDirty = true
}
- // Reset table to initial state
- copy(e.longTable[:], e.dictLongTable)
- e.cur = e.maxMatchOff
// Reset table to initial state
- copy(e.table[:], e.dictTable)
+ {
+ dirtyShardCnt := 0
+ if !e.allDirty {
+ for i := range e.shortTableShardDirty {
+ if e.shortTableShardDirty[i] {
+ dirtyShardCnt++
+ }
+ }
+ }
+ const shardCnt = betterShortTableShardCnt
+ const shardSize = betterShortTableShardSize
+ if e.allDirty || dirtyShardCnt > shardCnt*4/6 {
+ copy(e.table[:], e.dictTable)
+ for i := range e.shortTableShardDirty {
+ e.shortTableShardDirty[i] = false
+ }
+ } else {
+ for i := range e.shortTableShardDirty {
+ if !e.shortTableShardDirty[i] {
+ continue
+ }
+
+ copy(e.table[i*shardSize:(i+1)*shardSize], e.dictTable[i*shardSize:(i+1)*shardSize])
+ e.shortTableShardDirty[i] = false
+ }
+ }
+ }
+ {
+ dirtyShardCnt := 0
+ if !e.allDirty {
+ for i := range e.shortTableShardDirty {
+ if e.shortTableShardDirty[i] {
+ dirtyShardCnt++
+ }
+ }
+ }
+ const shardCnt = betterLongTableShardCnt
+ const shardSize = betterLongTableShardSize
+ if e.allDirty || dirtyShardCnt > shardCnt*4/6 {
+ copy(e.longTable[:], e.dictLongTable)
+ for i := range e.longTableShardDirty {
+ e.longTableShardDirty[i] = false
+ }
+ } else {
+ for i := range e.longTableShardDirty {
+ if !e.longTableShardDirty[i] {
+ continue
+ }
+
+ copy(e.longTable[i*shardSize:(i+1)*shardSize], e.dictLongTable[i*shardSize:(i+1)*shardSize])
+ e.longTableShardDirty[i] = false
+ }
+ }
+ }
+ e.cur = e.maxMatchOff
+ e.allDirty = false
+}
+
+func (e *betterFastEncoderDict) markLongShardDirty(entryNum uint32) {
+ e.longTableShardDirty[entryNum/betterLongTableShardSize] = true
+}
+
+func (e *betterFastEncoderDict) markShortShardDirty(entryNum uint32) {
+ e.shortTableShardDirty[entryNum/betterShortTableShardSize] = true
}
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go
index 19eebf66e..8629d43d8 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_dfast.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_dfast.go
@@ -11,6 +11,9 @@ const (
dFastLongTableSize = 1 << dFastLongTableBits // Size of the table
dFastLongTableMask = dFastLongTableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks.
+ dLongTableShardCnt = 1 << (dFastLongTableBits - dictShardBits) // Number of shards in the table
+ dLongTableShardSize = dFastLongTableSize / tableShardCnt // Size of an individual shard
+
dFastShortTableBits = tableBits // Bits used in the short match table
dFastShortTableSize = 1 << dFastShortTableBits // Size of the table
dFastShortTableMask = dFastShortTableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks.
@@ -18,8 +21,14 @@ const (
type doubleFastEncoder struct {
fastEncoder
- longTable [dFastLongTableSize]tableEntry
- dictLongTable []tableEntry
+ longTable [dFastLongTableSize]tableEntry
+}
+
+type doubleFastEncoderDict struct {
+ fastEncoderDict
+ longTable [dFastLongTableSize]tableEntry
+ dictLongTable []tableEntry
+ longTableShardDirty [dLongTableShardCnt]bool
}
// Encode mimmics functionality in zstd_dfast.c
@@ -678,9 +687,379 @@ encodeLoop:
}
}
+// Encode will encode the content, with a dictionary if initialized for it.
+func (e *doubleFastEncoderDict) Encode(blk *blockEnc, src []byte) {
+ const (
+ // Input margin is the number of bytes we read (8)
+ // and the maximum we will read ahead (2)
+ inputMargin = 8 + 2
+ minNonLiteralBlockSize = 16
+ )
+
+ // Protect against e.cur wraparound.
+ for e.cur >= bufferReset {
+ if len(e.hist) == 0 {
+ for i := range e.table[:] {
+ e.table[i] = tableEntry{}
+ }
+ for i := range e.longTable[:] {
+ e.longTable[i] = tableEntry{}
+ }
+ e.markAllShardsDirty()
+ e.cur = e.maxMatchOff
+ break
+ }
+ // Shift down everything in the table that isn't already too far away.
+ minOff := e.cur + int32(len(e.hist)) - e.maxMatchOff
+ for i := range e.table[:] {
+ v := e.table[i].offset
+ if v < minOff {
+ v = 0
+ } else {
+ v = v - e.cur + e.maxMatchOff
+ }
+ e.table[i].offset = v
+ }
+ for i := range e.longTable[:] {
+ v := e.longTable[i].offset
+ if v < minOff {
+ v = 0
+ } else {
+ v = v - e.cur + e.maxMatchOff
+ }
+ e.longTable[i].offset = v
+ }
+ e.markAllShardsDirty()
+ e.cur = e.maxMatchOff
+ break
+ }
+
+ s := e.addBlock(src)
+ blk.size = len(src)
+ if len(src) < minNonLiteralBlockSize {
+ blk.extraLits = len(src)
+ blk.literals = blk.literals[:len(src)]
+ copy(blk.literals, src)
+ return
+ }
+
+ // Override src
+ src = e.hist
+ sLimit := int32(len(src)) - inputMargin
+ // stepSize is the number of bytes to skip on every main loop iteration.
+ // It should be >= 1.
+ const stepSize = 1
+
+ const kSearchStrength = 8
+
+ // nextEmit is where in src the next emitLiteral should start from.
+ nextEmit := s
+ cv := load6432(src, s)
+
+ // Relative offsets
+ offset1 := int32(blk.recentOffsets[0])
+ offset2 := int32(blk.recentOffsets[1])
+
+ addLiterals := func(s *seq, until int32) {
+ if until == nextEmit {
+ return
+ }
+ blk.literals = append(blk.literals, src[nextEmit:until]...)
+ s.litLen = uint32(until - nextEmit)
+ }
+ if debug {
+ println("recent offsets:", blk.recentOffsets)
+ }
+
+encodeLoop:
+ for {
+ var t int32
+ // We allow the encoder to optionally turn off repeat offsets across blocks
+ canRepeat := len(blk.sequences) > 2
+
+ for {
+ if debugAsserts && canRepeat && offset1 == 0 {
+ panic("offset0 was 0")
+ }
+
+ nextHashS := hash5(cv, dFastShortTableBits)
+ nextHashL := hash8(cv, dFastLongTableBits)
+ candidateL := e.longTable[nextHashL]
+ candidateS := e.table[nextHashS]
+
+ const repOff = 1
+ repIndex := s - offset1 + repOff
+ entry := tableEntry{offset: s + e.cur, val: uint32(cv)}
+ e.longTable[nextHashL] = entry
+ e.markLongShardDirty(nextHashL)
+ e.table[nextHashS] = entry
+ e.markShardDirty(nextHashS)
+
+ if canRepeat {
+ if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) {
+ // Consider history as well.
+ var seq seq
+ lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src)
+
+ seq.matchLen = uint32(lenght - zstdMinMatch)
+
+ // We might be able to match backwards.
+ // Extend as long as we can.
+ start := s + repOff
+ // We end the search early, so we don't risk 0 literals
+ // and have to do special offset treatment.
+ startLimit := nextEmit + 1
+
+ tMin := s - e.maxMatchOff
+ if tMin < 0 {
+ tMin = 0
+ }
+ for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 {
+ repIndex--
+ start--
+ seq.matchLen++
+ }
+ addLiterals(&seq, start)
+
+ // rep 0
+ seq.offset = 1
+ if debugSequences {
+ println("repeat sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+ s += lenght + repOff
+ nextEmit = s
+ if s >= sLimit {
+ if debug {
+ println("repeat ended", s, lenght)
+
+ }
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ continue
+ }
+ }
+ // Find the offsets of our two matches.
+ coffsetL := s - (candidateL.offset - e.cur)
+ coffsetS := s - (candidateS.offset - e.cur)
+
+ // Check if we have a long match.
+ if coffsetL < e.maxMatchOff && uint32(cv) == candidateL.val {
+ // Found a long match, likely at least 8 bytes.
+ // Reference encoder checks all 8 bytes, we only check 4,
+ // but the likelihood of both the first 4 bytes and the hash matching should be enough.
+ t = candidateL.offset - e.cur
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugMatches {
+ println("long match")
+ }
+ break
+ }
+
+ // Check if we have a short match.
+ if coffsetS < e.maxMatchOff && uint32(cv) == candidateS.val {
+ // found a regular match
+ // See if we can find a long match at s+1
+ const checkAt = 1
+ cv := load6432(src, s+checkAt)
+ nextHashL = hash8(cv, dFastLongTableBits)
+ candidateL = e.longTable[nextHashL]
+ coffsetL = s - (candidateL.offset - e.cur) + checkAt
+
+ // We can store it, since we have at least a 4 byte match.
+ e.longTable[nextHashL] = tableEntry{offset: s + checkAt + e.cur, val: uint32(cv)}
+ e.markLongShardDirty(nextHashL)
+ if coffsetL < e.maxMatchOff && uint32(cv) == candidateL.val {
+ // Found a long match, likely at least 8 bytes.
+ // Reference encoder checks all 8 bytes, we only check 4,
+ // but the likelihood of both the first 4 bytes and the hash matching should be enough.
+ t = candidateL.offset - e.cur
+ s += checkAt
+ if debugMatches {
+ println("long match (after short)")
+ }
+ break
+ }
+
+ t = candidateS.offset - e.cur
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugAsserts && t < 0 {
+ panic("t<0")
+ }
+ if debugMatches {
+ println("short match")
+ }
+ break
+ }
+
+ // No match found, move forward in input.
+ s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1))
+ if s >= sLimit {
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ }
+
+ // A 4-byte match has been found. Update recent offsets.
+ // We'll later see if more than 4 bytes.
+ offset2 = offset1
+ offset1 = s - t
+
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+
+ if debugAsserts && canRepeat && int(offset1) > len(src) {
+ panic("invalid offset")
+ }
+
+ // Extend the 4-byte match as long as possible.
+ l := e.matchlen(s+4, t+4, src) + 4
+
+ // Extend backwards
+ tMin := s - e.maxMatchOff
+ if tMin < 0 {
+ tMin = 0
+ }
+ for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength {
+ s--
+ t--
+ l++
+ }
+
+ // Write our sequence
+ var seq seq
+ seq.litLen = uint32(s - nextEmit)
+ seq.matchLen = uint32(l - zstdMinMatch)
+ if seq.litLen > 0 {
+ blk.literals = append(blk.literals, src[nextEmit:s]...)
+ }
+ seq.offset = uint32(s-t) + 3
+ s += l
+ if debugSequences {
+ println("sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+ nextEmit = s
+ if s >= sLimit {
+ break encodeLoop
+ }
+
+ // Index match start+1 (long) and start+2 (short)
+ index0 := s - l + 1
+ // Index match end-2 (long) and end-1 (short)
+ index1 := s - 2
+
+ cv0 := load6432(src, index0)
+ cv1 := load6432(src, index1)
+ te0 := tableEntry{offset: index0 + e.cur, val: uint32(cv0)}
+ te1 := tableEntry{offset: index1 + e.cur, val: uint32(cv1)}
+ longHash1 := hash8(cv0, dFastLongTableBits)
+ longHash2 := hash8(cv0, dFastLongTableBits)
+ e.longTable[longHash1] = te0
+ e.longTable[longHash2] = te1
+ e.markLongShardDirty(longHash1)
+ e.markLongShardDirty(longHash2)
+ cv0 >>= 8
+ cv1 >>= 8
+ te0.offset++
+ te1.offset++
+ te0.val = uint32(cv0)
+ te1.val = uint32(cv1)
+ hashVal1 := hash5(cv0, dFastShortTableBits)
+ hashVal2 := hash5(cv1, dFastShortTableBits)
+ e.table[hashVal1] = te0
+ e.markShardDirty(hashVal1)
+ e.table[hashVal2] = te1
+ e.markShardDirty(hashVal2)
+
+ cv = load6432(src, s)
+
+ if !canRepeat {
+ continue
+ }
+
+ // Check offset 2
+ for {
+ o2 := s - offset2
+ if load3232(src, o2) != uint32(cv) {
+ // Do regular search
+ break
+ }
+
+ // Store this, since we have it.
+ nextHashS := hash5(cv, dFastShortTableBits)
+ nextHashL := hash8(cv, dFastLongTableBits)
+
+ // We have at least 4 byte match.
+ // No need to check backwards. We come straight from a match
+ l := 4 + e.matchlen(s+4, o2+4, src)
+
+ entry := tableEntry{offset: s + e.cur, val: uint32(cv)}
+ e.longTable[nextHashL] = entry
+ e.markLongShardDirty(nextHashL)
+ e.table[nextHashS] = entry
+ e.markShardDirty(nextHashS)
+ seq.matchLen = uint32(l) - zstdMinMatch
+ seq.litLen = 0
+
+ // Since litlen is always 0, this is offset 1.
+ seq.offset = 1
+ s += l
+ nextEmit = s
+ if debugSequences {
+ println("sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+
+ // Swap offset 1 and 2.
+ offset1, offset2 = offset2, offset1
+ if s >= sLimit {
+ // Finished
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ }
+ }
+
+ if int(nextEmit) < len(src) {
+ blk.literals = append(blk.literals, src[nextEmit:]...)
+ blk.extraLits = len(src) - int(nextEmit)
+ }
+ blk.recentOffsets[0] = uint32(offset1)
+ blk.recentOffsets[1] = uint32(offset2)
+ if debug {
+ println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
+ }
+ // If we encoded more than 64K mark all dirty.
+ if len(src) > 64<<10 {
+ e.markAllShardsDirty()
+ }
+}
+
// ResetDict will reset and set a dictionary if not nil
func (e *doubleFastEncoder) Reset(d *dict, singleBlock bool) {
e.fastEncoder.Reset(d, singleBlock)
+ if d != nil {
+ panic("doubleFastEncoder: Reset with dict not supported")
+ }
+}
+
+// ResetDict will reset and set a dictionary if not nil
+func (e *doubleFastEncoderDict) Reset(d *dict, singleBlock bool) {
+ allDirty := e.allDirty
+ e.fastEncoderDict.Reset(d, singleBlock)
if d == nil {
return
}
@@ -706,8 +1085,37 @@ func (e *doubleFastEncoder) Reset(d *dict, singleBlock bool) {
}
}
e.lastDictID = d.id
+ e.allDirty = true
}
// Reset table to initial state
e.cur = e.maxMatchOff
- copy(e.longTable[:], e.dictLongTable)
+
+ dirtyShardCnt := 0
+ if !allDirty {
+ for i := range e.longTableShardDirty {
+ if e.longTableShardDirty[i] {
+ dirtyShardCnt++
+ }
+ }
+ }
+
+ if allDirty || dirtyShardCnt > dLongTableShardCnt/2 {
+ copy(e.longTable[:], e.dictLongTable)
+ for i := range e.longTableShardDirty {
+ e.longTableShardDirty[i] = false
+ }
+ return
+ }
+ for i := range e.longTableShardDirty {
+ if !e.longTableShardDirty[i] {
+ continue
+ }
+
+ copy(e.longTable[i*dLongTableShardSize:(i+1)*dLongTableShardSize], e.dictLongTable[i*dLongTableShardSize:(i+1)*dLongTableShardSize])
+ e.longTableShardDirty[i] = false
+ }
+}
+
+func (e *doubleFastEncoderDict) markLongShardDirty(entryNum uint32) {
+ e.longTableShardDirty[entryNum/dLongTableShardSize] = true
}
diff --git a/vendor/github.com/klauspost/compress/zstd/enc_fast.go b/vendor/github.com/klauspost/compress/zstd/enc_fast.go
index 0045016d9..ba4a17e10 100644
--- a/vendor/github.com/klauspost/compress/zstd/enc_fast.go
+++ b/vendor/github.com/klauspost/compress/zstd/enc_fast.go
@@ -11,9 +11,11 @@ import (
)
const (
- tableBits = 15 // Bits used in the table
- tableSize = 1 << tableBits // Size of the table
- tableMask = tableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks.
+ tableBits = 15 // Bits used in the table
+ tableSize = 1 << tableBits // Size of the table
+ tableShardCnt = 1 << (tableBits - dictShardBits) // Number of shards in the table
+ tableShardSize = tableSize / tableShardCnt // Size of an individual shard
+ tableMask = tableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks.
maxMatchLength = 131074
)
@@ -24,8 +26,14 @@ type tableEntry struct {
type fastEncoder struct {
fastBase
- table [tableSize]tableEntry
- dictTable []tableEntry
+ table [tableSize]tableEntry
+}
+
+type fastEncoderDict struct {
+ fastEncoder
+ dictTable []tableEntry
+ tableShardDirty [tableShardCnt]bool
+ allDirty bool
}
// Encode mimmics functionality in zstd_fast.c
@@ -617,8 +625,322 @@ encodeLoop:
}
}
+// Encode will encode the content, with a dictionary if initialized for it.
+func (e *fastEncoderDict) Encode(blk *blockEnc, src []byte) {
+ const (
+ inputMargin = 8
+ minNonLiteralBlockSize = 1 + 1 + inputMargin
+ )
+ if e.allDirty || len(src) > 32<<10 {
+ e.fastEncoder.Encode(blk, src)
+ e.allDirty = true
+ return
+ }
+ // Protect against e.cur wraparound.
+ for e.cur >= bufferReset {
+ if len(e.hist) == 0 {
+ for i := range e.table[:] {
+ e.table[i] = tableEntry{}
+ }
+ e.cur = e.maxMatchOff
+ break
+ }
+ // Shift down everything in the table that isn't already too far away.
+ minOff := e.cur + int32(len(e.hist)) - e.maxMatchOff
+ for i := range e.table[:] {
+ v := e.table[i].offset
+ if v < minOff {
+ v = 0
+ } else {
+ v = v - e.cur + e.maxMatchOff
+ }
+ e.table[i].offset = v
+ }
+ e.cur = e.maxMatchOff
+ break
+ }
+
+ s := e.addBlock(src)
+ blk.size = len(src)
+ if len(src) < minNonLiteralBlockSize {
+ blk.extraLits = len(src)
+ blk.literals = blk.literals[:len(src)]
+ copy(blk.literals, src)
+ return
+ }
+
+ // Override src
+ src = e.hist
+ sLimit := int32(len(src)) - inputMargin
+ // stepSize is the number of bytes to skip on every main loop iteration.
+ // It should be >= 2.
+ const stepSize = 2
+
+ // TEMPLATE
+ const hashLog = tableBits
+ // seems global, but would be nice to tweak.
+ const kSearchStrength = 7
+
+ // nextEmit is where in src the next emitLiteral should start from.
+ nextEmit := s
+ cv := load6432(src, s)
+
+ // Relative offsets
+ offset1 := int32(blk.recentOffsets[0])
+ offset2 := int32(blk.recentOffsets[1])
+
+ addLiterals := func(s *seq, until int32) {
+ if until == nextEmit {
+ return
+ }
+ blk.literals = append(blk.literals, src[nextEmit:until]...)
+ s.litLen = uint32(until - nextEmit)
+ }
+ if debug {
+ println("recent offsets:", blk.recentOffsets)
+ }
+
+encodeLoop:
+ for {
+ // t will contain the match offset when we find one.
+ // When existing the search loop, we have already checked 4 bytes.
+ var t int32
+
+ // We will not use repeat offsets across blocks.
+ // By not using them for the first 3 matches
+ canRepeat := len(blk.sequences) > 2
+
+ for {
+ if debugAsserts && canRepeat && offset1 == 0 {
+ panic("offset0 was 0")
+ }
+
+ nextHash := hash6(cv, hashLog)
+ nextHash2 := hash6(cv>>8, hashLog)
+ candidate := e.table[nextHash]
+ candidate2 := e.table[nextHash2]
+ repIndex := s - offset1 + 2
+
+ e.table[nextHash] = tableEntry{offset: s + e.cur, val: uint32(cv)}
+ e.markShardDirty(nextHash)
+ e.table[nextHash2] = tableEntry{offset: s + e.cur + 1, val: uint32(cv >> 8)}
+ e.markShardDirty(nextHash2)
+
+ if canRepeat && repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>16) {
+ // Consider history as well.
+ var seq seq
+ var length int32
+ // length = 4 + e.matchlen(s+6, repIndex+4, src)
+ {
+ a := src[s+6:]
+ b := src[repIndex+4:]
+ endI := len(a) & (math.MaxInt32 - 7)
+ length = int32(endI) + 4
+ for i := 0; i < endI; i += 8 {
+ if diff := load64(a, i) ^ load64(b, i); diff != 0 {
+ length = int32(i+bits.TrailingZeros64(diff)>>3) + 4
+ break
+ }
+ }
+ }
+
+ seq.matchLen = uint32(length - zstdMinMatch)
+
+ // We might be able to match backwards.
+ // Extend as long as we can.
+ start := s + 2
+ // We end the search early, so we don't risk 0 literals
+ // and have to do special offset treatment.
+ startLimit := nextEmit + 1
+
+ sMin := s - e.maxMatchOff
+ if sMin < 0 {
+ sMin = 0
+ }
+ for repIndex > sMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch {
+ repIndex--
+ start--
+ seq.matchLen++
+ }
+ addLiterals(&seq, start)
+
+ // rep 0
+ seq.offset = 1
+ if debugSequences {
+ println("repeat sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+ s += length + 2
+ nextEmit = s
+ if s >= sLimit {
+ if debug {
+ println("repeat ended", s, length)
+
+ }
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ continue
+ }
+ coffset0 := s - (candidate.offset - e.cur)
+ coffset1 := s - (candidate2.offset - e.cur) + 1
+ if coffset0 < e.maxMatchOff && uint32(cv) == candidate.val {
+ // found a regular match
+ t = candidate.offset - e.cur
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ break
+ }
+
+ if coffset1 < e.maxMatchOff && uint32(cv>>8) == candidate2.val {
+ // found a regular match
+ t = candidate2.offset - e.cur
+ s++
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+ if debugAsserts && s-t > e.maxMatchOff {
+ panic("s - t >e.maxMatchOff")
+ }
+ if debugAsserts && t < 0 {
+ panic("t<0")
+ }
+ break
+ }
+ s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1))
+ if s >= sLimit {
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+ }
+ // A 4-byte match has been found. We'll later see if more than 4 bytes.
+ offset2 = offset1
+ offset1 = s - t
+
+ if debugAsserts && s <= t {
+ panic(fmt.Sprintf("s (%d) <= t (%d)", s, t))
+ }
+
+ if debugAsserts && canRepeat && int(offset1) > len(src) {
+ panic("invalid offset")
+ }
+
+ // Extend the 4-byte match as long as possible.
+ //l := e.matchlen(s+4, t+4, src) + 4
+ var l int32
+ {
+ a := src[s+4:]
+ b := src[t+4:]
+ endI := len(a) & (math.MaxInt32 - 7)
+ l = int32(endI) + 4
+ for i := 0; i < endI; i += 8 {
+ if diff := load64(a, i) ^ load64(b, i); diff != 0 {
+ l = int32(i+bits.TrailingZeros64(diff)>>3) + 4
+ break
+ }
+ }
+ }
+
+ // Extend backwards
+ tMin := s - e.maxMatchOff
+ if tMin < 0 {
+ tMin = 0
+ }
+ for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength {
+ s--
+ t--
+ l++
+ }
+
+ // Write our sequence.
+ var seq seq
+ seq.litLen = uint32(s - nextEmit)
+ seq.matchLen = uint32(l - zstdMinMatch)
+ if seq.litLen > 0 {
+ blk.literals = append(blk.literals, src[nextEmit:s]...)
+ }
+ // Don't use repeat offsets
+ seq.offset = uint32(s-t) + 3
+ s += l
+ if debugSequences {
+ println("sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+ nextEmit = s
+ if s >= sLimit {
+ break encodeLoop
+ }
+ cv = load6432(src, s)
+
+ // Check offset 2
+ if o2 := s - offset2; canRepeat && load3232(src, o2) == uint32(cv) {
+ // We have at least 4 byte match.
+ // No need to check backwards. We come straight from a match
+ //l := 4 + e.matchlen(s+4, o2+4, src)
+ var l int32
+ {
+ a := src[s+4:]
+ b := src[o2+4:]
+ endI := len(a) & (math.MaxInt32 - 7)
+ l = int32(endI) + 4
+ for i := 0; i < endI; i += 8 {
+ if diff := load64(a, i) ^ load64(b, i); diff != 0 {
+ l = int32(i+bits.TrailingZeros64(diff)>>3) + 4
+ break
+ }
+ }
+ }
+
+ // Store this, since we have it.
+ nextHash := hash6(cv, hashLog)
+ e.table[nextHash] = tableEntry{offset: s + e.cur, val: uint32(cv)}
+ e.markShardDirty(nextHash)
+ seq.matchLen = uint32(l) - zstdMinMatch
+ seq.litLen = 0
+ // Since litlen is always 0, this is offset 1.
+ seq.offset = 1
+ s += l
+ nextEmit = s
+ if debugSequences {
+ println("sequence", seq, "next s:", s)
+ }
+ blk.sequences = append(blk.sequences, seq)
+
+ // Swap offset 1 and 2.
+ offset1, offset2 = offset2, offset1
+ if s >= sLimit {
+ break encodeLoop
+ }
+ // Prepare next loop.
+ cv = load6432(src, s)
+ }
+ }
+
+ if int(nextEmit) < len(src) {
+ blk.literals = append(blk.literals, src[nextEmit:]...)
+ blk.extraLits = len(src) - int(nextEmit)
+ }
+ blk.recentOffsets[0] = uint32(offset1)
+ blk.recentOffsets[1] = uint32(offset2)
+ if debug {
+ println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits)
+ }
+}
+
// ResetDict will reset and set a dictionary if not nil
func (e *fastEncoder) Reset(d *dict, singleBlock bool) {
+ e.resetBase(d, singleBlock)
+ if d != nil {
+ panic("fastEncoder: Reset with dict")
+ }
+}
+
+// ResetDict will reset and set a dictionary if not nil
+func (e *fastEncoderDict) Reset(d *dict, singleBlock bool) {
e.resetBase(d, singleBlock)
if d == nil {
return
@@ -653,9 +975,44 @@ func (e *fastEncoder) Reset(d *dict, singleBlock bool) {
}
}
e.lastDictID = d.id
+ e.allDirty = true
}
e.cur = e.maxMatchOff
- // Reset table to initial state
- copy(e.table[:], e.dictTable)
+ dirtyShardCnt := 0
+ if !e.allDirty {
+ for i := range e.tableShardDirty {
+ if e.tableShardDirty[i] {
+ dirtyShardCnt++
+ }
+ }
+ }
+
+ const shardCnt = tableShardCnt
+ const shardSize = tableShardSize
+ if e.allDirty || dirtyShardCnt > shardCnt*4/6 {
+ copy(e.table[:], e.dictTable)
+ for i := range e.tableShardDirty {
+ e.tableShardDirty[i] = false
+ }
+ e.allDirty = false
+ return
+ }
+ for i := range e.tableShardDirty {
+ if !e.tableShardDirty[i] {
+ continue
+ }
+
+ copy(e.table[i*shardSize:(i+1)*shardSize], e.dictTable[i*shardSize:(i+1)*shardSize])
+ e.tableShardDirty[i] = false
+ }
+ e.allDirty = false
+}
+
+func (e *fastEncoderDict) markAllShardsDirty() {
+ e.allDirty = true
+}
+
+func (e *fastEncoderDict) markShardDirty(entryNum uint32) {
+ e.tableShardDirty[entryNum/tableShardSize] = true
}
diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go
index f5759211d..4871dd03a 100644
--- a/vendor/github.com/klauspost/compress/zstd/encoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/encoder.go
@@ -106,7 +106,7 @@ func (e *Encoder) Reset(w io.Writer) {
s.encoder = e.o.encoder()
}
if s.writing == nil {
- s.writing = &blockEnc{}
+ s.writing = &blockEnc{lowMem: e.o.lowMem}
s.writing.init()
}
s.writing.initNewEncode()
@@ -176,6 +176,12 @@ func (e *Encoder) nextBlock(final bool) error {
}
if !s.headerWritten {
// If we have a single block encode, do a sync compression.
+ if final && len(s.filling) == 0 && !e.o.fullZero {
+ s.headerWritten = true
+ s.fullFrameWritten = true
+ s.eofWritten = true
+ return nil
+ }
if final && len(s.filling) > 0 {
s.current = e.EncodeAll(s.filling, s.current[:0])
var n2 int
@@ -334,13 +340,13 @@ func (e *Encoder) ReadFrom(r io.Reader) (n int64, err error) {
println("ReadFrom: got EOF final block:", len(e.state.filling))
}
return n, nil
+ case nil:
default:
if debug {
println("ReadFrom: got error:", err)
}
e.state.err = err
return n, err
- case nil:
}
if len(src) > 0 {
if debug {
@@ -471,7 +477,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte {
}
// If less than 1MB, allocate a buffer up front.
- if len(dst) == 0 && cap(dst) == 0 && len(src) < 1<<20 {
+ if len(dst) == 0 && cap(dst) == 0 && len(src) < 1<<20 && !e.o.lowMem {
dst = make([]byte, 0, len(src))
}
dst, err := fh.appendTo(dst)
diff --git a/vendor/github.com/klauspost/compress/zstd/encoder_options.go b/vendor/github.com/klauspost/compress/zstd/encoder_options.go
index a7312f42a..16d4ab63c 100644
--- a/vendor/github.com/klauspost/compress/zstd/encoder_options.go
+++ b/vendor/github.com/klauspost/compress/zstd/encoder_options.go
@@ -24,12 +24,12 @@ type encoderOptions struct {
allLitEntropy bool
customWindow bool
customALEntropy bool
+ lowMem bool
dict *dict
}
func (o *encoderOptions) setDefault() {
*o = encoderOptions{
- // use less ram: true for now, but may change.
concurrent: runtime.GOMAXPROCS(0),
crc: true,
single: nil,
@@ -37,20 +37,31 @@ func (o *encoderOptions) setDefault() {
windowSize: 8 << 20,
level: SpeedDefault,
allLitEntropy: true,
+ lowMem: false,
}
}
// encoder returns an encoder with the selected options.
func (o encoderOptions) encoder() encoder {
switch o.level {
- case SpeedDefault:
- return &doubleFastEncoder{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}}}
- case SpeedBetterCompression:
- return &betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}}
- case SpeedBestCompression:
- return &bestFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}}
case SpeedFastest:
- return &fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}}
+ if o.dict != nil {
+ return &fastEncoderDict{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}}
+ }
+ return &fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}
+
+ case SpeedDefault:
+ if o.dict != nil {
+ return &doubleFastEncoderDict{fastEncoderDict: fastEncoderDict{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}}}
+ }
+ return &doubleFastEncoder{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}}
+ case SpeedBetterCompression:
+ if o.dict != nil {
+ return &betterFastEncoderDict{betterFastEncoder: betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}}
+ }
+ return &betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}
+ case SpeedBestCompression:
+ return &bestFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}
}
panic("unknown compression level")
}
@@ -62,7 +73,7 @@ func WithEncoderCRC(b bool) EOption {
}
// WithEncoderConcurrency will set the concurrency,
-// meaning the maximum number of decoders to run concurrently.
+// meaning the maximum number of encoders to run concurrently.
// The value supplied must be at least 1.
// By default this will be set to GOMAXPROCS.
func WithEncoderConcurrency(n int) EOption {
@@ -276,6 +287,17 @@ func WithSingleSegment(b bool) EOption {
}
}
+// WithLowerEncoderMem will trade in some memory cases trade less memory usage for
+// slower encoding speed.
+// This will not change the window size which is the primary function for reducing
+// memory usage. See WithWindowSize.
+func WithLowerEncoderMem(b bool) EOption {
+ return func(o *encoderOptions) error {
+ o.lowMem = b
+ return nil
+ }
+}
+
// WithEncoderDict allows to register a dictionary that will be used for the encode.
// The encoder *may* choose to use no dictionary instead for certain payloads.
func WithEncoderDict(dict []byte) EOption {
diff --git a/vendor/github.com/klauspost/compress/zstd/framedec.go b/vendor/github.com/klauspost/compress/zstd/framedec.go
index fc4a566d3..693c5f05d 100644
--- a/vendor/github.com/klauspost/compress/zstd/framedec.go
+++ b/vendor/github.com/klauspost/compress/zstd/framedec.go
@@ -121,7 +121,7 @@ func (d *frameDec) reset(br byteBuffer) error {
d.SingleSegment = fhd&(1<<5) != 0
if fhd&(1<<3) != 0 {
- return errors.New("Reserved bit set on frame header")
+ return errors.New("reserved bit set on frame header")
}
// Read Window_Descriptor
diff --git a/vendor/github.com/klauspost/compress/zstd/fse_encoder.go b/vendor/github.com/klauspost/compress/zstd/fse_encoder.go
index aa9eba88b..c74681b99 100644
--- a/vendor/github.com/klauspost/compress/zstd/fse_encoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/fse_encoder.go
@@ -97,7 +97,7 @@ func (s *fseEncoder) prepare() (*fseEncoder, error) {
func (s *fseEncoder) allocCtable() {
tableSize := 1 << s.actualTableLog
// get tableSymbol that is big enough.
- if cap(s.ct.tableSymbol) < int(tableSize) {
+ if cap(s.ct.tableSymbol) < tableSize {
s.ct.tableSymbol = make([]byte, tableSize)
}
s.ct.tableSymbol = s.ct.tableSymbol[:tableSize]
@@ -202,13 +202,13 @@ func (s *fseEncoder) buildCTable() error {
case 0:
case -1, 1:
symbolTT[i].deltaNbBits = tl
- symbolTT[i].deltaFindState = int16(total - 1)
+ symbolTT[i].deltaFindState = total - 1
total++
default:
maxBitsOut := uint32(tableLog) - highBit(uint32(v-1))
minStatePlus := uint32(v) << maxBitsOut
symbolTT[i].deltaNbBits = (maxBitsOut << 16) - minStatePlus
- symbolTT[i].deltaFindState = int16(total - v)
+ symbolTT[i].deltaFindState = total - v
total += v
}
}
@@ -353,8 +353,8 @@ func (s *fseEncoder) normalizeCount2(length int) error {
distributed uint32
total = uint32(length)
tableLog = s.actualTableLog
- lowThreshold = uint32(total >> tableLog)
- lowOne = uint32((total * 3) >> (tableLog + 1))
+ lowThreshold = total >> tableLog
+ lowOne = (total * 3) >> (tableLog + 1)
)
for i, cnt := range s.count[:s.symbolLen] {
if cnt == 0 {
@@ -379,7 +379,7 @@ func (s *fseEncoder) normalizeCount2(length int) error {
if (total / toDistribute) > lowOne {
// risk of rounding to zero
- lowOne = uint32((total * 3) / (toDistribute * 2))
+ lowOne = (total * 3) / (toDistribute * 2)
for i, cnt := range s.count[:s.symbolLen] {
if (s.norm[i] == notYetAssigned) && (cnt <= lowOne) {
s.norm[i] = 1
@@ -708,7 +708,6 @@ func (c *cState) init(bw *bitWriter, ct *cTable, first symbolTransform) {
im := int32((nbBitsOut << 16) - first.deltaNbBits)
lu := (im >> nbBitsOut) + int32(first.deltaFindState)
c.state = c.stateTable[lu]
- return
}
// encode the output symbol provided and write it to the bitstream.
diff --git a/vendor/github.com/klauspost/compress/zstd/fse_predefined.go b/vendor/github.com/klauspost/compress/zstd/fse_predefined.go
index 6c17dc17f..474cb77d2 100644
--- a/vendor/github.com/klauspost/compress/zstd/fse_predefined.go
+++ b/vendor/github.com/klauspost/compress/zstd/fse_predefined.go
@@ -59,7 +59,7 @@ func fillBase(dst []baseOffset, base uint32, bits ...uint8) {
}
for i, bit := range bits {
if base > math.MaxInt32 {
- panic(fmt.Sprintf("invalid decoding table, base overflows int32"))
+ panic("invalid decoding table, base overflows int32")
}
dst[i] = baseOffset{
diff --git a/vendor/github.com/klauspost/compress/zstd/seqenc.go b/vendor/github.com/klauspost/compress/zstd/seqenc.go
index 36bcc3cc0..8014174a7 100644
--- a/vendor/github.com/klauspost/compress/zstd/seqenc.go
+++ b/vendor/github.com/klauspost/compress/zstd/seqenc.go
@@ -35,7 +35,6 @@ func (s *seqCoders) setPrev(ll, ml, of *fseEncoder) {
// Ensure we cannot reuse by accident
prevEnc := *prev
prevEnc.symbolLen = 0
- return
}
compareSwap(ll, &s.llEnc, &s.llPrev)
compareSwap(ml, &s.mlEnc, &s.mlPrev)
diff --git a/vendor/github.com/klauspost/compress/zstd/snappy.go b/vendor/github.com/klauspost/compress/zstd/snappy.go
index 841fd95ac..9d9d1d567 100644
--- a/vendor/github.com/klauspost/compress/zstd/snappy.go
+++ b/vendor/github.com/klauspost/compress/zstd/snappy.go
@@ -10,8 +10,8 @@ import (
"hash/crc32"
"io"
+ "github.com/golang/snappy"
"github.com/klauspost/compress/huff0"
- "github.com/klauspost/compress/snappy"
)
const (
@@ -185,7 +185,6 @@ func (r *SnappyConverter) Convert(in io.Reader, w io.Writer) (int64, error) {
r.block.reset(nil)
r.block.literals, err = snappy.Decode(r.block.literals[:n], r.buf[snappyChecksumSize:chunkLen])
if err != nil {
- println("snappy.Decode:", err)
return written, err
}
err = r.block.encodeLits(r.block.literals, false)
@@ -417,7 +416,7 @@ var crcTable = crc32.MakeTable(crc32.Castagnoli)
// https://github.com/google/snappy/blob/master/framing_format.txt
func snappyCRC(b []byte) uint32 {
c := crc32.Update(0, crcTable, b)
- return uint32(c>>15|c<<17) + 0xa282ead8
+ return c>>15 | c<<17 + 0xa282ead8
}
// snappyDecodedLen returns the length of the decoded block and the number of bytes
diff --git a/vendor/github.com/klauspost/compress/zstd/zstd.go b/vendor/github.com/klauspost/compress/zstd/zstd.go
index 9056beef2..1ba308c8b 100644
--- a/vendor/github.com/klauspost/compress/zstd/zstd.go
+++ b/vendor/github.com/klauspost/compress/zstd/zstd.go
@@ -5,6 +5,7 @@ package zstd
import (
"bytes"
+ "encoding/binary"
"errors"
"log"
"math"
@@ -126,26 +127,15 @@ func matchLen(a, b []byte) int {
}
func load3232(b []byte, i int32) uint32 {
- // Help the compiler eliminate bounds checks on the read so it can be done in a single read.
- b = b[i:]
- b = b[:4]
- return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
+ return binary.LittleEndian.Uint32(b[i:])
}
func load6432(b []byte, i int32) uint64 {
- // Help the compiler eliminate bounds checks on the read so it can be done in a single read.
- b = b[i:]
- b = b[:8]
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
+ return binary.LittleEndian.Uint64(b[i:])
}
func load64(b []byte, i int) uint64 {
- // Help the compiler eliminate bounds checks on the read so it can be done in a single read.
- b = b[i:]
- b = b[:8]
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
+ return binary.LittleEndian.Uint64(b[i:])
}
type byter interface {
diff --git a/vendor/github.com/lib/pq/array.go b/vendor/github.com/lib/pq/array.go
index 405da2368..7806a31f3 100644
--- a/vendor/github.com/lib/pq/array.go
+++ b/vendor/github.com/lib/pq/array.go
@@ -22,7 +22,7 @@ var typeSQLScanner = reflect.TypeOf((*sql.Scanner)(nil)).Elem()
// db.Query(`SELECT * FROM t WHERE id = ANY($1)`, pq.Array([]int{235, 401}))
//
// var x []sql.NullInt64
-// db.QueryRow('SELECT ARRAY[235, 401]').Scan(pq.Array(&x))
+// db.QueryRow(`SELECT ARRAY[235, 401]`).Scan(pq.Array(&x))
//
// Scanning multi-dimensional arrays is not supported. Arrays where the lower
// bound is not one (such as `[0:0]={1}') are not supported.
diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go
index db0b6cef5..b09a17047 100644
--- a/vendor/github.com/lib/pq/conn.go
+++ b/vendor/github.com/lib/pq/conn.go
@@ -298,7 +298,13 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) {
// the user.
defer errRecoverNoErrBadConn(&err)
- o := c.opts
+ // Create a new values map (copy). This makes it so maps in different
+ // connections do not reference the same underlying data structure, so it
+ // is safe for multiple connections to concurrently write to their opts.
+ o := make(values)
+ for k, v := range c.opts {
+ o[k] = v
+ }
bad := &atomic.Value{}
bad.Store(false)
@@ -1100,7 +1106,7 @@ func isDriverSetting(key string) bool {
return true
case "password":
return true
- case "sslmode", "sslcert", "sslkey", "sslrootcert":
+ case "sslmode", "sslcert", "sslkey", "sslrootcert", "sslinline":
return true
case "fallback_application_name":
return true
@@ -1725,10 +1731,9 @@ func (cn *conn) processParameterStatus(r *readBuf) {
case "server_version":
var major1 int
var major2 int
- var minor int
- _, err = fmt.Sscanf(r.string(), "%d.%d.%d", &major1, &major2, &minor)
+ _, err = fmt.Sscanf(r.string(), "%d.%d", &major1, &major2)
if err == nil {
- cn.parameterStatus.serverVersion = major1*10000 + major2*100 + minor
+ cn.parameterStatus.serverVersion = major1*10000 + major2*100
}
case "TimeZone":
diff --git a/vendor/github.com/lib/pq/conn_go18.go b/vendor/github.com/lib/pq/conn_go18.go
index 8cab67c9d..2b9a9599e 100644
--- a/vendor/github.com/lib/pq/conn_go18.go
+++ b/vendor/github.com/lib/pq/conn_go18.go
@@ -129,7 +129,16 @@ func (cn *conn) watchCancel(ctx context.Context) func() {
}
func (cn *conn) cancel(ctx context.Context) error {
- c, err := dial(ctx, cn.dialer, cn.opts)
+ // Create a new values map (copy). This makes sure the connection created
+ // in this method cannot write to the same underlying data, which could
+ // cause a concurrent map write panic. This is necessary because cancel
+ // is called from a goroutine in watchCancel.
+ o := make(values)
+ for k, v := range cn.opts {
+ o[k] = v
+ }
+
+ c, err := dial(ctx, cn.dialer, o)
if err != nil {
return err
}
@@ -142,7 +151,7 @@ func (cn *conn) cancel(ctx context.Context) error {
c: c,
bad: bad,
}
- err = can.ssl(cn.opts)
+ err = can.ssl(o)
if err != nil {
return err
}
diff --git a/vendor/github.com/lib/pq/ssl.go b/vendor/github.com/lib/pq/ssl.go
index d90208455..e5eb92895 100644
--- a/vendor/github.com/lib/pq/ssl.go
+++ b/vendor/github.com/lib/pq/ssl.go
@@ -83,6 +83,16 @@ func ssl(o values) (func(net.Conn) (net.Conn, error), error) {
// in the user's home directory. The configured files must exist and have
// the correct permissions.
func sslClientCertificates(tlsConf *tls.Config, o values) error {
+ sslinline := o["sslinline"]
+ if sslinline == "true" {
+ cert, err := tls.X509KeyPair([]byte(o["sslcert"]), []byte(o["sslkey"]))
+ if err != nil {
+ return err
+ }
+ tlsConf.Certificates = []tls.Certificate{cert}
+ return nil
+ }
+
// user.Current() might fail when cross-compiling. We have to ignore the
// error and continue without home directory defaults, since we wouldn't
// know from where to load them.
@@ -137,9 +147,17 @@ func sslCertificateAuthority(tlsConf *tls.Config, o values) error {
if sslrootcert := o["sslrootcert"]; len(sslrootcert) > 0 {
tlsConf.RootCAs = x509.NewCertPool()
- cert, err := ioutil.ReadFile(sslrootcert)
- if err != nil {
- return err
+ sslinline := o["sslinline"]
+
+ var cert []byte
+ if sslinline == "true" {
+ cert = []byte(sslrootcert)
+ } else {
+ var err error
+ cert, err = ioutil.ReadFile(sslrootcert)
+ if err != nil {
+ return err
+ }
}
if !tlsConf.RootCAs.AppendCertsFromPEM(cert) {
diff --git a/vendor/github.com/lib/pq/url.go b/vendor/github.com/lib/pq/url.go
index f4d8a7c20..aec6e95be 100644
--- a/vendor/github.com/lib/pq/url.go
+++ b/vendor/github.com/lib/pq/url.go
@@ -40,10 +40,10 @@ func ParseURL(url string) (string, error) {
}
var kvs []string
- escaper := strings.NewReplacer(` `, `\ `, `'`, `\'`, `\`, `\\`)
+ escaper := strings.NewReplacer(`'`, `\'`, `\`, `\\`)
accrue := func(k, v string) {
if v != "" {
- kvs = append(kvs, k+"="+escaper.Replace(v))
+ kvs = append(kvs, k+"='"+escaper.Replace(v)+"'")
}
}
diff --git a/vendor/github.com/magiconair/properties/.travis.yml b/vendor/github.com/magiconair/properties/.travis.yml
index 1a30a6cbd..baf9031df 100644
--- a/vendor/github.com/magiconair/properties/.travis.yml
+++ b/vendor/github.com/magiconair/properties/.travis.yml
@@ -13,4 +13,5 @@ go:
- "1.13.x"
- "1.14.x"
- "1.15.x"
+ - "1.16.x"
- tip
diff --git a/vendor/github.com/magiconair/properties/properties.go b/vendor/github.com/magiconair/properties/properties.go
index 0d0fc2820..1529e7223 100644
--- a/vendor/github.com/magiconair/properties/properties.go
+++ b/vendor/github.com/magiconair/properties/properties.go
@@ -637,7 +637,7 @@ func (p *Properties) WriteComment(w io.Writer, prefix string, enc Encoding) (n i
}
for _, c := range comments {
- x, err = fmt.Fprintf(w, "%s%s\n", prefix, encode(c, "", enc))
+ x, err = fmt.Fprintf(w, "%s%s\n", prefix, c)
if err != nil {
return
}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go
index f3871a624..3d7fa560b 100644
--- a/vendor/github.com/mattn/go-runewidth/runewidth.go
+++ b/vendor/github.com/mattn/go-runewidth/runewidth.go
@@ -12,8 +12,14 @@ var (
// EastAsianWidth will be set true if the current locale is CJK
EastAsianWidth bool
+ // StrictEmojiNeutral should be set false if handle broken fonts
+ StrictEmojiNeutral bool = true
+
// DefaultCondition is a condition in current locale
- DefaultCondition = &Condition{}
+ DefaultCondition = &Condition{
+ EastAsianWidth: false,
+ StrictEmojiNeutral: true,
+ }
)
func init() {
@@ -83,26 +89,52 @@ var nonprint = table{
// Condition have flag EastAsianWidth whether the current locale is CJK or not.
type Condition struct {
- EastAsianWidth bool
+ EastAsianWidth bool
+ StrictEmojiNeutral bool
}
// NewCondition return new instance of Condition which is current locale.
func NewCondition() *Condition {
return &Condition{
- EastAsianWidth: EastAsianWidth,
+ EastAsianWidth: EastAsianWidth,
+ StrictEmojiNeutral: StrictEmojiNeutral,
}
}
// RuneWidth returns the number of cells in r.
// See http://www.unicode.org/reports/tr11/
func (c *Condition) RuneWidth(r rune) int {
- switch {
- case r < 0 || r > 0x10FFFF || inTables(r, nonprint, combining, notassigned):
- return 0
- case (c.EastAsianWidth && IsAmbiguousWidth(r)) || inTables(r, doublewidth):
- return 2
- default:
- return 1
+ // optimized version, verified by TestRuneWidthChecksums()
+ if !c.EastAsianWidth {
+ switch {
+ case r < 0x20 || r > 0x10FFFF:
+ return 0
+ case (r >= 0x7F && r <= 0x9F) || r == 0xAD: // nonprint
+ return 0
+ case r < 0x300:
+ return 1
+ case inTable(r, narrow):
+ return 1
+ case inTables(r, nonprint, combining):
+ return 0
+ case inTable(r, doublewidth):
+ return 2
+ default:
+ return 1
+ }
+ } else {
+ switch {
+ case r < 0 || r > 0x10FFFF || inTables(r, nonprint, combining):
+ return 0
+ case inTable(r, narrow):
+ return 1
+ case inTables(r, ambiguous, doublewidth):
+ return 2
+ case !c.StrictEmojiNeutral && inTables(r, ambiguous, emoji, narrow):
+ return 2
+ default:
+ return 1
+ }
}
}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_table.go b/vendor/github.com/mattn/go-runewidth/runewidth_table.go
index b27d77d89..e5d890c26 100644
--- a/vendor/github.com/mattn/go-runewidth/runewidth_table.go
+++ b/vendor/github.com/mattn/go-runewidth/runewidth_table.go
@@ -124,8 +124,10 @@ var ambiguous = table{
{0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF},
{0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD},
}
-var notassigned = table{
- {0x27E6, 0x27ED}, {0x2985, 0x2986},
+var narrow = table{
+ {0x0020, 0x007E}, {0x00A2, 0x00A3}, {0x00A5, 0x00A6},
+ {0x00AC, 0x00AC}, {0x00AF, 0x00AF}, {0x27E6, 0x27ED},
+ {0x2985, 0x2986},
}
var neutral = table{
diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
index c1a4d8f92..a974948f8 100644
--- a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
+++ b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
@@ -1,7 +1,7 @@
#ifndef USE_LIBSQLITE3
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
-** version 3.34.0. By combining all the individual C code files into this
+** version 3.35.4. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@@ -285,6 +285,9 @@ static const char * const sqlite3azCompileOpt[] = {
#ifdef SQLITE_ENABLE_LOCKING_STYLE
"ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
#endif
+#if SQLITE_ENABLE_MATH_FUNCTIONS
+ "ENABLE_MATH_FUNCTIONS",
+#endif
#if SQLITE_ENABLE_MEMORY_MANAGEMENT
"ENABLE_MEMORY_MANAGEMENT",
#endif
@@ -991,6 +994,18 @@ SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){
# define MSVC_VERSION 0
#endif
+/*
+** Some C99 functions in "math.h" are only present for MSVC when its version
+** is associated with Visual Studio 2013 or higher.
+*/
+#ifndef SQLITE_HAVE_C99_MATH_FUNCS
+# if MSVC_VERSION==0 || MSVC_VERSION>=1800
+# define SQLITE_HAVE_C99_MATH_FUNCS (1)
+# else
+# define SQLITE_HAVE_C99_MATH_FUNCS (0)
+# endif
+#endif
+
/* Needed for various definitions... */
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
# define _GNU_SOURCE
@@ -1172,9 +1187,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.34.0"
-#define SQLITE_VERSION_NUMBER 3034000
-#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
+#define SQLITE_VERSION "3.35.4"
+#define SQLITE_VERSION_NUMBER 3035004
+#define SQLITE_SOURCE_ID "2021-04-02 15:20:15 5d4c65779dab868b285519b19e4cf9d451d50c6048f06f653aa701ec212df45e"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -3164,7 +3179,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether triggers are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
-** which case the trigger setting is not reported back.
+** which case the trigger setting is not reported back.
+**
+**
Originally this option disabled all triggers. ^(However, since
+** SQLite version 3.35.0, TEMP triggers are still allowed even if
+** this option is off. So, in other words, this option now only disables
+** triggers in the main database schema or in the schemas of ATTACH-ed
+** databases.)^
**
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
**
SQLITE_DBCONFIG_ENABLE_VIEW
@@ -3175,7 +3196,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether views are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
-** which case the view setting is not reported back.
+** which case the view setting is not reported back.
+**
+**
Originally this option disabled all views. ^(However, since
+** SQLite version 3.35.0, TEMP views are still allowed even if
+** this option is off. So, in other words, this option now only disables
+** views in the main database schema or in the schemas of ATTACH-ed
+** databases.)^
**
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
**
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
@@ -4548,6 +4575,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** that uses dot-files in place of posix advisory locking.
**
file:data.db?mode=readonly
** An error. "readonly" is not a valid option for the "mode" parameter.
+** Use "ro" instead: "file:data.db?mode=ro".
**
**
** ^URI hexadecimal escape sequences (%HH) are supported within the path and
@@ -4746,7 +4774,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
** If the Y parameter to sqlite3_free_filename(Y) is anything other
** than a NULL pointer or a pointer previously acquired from
** sqlite3_create_filename(), then bad things such as heap
-** corruption or segfaults may occur. The value Y should be
+** corruption or segfaults may occur. The value Y should not be
** used again after sqlite3_free_filename(Y) has been called. This means
** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
** then the corresponding [sqlite3_module.xClose() method should also be
@@ -8814,7 +8842,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_PRNG_SEED 28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
#define SQLITE_TESTCTRL_SEEK_COUNT 30
-#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
+#define SQLITE_TESTCTRL_TRACEFLAGS 31
+#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
/*
** CAPI3REF: SQL Keyword Checking
@@ -11487,6 +11516,14 @@ SQLITE_API int sqlite3session_patchset(
*/
SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
+/*
+** CAPI3REF: Query for the amount of heap memory used by a session object.
+**
+** This API returns the total amount of heap memory in bytes currently
+** used by the session object passed as the only argument.
+*/
+SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
+
/*
** CAPI3REF: Create An Iterator To Traverse A Changeset
** CONSTRUCTOR: sqlite3_changeset_iter
@@ -11589,18 +11626,23 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
** is not the case, this function returns [SQLITE_MISUSE].
**
-** If argument pzTab is not NULL, then *pzTab is set to point to a
-** nul-terminated utf-8 encoded string containing the name of the table
-** affected by the current change. The buffer remains valid until either
-** sqlite3changeset_next() is called on the iterator or until the
-** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
-** set to the number of columns in the table affected by the change. If
-** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
+** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
+** outputs are set through these pointers:
+**
+** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
+** depending on the type of change that the iterator currently points to;
+**
+** *pnCol is set to the number of columns in the table affected by the change; and
+**
+** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
+** the name of the table affected by the current change. The buffer remains
+** valid until either sqlite3changeset_next() is called on the iterator
+** or until the conflict-handler function returns.
+**
+** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** is an indirect change, or false (0) otherwise. See the documentation for
** [sqlite3session_indirect()] for a description of direct and indirect
-** changes. Finally, if pOp is not NULL, then *pOp is set to one of
-** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the
-** type of change that the iterator currently points to.
+** changes.
**
** If no error occurs, SQLITE_OK is returned. If an error does occur, an
** SQLite error code is returned. The values of the output variables may not
@@ -13529,7 +13571,8 @@ struct fts5_api {
#ifndef __has_extension
# define __has_extension(x) 0 /* compatibility with non-clang compilers */
#endif
-#if GCC_VERSION>=4007000 || __has_extension(c_atomic)
+#if GCC_VERSION>=4007000 || \
+ (__has_extension(c_atomic) && __has_extension(c_atomic_store_n))
# define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
# define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
#else
@@ -14096,90 +14139,92 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#define TK_TIES 94
#define TK_GENERATED 95
#define TK_ALWAYS 96
-#define TK_REINDEX 97
-#define TK_RENAME 98
-#define TK_CTIME_KW 99
-#define TK_ANY 100
-#define TK_BITAND 101
-#define TK_BITOR 102
-#define TK_LSHIFT 103
-#define TK_RSHIFT 104
-#define TK_PLUS 105
-#define TK_MINUS 106
-#define TK_STAR 107
-#define TK_SLASH 108
-#define TK_REM 109
-#define TK_CONCAT 110
-#define TK_COLLATE 111
-#define TK_BITNOT 112
-#define TK_ON 113
-#define TK_INDEXED 114
-#define TK_STRING 115
-#define TK_JOIN_KW 116
-#define TK_CONSTRAINT 117
-#define TK_DEFAULT 118
-#define TK_NULL 119
-#define TK_PRIMARY 120
-#define TK_UNIQUE 121
-#define TK_CHECK 122
-#define TK_REFERENCES 123
-#define TK_AUTOINCR 124
-#define TK_INSERT 125
-#define TK_DELETE 126
-#define TK_UPDATE 127
-#define TK_SET 128
-#define TK_DEFERRABLE 129
-#define TK_FOREIGN 130
-#define TK_DROP 131
-#define TK_UNION 132
-#define TK_ALL 133
-#define TK_EXCEPT 134
-#define TK_INTERSECT 135
-#define TK_SELECT 136
-#define TK_VALUES 137
-#define TK_DISTINCT 138
-#define TK_DOT 139
-#define TK_FROM 140
-#define TK_JOIN 141
-#define TK_USING 142
-#define TK_ORDER 143
-#define TK_GROUP 144
-#define TK_HAVING 145
-#define TK_LIMIT 146
-#define TK_WHERE 147
-#define TK_INTO 148
-#define TK_NOTHING 149
-#define TK_FLOAT 150
-#define TK_BLOB 151
-#define TK_INTEGER 152
-#define TK_VARIABLE 153
-#define TK_CASE 154
-#define TK_WHEN 155
-#define TK_THEN 156
-#define TK_ELSE 157
-#define TK_INDEX 158
-#define TK_ALTER 159
-#define TK_ADD 160
-#define TK_WINDOW 161
-#define TK_OVER 162
-#define TK_FILTER 163
-#define TK_COLUMN 164
-#define TK_AGG_FUNCTION 165
-#define TK_AGG_COLUMN 166
-#define TK_TRUEFALSE 167
-#define TK_ISNOT 168
-#define TK_FUNCTION 169
-#define TK_UMINUS 170
-#define TK_UPLUS 171
-#define TK_TRUTH 172
-#define TK_REGISTER 173
-#define TK_VECTOR 174
-#define TK_SELECT_COLUMN 175
-#define TK_IF_NULL_ROW 176
-#define TK_ASTERISK 177
-#define TK_SPAN 178
-#define TK_SPACE 179
-#define TK_ILLEGAL 180
+#define TK_MATERIALIZED 97
+#define TK_REINDEX 98
+#define TK_RENAME 99
+#define TK_CTIME_KW 100
+#define TK_ANY 101
+#define TK_BITAND 102
+#define TK_BITOR 103
+#define TK_LSHIFT 104
+#define TK_RSHIFT 105
+#define TK_PLUS 106
+#define TK_MINUS 107
+#define TK_STAR 108
+#define TK_SLASH 109
+#define TK_REM 110
+#define TK_CONCAT 111
+#define TK_COLLATE 112
+#define TK_BITNOT 113
+#define TK_ON 114
+#define TK_INDEXED 115
+#define TK_STRING 116
+#define TK_JOIN_KW 117
+#define TK_CONSTRAINT 118
+#define TK_DEFAULT 119
+#define TK_NULL 120
+#define TK_PRIMARY 121
+#define TK_UNIQUE 122
+#define TK_CHECK 123
+#define TK_REFERENCES 124
+#define TK_AUTOINCR 125
+#define TK_INSERT 126
+#define TK_DELETE 127
+#define TK_UPDATE 128
+#define TK_SET 129
+#define TK_DEFERRABLE 130
+#define TK_FOREIGN 131
+#define TK_DROP 132
+#define TK_UNION 133
+#define TK_ALL 134
+#define TK_EXCEPT 135
+#define TK_INTERSECT 136
+#define TK_SELECT 137
+#define TK_VALUES 138
+#define TK_DISTINCT 139
+#define TK_DOT 140
+#define TK_FROM 141
+#define TK_JOIN 142
+#define TK_USING 143
+#define TK_ORDER 144
+#define TK_GROUP 145
+#define TK_HAVING 146
+#define TK_LIMIT 147
+#define TK_WHERE 148
+#define TK_RETURNING 149
+#define TK_INTO 150
+#define TK_NOTHING 151
+#define TK_FLOAT 152
+#define TK_BLOB 153
+#define TK_INTEGER 154
+#define TK_VARIABLE 155
+#define TK_CASE 156
+#define TK_WHEN 157
+#define TK_THEN 158
+#define TK_ELSE 159
+#define TK_INDEX 160
+#define TK_ALTER 161
+#define TK_ADD 162
+#define TK_WINDOW 163
+#define TK_OVER 164
+#define TK_FILTER 165
+#define TK_COLUMN 166
+#define TK_AGG_FUNCTION 167
+#define TK_AGG_COLUMN 168
+#define TK_TRUEFALSE 169
+#define TK_ISNOT 170
+#define TK_FUNCTION 171
+#define TK_UMINUS 172
+#define TK_UPLUS 173
+#define TK_TRUTH 174
+#define TK_REGISTER 175
+#define TK_VECTOR 176
+#define TK_SELECT_COLUMN 177
+#define TK_IF_NULL_ROW 178
+#define TK_ASTERISK 179
+#define TK_SPAN 180
+#define TK_SPACE 181
+#define TK_ILLEGAL 182
/************** End of parse.h ***********************************************/
/************** Continuing where we left off in sqliteInt.h ******************/
@@ -14595,15 +14640,14 @@ typedef INT16_TYPE LogEst;
** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
** the Select query generator tracing logic is turned on.
*/
-#if defined(SQLITE_ENABLE_SELECTTRACE)
-# define SELECTTRACE_ENABLED 1
-#else
-# define SELECTTRACE_ENABLED 0
+#if !defined(SQLITE_AMALGAMATION)
+SQLITE_PRIVATE u32 sqlite3SelectTrace;
#endif
-#if defined(SQLITE_ENABLE_SELECTTRACE)
+#if defined(SQLITE_DEBUG) \
+ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE))
# define SELECTTRACE_ENABLED 1
# define SELECTTRACE(K,P,S,X) \
- if(sqlite3_unsupported_selecttrace&(K)) \
+ if(sqlite3SelectTrace&(K)) \
sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
sqlite3DebugPrintf X
#else
@@ -14611,6 +14655,19 @@ typedef INT16_TYPE LogEst;
# define SELECTTRACE_ENABLED 0
#endif
+/*
+** Macros for "wheretrace"
+*/
+SQLITE_PRIVATE u32 sqlite3WhereTrace;
+#if defined(SQLITE_DEBUG) \
+ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
+# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
+# define WHERETRACE_ENABLED 1
+#else
+# define WHERETRACE(K,X)
+#endif
+
+
/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle.
@@ -14722,7 +14779,10 @@ typedef struct AutoincInfo AutoincInfo;
typedef struct Bitvec Bitvec;
typedef struct CollSeq CollSeq;
typedef struct Column Column;
+typedef struct Cte Cte;
+typedef struct CteUse CteUse;
typedef struct Db Db;
+typedef struct DbFixer DbFixer;
typedef struct Schema Schema;
typedef struct Expr Expr;
typedef struct ExprList ExprList;
@@ -14740,14 +14800,17 @@ typedef struct LookasideSlot LookasideSlot;
typedef struct Module Module;
typedef struct NameContext NameContext;
typedef struct Parse Parse;
+typedef struct ParseCleanup ParseCleanup;
typedef struct PreUpdate PreUpdate;
typedef struct PrintfArguments PrintfArguments;
typedef struct RenameToken RenameToken;
+typedef struct Returning Returning;
typedef struct RowSet RowSet;
typedef struct Savepoint Savepoint;
typedef struct Select Select;
typedef struct SQLiteThread SQLiteThread;
typedef struct SelectDest SelectDest;
+typedef struct SrcItem SrcItem;
typedef struct SrcList SrcList;
typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */
typedef struct Table Table;
@@ -15319,6 +15382,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags);
#define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */
#define BTREE_AUXDELETE 0x04 /* not the primary delete operation */
#define BTREE_APPEND 0x08 /* Insert is likely an append */
+#define BTREE_PREFORMAT 0x80 /* Inserted data is a preformated cell */
/* An instance of the BtreePayload object describes the content of a single
** entry in either an index or table btree.
@@ -15418,6 +15482,8 @@ SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*);
SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
#endif
+SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);
+
/*
** If we are not using shared cache, then there is no need to
** use mutexes to access the BtShared structures. So make the
@@ -15717,103 +15783,105 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_Copy 77 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
#define OP_SCopy 78 /* synopsis: r[P2]=r[P1] */
#define OP_IntCopy 79 /* synopsis: r[P2]=r[P1] */
-#define OP_ResultRow 80 /* synopsis: output=r[P1@P2] */
-#define OP_CollSeq 81
-#define OP_AddImm 82 /* synopsis: r[P1]=r[P1]+P2 */
-#define OP_RealAffinity 83
-#define OP_Cast 84 /* synopsis: affinity(r[P1]) */
-#define OP_Permutation 85
-#define OP_Compare 86 /* synopsis: r[P1@P3] <-> r[P2@P3] */
-#define OP_IsTrue 87 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
-#define OP_Offset 88 /* synopsis: r[P3] = sqlite_offset(P1) */
-#define OP_Column 89 /* synopsis: r[P3]=PX */
-#define OP_Affinity 90 /* synopsis: affinity(r[P1@P2]) */
-#define OP_MakeRecord 91 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
-#define OP_Count 92 /* synopsis: r[P2]=count() */
-#define OP_ReadCookie 93
-#define OP_SetCookie 94
-#define OP_ReopenIdx 95 /* synopsis: root=P2 iDb=P3 */
-#define OP_OpenRead 96 /* synopsis: root=P2 iDb=P3 */
-#define OP_OpenWrite 97 /* synopsis: root=P2 iDb=P3 */
-#define OP_OpenDup 98
-#define OP_OpenAutoindex 99 /* synopsis: nColumn=P2 */
-#define OP_OpenEphemeral 100 /* synopsis: nColumn=P2 */
-#define OP_BitAnd 101 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
-#define OP_BitOr 102 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
-#define OP_ShiftLeft 103 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<>r[P1] */
-#define OP_Add 105 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
-#define OP_Subtract 106 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
-#define OP_Multiply 107 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
-#define OP_Divide 108 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
-#define OP_Remainder 109 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
-#define OP_Concat 110 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
-#define OP_SorterOpen 111
-#define OP_BitNot 112 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
-#define OP_SequenceTest 113 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
-#define OP_OpenPseudo 114 /* synopsis: P3 columns in r[P2] */
-#define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */
-#define OP_Close 116
-#define OP_ColumnsUsed 117
-#define OP_SeekScan 118 /* synopsis: Scan-ahead up to P1 rows */
-#define OP_SeekHit 119 /* synopsis: set P2<=seekHit<=P3 */
-#define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
-#define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
-#define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
-#define OP_Delete 123
-#define OP_ResetCount 124
-#define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
-#define OP_SorterData 126 /* synopsis: r[P2]=data */
-#define OP_RowData 127 /* synopsis: r[P2]=data */
-#define OP_Rowid 128 /* synopsis: r[P2]=rowid */
-#define OP_NullRow 129
-#define OP_SeekEnd 130
-#define OP_IdxInsert 131 /* synopsis: key=r[P2] */
-#define OP_SorterInsert 132 /* synopsis: key=r[P2] */
-#define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */
-#define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */
-#define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */
-#define OP_FinishSeek 136
-#define OP_Destroy 137
-#define OP_Clear 138
-#define OP_ResetSorter 139
-#define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
-#define OP_SqlExec 141
-#define OP_ParseSchema 142
-#define OP_LoadAnalysis 143
-#define OP_DropTable 144
-#define OP_DropIndex 145
-#define OP_DropTrigger 146
-#define OP_IntegrityCk 147
-#define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */
-#define OP_Param 149
-#define OP_Real 150 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
-#define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
-#define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
-#define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
-#define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
-#define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
-#define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
-#define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
-#define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
-#define OP_Expire 159
-#define OP_CursorLock 160
-#define OP_CursorUnlock 161
-#define OP_TableLock 162 /* synopsis: iDb=P1 root=P2 write=P3 */
-#define OP_VBegin 163
-#define OP_VCreate 164
-#define OP_VDestroy 165
-#define OP_VOpen 166
-#define OP_VColumn 167 /* synopsis: r[P3]=vcolumn(P2) */
-#define OP_VRename 168
-#define OP_Pagecount 169
-#define OP_MaxPgcnt 170
-#define OP_Trace 171
-#define OP_CursorHint 172
-#define OP_ReleaseReg 173 /* synopsis: release r[P1@P2] mask P3 */
-#define OP_Noop 174
-#define OP_Explain 175
-#define OP_Abortable 176
+#define OP_ChngCntRow 80 /* synopsis: output=r[P1] */
+#define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */
+#define OP_CollSeq 82
+#define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */
+#define OP_RealAffinity 84
+#define OP_Cast 85 /* synopsis: affinity(r[P1]) */
+#define OP_Permutation 86
+#define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */
+#define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
+#define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */
+#define OP_Column 90 /* synopsis: r[P3]=PX */
+#define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */
+#define OP_MakeRecord 92 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
+#define OP_Count 93 /* synopsis: r[P2]=count() */
+#define OP_ReadCookie 94
+#define OP_SetCookie 95
+#define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenDup 99
+#define OP_OpenAutoindex 100 /* synopsis: nColumn=P2 */
+#define OP_OpenEphemeral 101 /* synopsis: nColumn=P2 */
+#define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
+#define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
+#define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<>r[P1] */
+#define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
+#define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
+#define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
+#define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
+#define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
+#define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
+#define OP_SorterOpen 112
+#define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
+#define OP_SequenceTest 114 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
+#define OP_OpenPseudo 115 /* synopsis: P3 columns in r[P2] */
+#define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
+#define OP_Close 117
+#define OP_ColumnsUsed 118
+#define OP_SeekScan 119 /* synopsis: Scan-ahead up to P1 rows */
+#define OP_SeekHit 120 /* synopsis: set P2<=seekHit<=P3 */
+#define OP_Sequence 121 /* synopsis: r[P2]=cursor[P1].ctr++ */
+#define OP_NewRowid 122 /* synopsis: r[P2]=rowid */
+#define OP_Insert 123 /* synopsis: intkey=r[P3] data=r[P2] */
+#define OP_RowCell 124
+#define OP_Delete 125
+#define OP_ResetCount 126
+#define OP_SorterCompare 127 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
+#define OP_SorterData 128 /* synopsis: r[P2]=data */
+#define OP_RowData 129 /* synopsis: r[P2]=data */
+#define OP_Rowid 130 /* synopsis: r[P2]=rowid */
+#define OP_NullRow 131
+#define OP_SeekEnd 132
+#define OP_IdxInsert 133 /* synopsis: key=r[P2] */
+#define OP_SorterInsert 134 /* synopsis: key=r[P2] */
+#define OP_IdxDelete 135 /* synopsis: key=r[P2@P3] */
+#define OP_DeferredSeek 136 /* synopsis: Move P3 to P1.rowid if needed */
+#define OP_IdxRowid 137 /* synopsis: r[P2]=rowid */
+#define OP_FinishSeek 138
+#define OP_Destroy 139
+#define OP_Clear 140
+#define OP_ResetSorter 141
+#define OP_CreateBtree 142 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
+#define OP_SqlExec 143
+#define OP_ParseSchema 144
+#define OP_LoadAnalysis 145
+#define OP_DropTable 146
+#define OP_DropIndex 147
+#define OP_DropTrigger 148
+#define OP_IntegrityCk 149
+#define OP_RowSetAdd 150 /* synopsis: rowset(P1)=r[P2] */
+#define OP_Param 151
+#define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
+#define OP_FkCounter 153 /* synopsis: fkctr[P1]+=P2 */
+#define OP_MemMax 154 /* synopsis: r[P1]=max(r[P1],r[P2]) */
+#define OP_OffsetLimit 155 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
+#define OP_AggInverse 156 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
+#define OP_AggStep 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
+#define OP_AggStep1 158 /* synopsis: accum=r[P3] step(r[P2@P5]) */
+#define OP_AggValue 159 /* synopsis: r[P3]=value N=P2 */
+#define OP_AggFinal 160 /* synopsis: accum=r[P1] N=P2 */
+#define OP_Expire 161
+#define OP_CursorLock 162
+#define OP_CursorUnlock 163
+#define OP_TableLock 164 /* synopsis: iDb=P1 root=P2 write=P3 */
+#define OP_VBegin 165
+#define OP_VCreate 166
+#define OP_VDestroy 167
+#define OP_VOpen 168
+#define OP_VColumn 169 /* synopsis: r[P3]=vcolumn(P2) */
+#define OP_VRename 170
+#define OP_Pagecount 171
+#define OP_MaxPgcnt 172
+#define OP_Trace 173
+#define OP_CursorHint 174
+#define OP_ReleaseReg 175 /* synopsis: release r[P1@P2] mask P3 */
+#define OP_Noop 176
+#define OP_Explain 177
+#define OP_Abortable 178
/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
@@ -15836,19 +15904,19 @@ typedef struct VdbeOpList VdbeOpList;
/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x00,\
/* 64 */ 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\
/* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
-/* 80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x12,\
-/* 88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
-/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
-/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
-/* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
-/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\
-/* 136 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
-/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00,\
-/* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
+/* 80 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
+/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
+/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\
+/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
+/* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
+/* 120 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
+/* 128 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00,\
+/* 136 */ 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00,\
+/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\
+/* 152 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 168 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 176 */ 0x00,}
+/* 168 */ 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\
+/* 176 */ 0x00, 0x00, 0x00,}
/* The sqlite3P2Values() routine is able to run faster if it knows
** the value of the largest JUMP opcode. The smaller the maximum
@@ -15916,7 +15984,7 @@ SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char*,const char*);
#else
# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
#endif
-SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*, int, char*, u16);
SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
@@ -16888,6 +16956,11 @@ SQLITE_PRIVATE void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**);
#endif /* SQLITE_OMIT_DEPRECATED */
#define SQLITE_TRACE_NONLEGACY_MASK 0x0f /* Normal flags */
+/*
+** Maximum number of sqlite3.aDb[] entries. This is the number of attached
+** databases plus 2 for "main" and "temp".
+*/
+#define SQLITE_MAX_DB (SQLITE_MAX_ATTACHED+2)
/*
** Each database connection is an instance of the following structure.
@@ -16908,7 +16981,7 @@ struct sqlite3 {
int errCode; /* Most recent error code (SQLITE_*) */
int errMask; /* & result codes with this before returning */
int iSysErrno; /* Errno value from last system error */
- u16 dbOptFlags; /* Flags to enable/disable optimizations */
+ u32 dbOptFlags; /* Flags to enable/disable optimizations */
u8 enc; /* Text encoding */
u8 autoCommit; /* The auto-commit flag. */
u8 temp_store; /* 1: file 2: memory 0: default */
@@ -16935,7 +17008,10 @@ struct sqlite3 {
unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
unsigned imposterTable : 1; /* Building an imposter table */
unsigned reopenMemdb : 1; /* ATTACH is really a reopen using MemDB */
+ unsigned bDropColumn : 1; /* Doing schema check after DROP COLUMN */
char **azInit; /* "type", "name", and "tbl_name" columns */
+ /* or if bDropColumn, then azInit[0] is the */
+ /* name of the column being dropped */
} init;
int nVdbeActive; /* Number of VDBEs currently running */
int nVdbeRead; /* Number of active VDBEs that read or write */
@@ -17115,24 +17191,26 @@ struct sqlite3 {
** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
** selectively disable various optimizations.
*/
-#define SQLITE_QueryFlattener 0x0001 /* Query flattening */
-#define SQLITE_WindowFunc 0x0002 /* Use xInverse for window functions */
-#define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
-#define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
-#define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
-#define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
-#define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
-#define SQLITE_Transitive 0x0080 /* Transitive constraints */
-#define SQLITE_OmitNoopJoin 0x0100 /* Omit unused tables in joins */
-#define SQLITE_CountOfView 0x0200 /* The count-of-view optimization */
-#define SQLITE_CursorHints 0x0400 /* Add OP_CursorHint opcodes */
-#define SQLITE_Stat4 0x0800 /* Use STAT4 data */
- /* TH3 expects the Stat4 ^^^^^^ value to be 0x0800. Don't change it */
-#define SQLITE_PushDown 0x1000 /* The push-down optimization */
-#define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */
-#define SQLITE_SkipScan 0x4000 /* Skip-scans */
-#define SQLITE_PropagateConst 0x8000 /* The constant propagation opt */
-#define SQLITE_AllOpts 0xffff /* All optimizations */
+#define SQLITE_QueryFlattener 0x00000001 /* Query flattening */
+#define SQLITE_WindowFunc 0x00000002 /* Use xInverse for window functions */
+#define SQLITE_GroupByOrder 0x00000004 /* GROUPBY cover of ORDERBY */
+#define SQLITE_FactorOutConst 0x00000008 /* Constant factoring */
+#define SQLITE_DistinctOpt 0x00000010 /* DISTINCT using indexes */
+#define SQLITE_CoverIdxScan 0x00000020 /* Covering index scans */
+#define SQLITE_OrderByIdxJoin 0x00000040 /* ORDER BY of joins via index */
+#define SQLITE_Transitive 0x00000080 /* Transitive constraints */
+#define SQLITE_OmitNoopJoin 0x00000100 /* Omit unused tables in joins */
+#define SQLITE_CountOfView 0x00000200 /* The count-of-view optimization */
+#define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */
+#define SQLITE_Stat4 0x00000800 /* Use STAT4 data */
+ /* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */
+#define SQLITE_PushDown 0x00001000 /* The push-down optimization */
+#define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
+#define SQLITE_SkipScan 0x00004000 /* Skip-scans */
+#define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
+#define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
+#define SQLITE_ExistsToIN 0x00020000 /* The EXISTS-to-IN optimization */
+#define SQLITE_AllOpts 0xffffffff /* All optimizations */
/*
** Macros for testing whether or not optimizations are enabled or disabled.
@@ -17288,6 +17366,9 @@ struct FuncDestructor {
** a single query. The iArg is ignored. The user-data is always set
** to a NULL pointer. The bNC parameter is not used.
**
+** MFUNCTION(zName, nArg, xPtr, xFunc)
+** For math-library functions. xPtr is an arbitrary pointer.
+**
** PURE_DATE(zName, nArg, iArg, bNC, xFunc)
** Used for "pure" date/time functions, this macro is like DFUNCTION
** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is
@@ -17323,6 +17404,9 @@ struct FuncDestructor {
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
{nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
+#define MFUNCTION(zName, nArg, xPtr, xFunc) \
+ {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
+ xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
@@ -17417,7 +17501,12 @@ struct Column {
u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */
};
-/* Allowed values for Column.colFlags:
+/* Allowed values for Column.colFlags.
+**
+** Constraints:
+** TF_HasVirtual == COLFLAG_VIRTUAL
+** TF_HasStored == COLFLAG_STORED
+** TF_HasHidden == COLFLAG_HIDDEN
*/
#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
@@ -17593,7 +17682,6 @@ struct Table {
#endif
Trigger *pTrigger; /* List of triggers stored in pSchema */
Schema *pSchema; /* Schema that contains this table */
- Table *pNextZombie; /* Next on the Parse.pZombieTab list */
};
/*
@@ -17607,11 +17695,12 @@ struct Table {
**
** Constraints:
**
-** TF_HasVirtual == COLFLAG_Virtual
-** TF_HasStored == COLFLAG_Stored
+** TF_HasVirtual == COLFLAG_VIRTUAL
+** TF_HasStored == COLFLAG_STORED
+** TF_HasHidden == COLFLAG_HIDDEN
*/
#define TF_Readonly 0x0001 /* Read-only system table */
-#define TF_Ephemeral 0x0002 /* An ephemeral table */
+#define TF_HasHidden 0x0002 /* Has one or more hidden columns */
#define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
#define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
#define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
@@ -17626,6 +17715,7 @@ struct Table {
#define TF_HasNotNull 0x0800 /* Contains NOT NULL constraints */
#define TF_Shadow 0x1000 /* True for a shadow table */
#define TF_HasStat4 0x2000 /* STAT4 info available for this table */
+#define TF_Ephemeral 0x4000 /* An ephemeral table */
/*
** Test to see whether or not a table is a virtual table. This is
@@ -17722,16 +17812,22 @@ struct FKey {
** is returned. REPLACE means that preexisting database rows that caused
** a UNIQUE constraint violation are removed so that the new insert or
** update can proceed. Processing continues and no error is reported.
+** UPDATE applies to insert operations only and means that the insert
+** is omitted and the DO UPDATE clause of an upsert is run instead.
**
-** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
+** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys.
** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign
-** key is set to NULL. CASCADE means that a DELETE or UPDATE of the
+** key is set to NULL. SETDFLT means that the foreign key is set
+** to its default value. CASCADE means that a DELETE or UPDATE of the
** referenced table row is propagated into the row that holds the
** foreign key.
**
+** The OE_Default value is a place holder that means to use whatever
+** conflict resolution algorthm is required from context.
+**
** The following symbolic values are used to record which type
-** of action to take.
+** of conflict resolution action to take.
*/
#define OE_None 0 /* There is no constraint to check */
#define OE_Rollback 1 /* Fail the operation and rollback the transaction */
@@ -17988,7 +18084,6 @@ struct AggInfo {
} *aFunc;
int nFunc; /* Number of entries in aFunc[] */
u32 selId; /* Select to which this AggInfo belongs */
- AggInfo *pNext; /* Next in list of them all */
};
/*
@@ -18117,7 +18212,7 @@ struct Expr {
** TK_VARIABLE: variable number (always >= 1).
** TK_SELECT_COLUMN: column of the result vector */
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
- i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
+ int iRightJoinTable; /* If EP_FromJoin, the right table of the join */
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
union {
Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
@@ -18159,7 +18254,7 @@ struct Expr {
#define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
#define EP_Subquery 0x200000 /* Tree contains a TK_SELECT operator */
-#define EP_Alias 0x400000 /* Is an alias for a result set column */
+ /* 0x400000 // Available */
#define EP_Leaf 0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
#define EP_WinFunc 0x1000000 /* TK_FUNCTION with Expr.y.pWin set */
#define EP_Subrtn 0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */
@@ -18307,6 +18402,45 @@ struct IdList {
int nId; /* Number of identifiers on the list */
};
+/*
+** The SrcItem object represents a single term in the FROM clause of a query.
+** The SrcList object is mostly an array of SrcItems.
+*/
+struct SrcItem {
+ Schema *pSchema; /* Schema to which this item is fixed */
+ char *zDatabase; /* Name of database holding this table */
+ char *zName; /* Name of the table */
+ char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
+ Table *pTab; /* An SQL table corresponding to zName */
+ Select *pSelect; /* A SELECT statement used in place of a table name */
+ int addrFillSub; /* Address of subroutine to manifest a subquery */
+ int regReturn; /* Register holding return address of addrFillSub */
+ int regResult; /* Registers holding results of a co-routine */
+ struct {
+ u8 jointype; /* Type of join between this table and the previous */
+ unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
+ unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
+ unsigned isTabFunc :1; /* True if table-valued-function syntax */
+ unsigned isCorrelated :1; /* True if sub-query is correlated */
+ unsigned viaCoroutine :1; /* Implemented as a co-routine */
+ unsigned isRecursive :1; /* True for recursive reference in WITH */
+ unsigned fromDDL :1; /* Comes from sqlite_schema */
+ unsigned isCte :1; /* This is a CTE */
+ } fg;
+ int iCursor; /* The VDBE cursor number used to access this table */
+ Expr *pOn; /* The ON clause of a join */
+ IdList *pUsing; /* The USING clause of a join */
+ Bitmask colUsed; /* Bit N (1<" clause */
+ ExprList *pFuncArg; /* Arguments to table-valued-function */
+ } u1;
+ union {
+ Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
+ CteUse *pCteUse; /* CTE Usage info info fg.isCte is true */
+ } u2;
+};
+
/*
** The following structure describes the FROM clause of a SELECT statement.
** Each table or subquery in the FROM clause is a separate element of
@@ -18329,36 +18463,7 @@ struct IdList {
struct SrcList {
int nSrc; /* Number of tables or subqueries in the FROM clause */
u32 nAlloc; /* Number of entries allocated in a[] below */
- struct SrcList_item {
- Schema *pSchema; /* Schema to which this item is fixed */
- char *zDatabase; /* Name of database holding this table */
- char *zName; /* Name of the table */
- char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
- Table *pTab; /* An SQL table corresponding to zName */
- Select *pSelect; /* A SELECT statement used in place of a table name */
- int addrFillSub; /* Address of subroutine to manifest a subquery */
- int regReturn; /* Register holding return address of addrFillSub */
- int regResult; /* Registers holding results of a co-routine */
- struct {
- u8 jointype; /* Type of join between this table and the previous */
- unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
- unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
- unsigned isTabFunc :1; /* True if table-valued-function syntax */
- unsigned isCorrelated :1; /* True if sub-query is correlated */
- unsigned viaCoroutine :1; /* Implemented as a co-routine */
- unsigned isRecursive :1; /* True for recursive reference in WITH */
- unsigned fromDDL :1; /* Comes from sqlite_schema */
- } fg;
- int iCursor; /* The VDBE cursor number used to access this table */
- Expr *pOn; /* The ON clause of a join */
- IdList *pUsing; /* The USING clause of a join */
- Bitmask colUsed; /* Bit N (1<" clause */
- ExprList *pFuncArg; /* Arguments to table-valued-function */
- } u1;
- Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
- } a[1]; /* One entry for each identifier on the list */
+ SrcItem a[1]; /* One entry for each identifier on the list */
};
/*
@@ -18434,6 +18539,7 @@ struct NameContext {
ExprList *pEList; /* Optional list of result-set columns */
AggInfo *pAggInfo; /* Information about aggregates at this level */
Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */
+ int iBaseReg; /* For TK_REGISTER when parsing RETURNING */
} uNC;
NameContext *pNext; /* Next outer name context. NULL for outermost */
int nRef; /* Number of names resolved by this context */
@@ -18462,6 +18568,7 @@ struct NameContext {
#define NC_UEList 0x00080 /* True if uNC.pEList is used */
#define NC_UAggInfo 0x00100 /* True if uNC.pAggInfo is used */
#define NC_UUpsert 0x00200 /* True if uNC.pUpsert is used */
+#define NC_UBaseReg 0x00400 /* True if uNC.iBaseReg is used */
#define NC_MinMaxAgg 0x01000 /* min/max aggregates seen. See note above */
#define NC_Complex 0x02000 /* True if a function or subquery seen */
#define NC_AllowWin 0x04000 /* Window functions are allowed here */
@@ -18485,15 +18592,21 @@ struct NameContext {
** WHERE clause is omitted.
*/
struct Upsert {
- ExprList *pUpsertTarget; /* Optional description of conflicting index */
+ ExprList *pUpsertTarget; /* Optional description of conflict target */
Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
- /* The fields above comprise the parse tree for the upsert clause.
- ** The fields below are used to transfer information from the INSERT
- ** processing down into the UPDATE processing while generating code.
- ** Upsert owns the memory allocated above, but not the memory below. */
- Index *pUpsertIdx; /* Constraint that pUpsertTarget identifies */
+ Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */
+ u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */
+ /* Above this point is the parse tree for the ON CONFLICT clauses.
+ ** The next group of fields stores intermediate data. */
+ void *pToFree; /* Free memory when deleting the Upsert object */
+ /* All fields above are owned by the Upsert object and must be freed
+ ** when the Upsert is destroyed. The fields below are used to transfer
+ ** information from the INSERT processing down into the UPDATE processing
+ ** while generating code. The fields below are owned by the INSERT
+ ** statement and will be freed by INSERT processing. */
+ Index *pUpsertIdx; /* UNIQUE constraint specified by pUpsertTarget */
SrcList *pUpsertSrc; /* Table to be updated */
int regData; /* First register holding array of VALUES */
int iDataCur; /* Index of the data cursor */
@@ -18573,6 +18686,8 @@ struct Select {
#define SF_View 0x0200000 /* SELECT statement is a view */
#define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */
#define SF_UpdateFrom 0x0800000 /* Statement is an UPDATE...FROM */
+#define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */
+#define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */
/*
** The results of a SELECT can be distributed in several ways, as defined
@@ -18743,6 +18858,17 @@ struct TriggerPrg {
# define DbMaskNonZero(M) (M)!=0
#endif
+/*
+** An instance of the ParseCleanup object specifies an operation that
+** should be performed after parsing to deallocation resources obtained
+** during the parse and which are no longer needed.
+*/
+struct ParseCleanup {
+ ParseCleanup *pNext; /* Next cleanup task */
+ void *pPtr; /* Pointer to object to deallocate */
+ void (*xCleanup)(sqlite3*,void*); /* Deallocation routine */
+};
+
/*
** An SQL parser context. A copy of this structure is passed through
** the parser and down into all the parser action routine in order to
@@ -18774,6 +18900,9 @@ struct Parse {
u8 okConstFactor; /* OK to factor out constants */
u8 disableLookaside; /* Number of times lookaside has been disabled */
u8 disableVtab; /* Disable all virtual tables for this parse */
+#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
+ u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
+#endif
int nRangeReg; /* Size of the temporary register block */
int iRangeReg; /* First register in temporary register block */
int nErr; /* Number of errors seen */
@@ -18801,12 +18930,15 @@ struct Parse {
Parse *pToplevel; /* Parse structure for main program (or NULL) */
Table *pTriggerTab; /* Table triggers are being coded for */
Parse *pParentParse; /* Parent parser if this parser is nested */
- AggInfo *pAggList; /* List of all AggInfo objects */
- int addrCrTab; /* Address of OP_CreateBtree opcode on CREATE TABLE */
+ union {
+ int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
+ Returning *pReturning; /* The RETURNING clause */
+ } u1;
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
u32 oldmask; /* Mask of old.* columns referenced */
u32 newmask; /* Mask of new.* columns referenced */
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
+ u8 bReturning; /* Coding a RETURNING trigger */
u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
u8 disableTriggers; /* True to disable triggers */
@@ -18852,10 +18984,9 @@ struct Parse {
Token sArg; /* Complete text of a module argument */
Table **apVtabLock; /* Pointer to virtual tables needing locking */
#endif
- Table *pZombieTab; /* List of Table objects to delete after code gen */
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
With *pWith; /* Current WITH clause, or NULL */
- With *pWithToFree; /* Free this WITH object at the end of the parse */
+ ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
#ifndef SQLITE_OMIT_ALTERTABLE
RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
#endif
@@ -18935,6 +19066,7 @@ struct AuthContext {
#define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */
#define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */
#define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */
+#define OPFLAG_PREFORMAT 0x80 /* OP_Insert uses preformatted cell */
/*
* Each trigger present in the database schema is stored as an instance of
@@ -18956,6 +19088,7 @@ struct Trigger {
char *table; /* The table or view to which the trigger applies */
u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT */
u8 tr_tm; /* One of TRIGGER_BEFORE, TRIGGER_AFTER */
+ u8 bReturning; /* This trigger implements a RETURNING clause */
Expr *pWhen; /* The WHEN clause of the expression (may be NULL) */
IdList *pColumns; /* If this is an UPDATE OF trigger,
the is stored here */
@@ -19014,14 +19147,15 @@ struct Trigger {
*
*/
struct TriggerStep {
- u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
+ u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT,
+ ** or TK_RETURNING */
u8 orconf; /* OE_Rollback etc. */
Trigger *pTrig; /* The trigger that this step is a part of */
Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
SrcList *pFrom; /* FROM clause for UPDATE statement (if any) */
Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
- ExprList *pExprList; /* SET clause for UPDATE */
+ ExprList *pExprList; /* SET clause for UPDATE, or RETURNING clause */
IdList *pIdList; /* Column names for INSERT */
Upsert *pUpsert; /* Upsert clauses on an INSERT */
char *zSpan; /* Original SQL text of this command */
@@ -19030,18 +19164,16 @@ struct TriggerStep {
};
/*
-** The following structure contains information used by the sqliteFix...
-** routines as they walk the parse tree to make database references
-** explicit.
+** Information about a RETURNING clause
*/
-typedef struct DbFixer DbFixer;
-struct DbFixer {
- Parse *pParse; /* The parsing context. Error messages written here */
- Schema *pSchema; /* Fix items to this schema */
- u8 bTemp; /* True for TEMP schema entries */
- const char *zDb; /* Make sure all objects are contained in this database */
- const char *zType; /* Type of the container - used for error messages */
- const Token *pName; /* Name of the container - used for error messages */
+struct Returning {
+ Parse *pParse; /* The parse that includes the RETURNING clause */
+ ExprList *pReturnEL; /* List of expressions to return */
+ Trigger retTrig; /* The transient trigger that implements RETURNING */
+ TriggerStep retTStep; /* The trigger step */
+ int iRetCur; /* Transient table holding RETURNING results */
+ int nRetCol; /* Number of in pReturnEL after expansion */
+ int iRetReg; /* Register array for holding a row of RETURNING */
};
/*
@@ -19081,7 +19213,8 @@ typedef struct {
/*
** Allowed values for mInitFlags
*/
-#define INITFLAG_AlterTable 0x0001 /* This is a reparse after ALTER TABLE */
+#define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
+#define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
/*
** Structure containing global configuration data for the SQLite library.
@@ -19193,10 +19326,26 @@ struct Walker {
struct WhereConst *pConst; /* WHERE clause constants */
struct RenameCtx *pRename; /* RENAME COLUMN context */
struct Table *pTab; /* Table of generated column */
- struct SrcList_item *pSrcItem; /* A single FROM clause item */
+ SrcItem *pSrcItem; /* A single FROM clause item */
+ DbFixer *pFix;
} u;
};
+/*
+** The following structure contains information used by the sqliteFix...
+** routines as they walk the parse tree to make database references
+** explicit.
+*/
+struct DbFixer {
+ Parse *pParse; /* The parsing context. Error messages written here */
+ Walker w; /* Walker object */
+ Schema *pSchema; /* Fix items to this schema */
+ u8 bTemp; /* True for TEMP schema entries */
+ const char *zDb; /* Make sure all objects are contained in this database */
+ const char *zType; /* Type of the container - used for error messages */
+ const Token *pName; /* Name of the container - used for error messages */
+};
+
/* Forward declarations */
SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*);
@@ -19222,20 +19371,55 @@ SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
#define WRC_Abort 2 /* Abandon the tree walk */
/*
-** An instance of this structure represents a set of one or more CTEs
-** (common table expressions) created by a single WITH clause.
+** A single common table expression
+*/
+struct Cte {
+ char *zName; /* Name of this CTE */
+ ExprList *pCols; /* List of explicit column names, or NULL */
+ Select *pSelect; /* The definition of this CTE */
+ const char *zCteErr; /* Error message for circular references */
+ CteUse *pUse; /* Usage information for this CTE */
+ u8 eM10d; /* The MATERIALIZED flag */
+};
+
+/*
+** Allowed values for the materialized flag (eM10d):
+*/
+#define M10d_Yes 0 /* AS MATERIALIZED */
+#define M10d_Any 1 /* Not specified. Query planner's choice */
+#define M10d_No 2 /* AS NOT MATERIALIZED */
+
+/*
+** An instance of the With object represents a WITH clause containing
+** one or more CTEs (common table expressions).
*/
struct With {
- int nCte; /* Number of CTEs in the WITH clause */
- With *pOuter; /* Containing WITH clause, or NULL */
- struct Cte { /* For each CTE in the WITH clause.... */
- char *zName; /* Name of this CTE */
- ExprList *pCols; /* List of explicit column names, or NULL */
- Select *pSelect; /* The definition of this CTE */
- const char *zCteErr; /* Error message for circular references */
- } a[1];
+ int nCte; /* Number of CTEs in the WITH clause */
+ With *pOuter; /* Containing WITH clause, or NULL */
+ Cte a[1]; /* For each CTE in the WITH clause.... */
};
+/*
+** The Cte object is not guaranteed to persist for the entire duration
+** of code generation. (The query flattener or other parser tree
+** edits might delete it.) The following object records information
+** about each Common Table Expression that must be preserved for the
+** duration of the parse.
+**
+** The CteUse objects are freed using sqlite3ParserAddCleanup() rather
+** than sqlite3SelectDelete(), which is what enables them to persist
+** until the end of code generation.
+*/
+struct CteUse {
+ int nUse; /* Number of users of this CTE */
+ int addrM9e; /* Start of subroutine to compute materialization */
+ int regRtn; /* Return address register for addrM9e subroutine */
+ int iCur; /* Ephemeral table holding the materialization */
+ LogEst nRowEst; /* Estimated number of rows in the table */
+ u8 eM10d; /* The MATERIALIZED flag */
+};
+
+
#ifdef SQLITE_DEBUG
/*
** An instance of the TreeView object is used for printing the content of
@@ -19313,7 +19497,6 @@ SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*, int);
SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*);
SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int);
SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*);
-SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*);
SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p);
SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p);
@@ -19582,6 +19765,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*);
SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
+SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*);
SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
@@ -19630,6 +19814,7 @@ SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*)
SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*);
SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
+SQLITE_PRIVATE void sqlite3AddReturning(Parse*,ExprList*);
SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
sqlite3_vfs**,char**,char **);
#define sqlite3CodecQueryParameters(A,B,C) 0
@@ -19695,7 +19880,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, T
Token*, Select*, Expr*, IdList*);
SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);
SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*);
-SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
+SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, SrcItem *);
SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*);
SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*);
SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);
@@ -19723,6 +19908,7 @@ SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo*);
+SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe*,WhereInfo*);
SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*);
SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*);
SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*);
@@ -19756,7 +19942,7 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*);
#define LOCATE_VIEW 0x01
#define LOCATE_NOERR 0x02
SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);
-SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *);
+SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,SrcItem *);
SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
@@ -19884,6 +20070,7 @@ SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(Parse*, TriggerStep*);
#endif
SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
+SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
@@ -19906,7 +20093,6 @@ SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Tok
SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*);
SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*);
SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*);
-SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);
SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64);
SQLITE_PRIVATE void sqlite3Int64ToText(i64,char*);
@@ -19969,6 +20155,7 @@ SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
@@ -20032,7 +20219,6 @@ SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
-SQLITE_API extern u32 sqlite3_unsupported_selecttrace;
#ifndef SQLITE_OMIT_WSD
SQLITE_PRIVATE int sqlite3PendingByte;
#endif
@@ -20051,6 +20237,7 @@ SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
+SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
SQLITE_PRIVATE int sqlite3MatchEName(
const struct ExprList_item*,
@@ -20068,6 +20255,7 @@ SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
+SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, Token*);
SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
@@ -20091,6 +20279,7 @@ SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo*);
SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo*);
SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*);
SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoFromExprList(Parse*, ExprList*, int, int);
+SQLITE_PRIVATE const char *sqlite3SelectOpName(int);
SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse*, ExprList*);
#ifdef SQLITE_DEBUG
@@ -20221,6 +20410,7 @@ SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
+SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
#ifdef SQLITE_ENABLE_NORMALIZE
SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
#endif
@@ -20235,23 +20425,32 @@ SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);
SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
#endif
#ifndef SQLITE_OMIT_CTE
-SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*);
+SQLITE_PRIVATE Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*,u8);
+SQLITE_PRIVATE void sqlite3CteDelete(sqlite3*,Cte*);
+SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Cte*);
SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*);
SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
#else
-#define sqlite3WithPush(x,y,z)
-#define sqlite3WithDelete(x,y)
+# define sqlite3CteNew(P,T,E,S) ((void*)0)
+# define sqlite3CteDelete(D,C)
+# define sqlite3CteWithAdd(P,W,C) ((void*)0)
+# define sqlite3WithDelete(x,y)
+# define sqlite3WithPush(x,y,z)
#endif
#ifndef SQLITE_OMIT_UPSERT
-SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*);
+SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
+SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*);
+SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*);
#else
-#define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0)
+#define sqlite3UpsertNew(u,v,w,x,y,z) ((Upsert*)0)
#define sqlite3UpsertDelete(x,y)
-#define sqlite3UpsertDup(x,y) ((Upsert*)0)
+#define sqlite3UpsertDup(x,y) ((Upsert*)0)
+#define sqlite3UpsertOfIndex(x,y) ((Upsert*)0)
+#define sqlite3UpsertNextIsIPK(x) 0
#endif
@@ -20747,9 +20946,10 @@ SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
#endif
/*
-** Flags for select tracing and the ".selecttrace" macro of the CLI
+** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS.
*/
-SQLITE_API u32 sqlite3_unsupported_selecttrace = 0;
+SQLITE_PRIVATE u32 sqlite3SelectTrace = 0;
+SQLITE_PRIVATE u32 sqlite3WhereTrace = 0;
/* #include "opcodes.h" */
/*
@@ -20873,6 +21073,7 @@ struct VdbeCursor {
Bool isEphemeral:1; /* True for an ephemeral table */
Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
+ Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */
u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
Btree *pBtx; /* Separate file holding temporary table */
i64 seqCount; /* Sequence counter */
@@ -21168,7 +21369,7 @@ struct Vdbe {
Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
Parse *pParse; /* Parsing context used to create this Vdbe */
ynVar nVar; /* Number of entries in aVar[] */
- u32 magic; /* Magic number for sanity checking */
+ u32 iVdbeMagic; /* Magic number defining state of the SQL statement */
int nMem; /* Number of memory locations currently allocated */
int nCursor; /* Number of slots in apCsr[] */
u32 cacheCtr; /* VdbeCursor row cache generation counter */
@@ -22673,6 +22874,7 @@ static int isDate(
int eType;
memset(p, 0, sizeof(*p));
if( argc==0 ){
+ if( !sqlite3NotPureFunc(context) ) return 1;
return setDateTimeToCurrent(context, p);
}
if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT
@@ -23173,6 +23375,8 @@ SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
#ifdef SQLITE_TEST
if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
&& op!=SQLITE_FCNTL_LOCK_TIMEOUT
+ && op!=SQLITE_FCNTL_CKPT_DONE
+ && op!=SQLITE_FCNTL_CKPT_START
){
/* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
** is using a regular VFS, it is called after the corresponding
@@ -23183,7 +23387,12 @@ SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
** The core must call OsFileControl() though, not OsFileControlHint(),
** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
** means the commit really has failed and an error should be returned
- ** to the user. */
+ ** to the user.
+ **
+ ** The CKPT_DONE and CKPT_START file-controls are write-only signals
+ ** to the cksumvfs. Their return code is meaningless and is ignored
+ ** by the SQLite core, so there is no point in simulating OOMs for them.
+ */
DO_OS_MALLOC_TEST(id);
}
#endif
@@ -29082,7 +29291,7 @@ SQLITE_API void sqlite3_str_vappendf(
case etSRCLIST: {
SrcList *pSrc;
int k;
- struct SrcList_item *pItem;
+ SrcItem *pItem;
if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
pSrc = va_arg(ap, SrcList*);
k = va_arg(ap, int);
@@ -29147,7 +29356,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
}else{
char *zOld = isMalloced(p) ? p->zText : 0;
i64 szNew = p->nChar;
- szNew += N + 1;
+ szNew += (sqlite3_int64)N + 1;
if( szNew+p->nChar<=p->mxAlloc ){
/* Force exponential buffer size growth as long as it does not overflow,
** to avoid having to call this routine too often */
@@ -29650,7 +29859,10 @@ SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 m
}
sqlite3_str_appendf(&x, ")");
}
- sqlite3_str_appendf(&x, " AS");
+ if( pCte->pUse ){
+ sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse,
+ pCte->pUse->nUse);
+ }
sqlite3StrAccumFinish(&x);
sqlite3TreeViewItem(pView, zLine, inCte-1);
sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
@@ -29666,7 +29878,7 @@ SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 m
SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
int i;
for(i=0; inSrc; i++){
- const struct SrcList_item *pItem = &pSrc->a[i];
+ const SrcItem *pItem = &pSrc->a[i];
StrAccum x;
char zLine[100];
sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
@@ -29689,6 +29901,9 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc)
if( pItem->fg.fromDDL ){
sqlite3_str_appendf(&x, " DDL");
}
+ if( pItem->fg.isCte ){
+ sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
+ }
sqlite3StrAccumFinish(&x);
sqlite3TreeViewItem(pView, zLine, inSrc-1);
if( pItem->pSelect ){
@@ -31385,6 +31600,16 @@ SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
}
+/*
+** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
+** and error message.
+*/
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
+ assert( db!=0 );
+ db->errCode = SQLITE_OK;
+ if( db->pErr ) sqlite3ValueSetNull(db->pErr);
+}
+
/*
** Load the sqlite3.iSysErrno field if that is an appropriate thing
** to do based on the SQLite error code in rc.
@@ -33331,103 +33556,105 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
/* 77 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
/* 78 */ "SCopy" OpHelp("r[P2]=r[P1]"),
/* 79 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
- /* 80 */ "ResultRow" OpHelp("output=r[P1@P2]"),
- /* 81 */ "CollSeq" OpHelp(""),
- /* 82 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
- /* 83 */ "RealAffinity" OpHelp(""),
- /* 84 */ "Cast" OpHelp("affinity(r[P1])"),
- /* 85 */ "Permutation" OpHelp(""),
- /* 86 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
- /* 87 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
- /* 88 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
- /* 89 */ "Column" OpHelp("r[P3]=PX"),
- /* 90 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
- /* 91 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
- /* 92 */ "Count" OpHelp("r[P2]=count()"),
- /* 93 */ "ReadCookie" OpHelp(""),
- /* 94 */ "SetCookie" OpHelp(""),
- /* 95 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
- /* 96 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
- /* 97 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
- /* 98 */ "OpenDup" OpHelp(""),
- /* 99 */ "OpenAutoindex" OpHelp("nColumn=P2"),
- /* 100 */ "OpenEphemeral" OpHelp("nColumn=P2"),
- /* 101 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
- /* 102 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
- /* 103 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<>r[P1]"),
- /* 105 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
- /* 106 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
- /* 107 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
- /* 108 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
- /* 109 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
- /* 110 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
- /* 111 */ "SorterOpen" OpHelp(""),
- /* 112 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
- /* 113 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
- /* 114 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
- /* 115 */ "String8" OpHelp("r[P2]='P4'"),
- /* 116 */ "Close" OpHelp(""),
- /* 117 */ "ColumnsUsed" OpHelp(""),
- /* 118 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
- /* 119 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
- /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
- /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
- /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
- /* 123 */ "Delete" OpHelp(""),
- /* 124 */ "ResetCount" OpHelp(""),
- /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
- /* 126 */ "SorterData" OpHelp("r[P2]=data"),
- /* 127 */ "RowData" OpHelp("r[P2]=data"),
- /* 128 */ "Rowid" OpHelp("r[P2]=rowid"),
- /* 129 */ "NullRow" OpHelp(""),
- /* 130 */ "SeekEnd" OpHelp(""),
- /* 131 */ "IdxInsert" OpHelp("key=r[P2]"),
- /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
- /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
- /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
- /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"),
- /* 136 */ "FinishSeek" OpHelp(""),
- /* 137 */ "Destroy" OpHelp(""),
- /* 138 */ "Clear" OpHelp(""),
- /* 139 */ "ResetSorter" OpHelp(""),
- /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
- /* 141 */ "SqlExec" OpHelp(""),
- /* 142 */ "ParseSchema" OpHelp(""),
- /* 143 */ "LoadAnalysis" OpHelp(""),
- /* 144 */ "DropTable" OpHelp(""),
- /* 145 */ "DropIndex" OpHelp(""),
- /* 146 */ "DropTrigger" OpHelp(""),
- /* 147 */ "IntegrityCk" OpHelp(""),
- /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
- /* 149 */ "Param" OpHelp(""),
- /* 150 */ "Real" OpHelp("r[P2]=P4"),
- /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
- /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
- /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
- /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
- /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
- /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
- /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
- /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
- /* 159 */ "Expire" OpHelp(""),
- /* 160 */ "CursorLock" OpHelp(""),
- /* 161 */ "CursorUnlock" OpHelp(""),
- /* 162 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
- /* 163 */ "VBegin" OpHelp(""),
- /* 164 */ "VCreate" OpHelp(""),
- /* 165 */ "VDestroy" OpHelp(""),
- /* 166 */ "VOpen" OpHelp(""),
- /* 167 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
- /* 168 */ "VRename" OpHelp(""),
- /* 169 */ "Pagecount" OpHelp(""),
- /* 170 */ "MaxPgcnt" OpHelp(""),
- /* 171 */ "Trace" OpHelp(""),
- /* 172 */ "CursorHint" OpHelp(""),
- /* 173 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
- /* 174 */ "Noop" OpHelp(""),
- /* 175 */ "Explain" OpHelp(""),
- /* 176 */ "Abortable" OpHelp(""),
+ /* 80 */ "ChngCntRow" OpHelp("output=r[P1]"),
+ /* 81 */ "ResultRow" OpHelp("output=r[P1@P2]"),
+ /* 82 */ "CollSeq" OpHelp(""),
+ /* 83 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
+ /* 84 */ "RealAffinity" OpHelp(""),
+ /* 85 */ "Cast" OpHelp("affinity(r[P1])"),
+ /* 86 */ "Permutation" OpHelp(""),
+ /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
+ /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
+ /* 89 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
+ /* 90 */ "Column" OpHelp("r[P3]=PX"),
+ /* 91 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
+ /* 92 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
+ /* 93 */ "Count" OpHelp("r[P2]=count()"),
+ /* 94 */ "ReadCookie" OpHelp(""),
+ /* 95 */ "SetCookie" OpHelp(""),
+ /* 96 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
+ /* 97 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
+ /* 98 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
+ /* 99 */ "OpenDup" OpHelp(""),
+ /* 100 */ "OpenAutoindex" OpHelp("nColumn=P2"),
+ /* 101 */ "OpenEphemeral" OpHelp("nColumn=P2"),
+ /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
+ /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
+ /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<>r[P1]"),
+ /* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
+ /* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
+ /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
+ /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
+ /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
+ /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
+ /* 112 */ "SorterOpen" OpHelp(""),
+ /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
+ /* 114 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
+ /* 115 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
+ /* 116 */ "String8" OpHelp("r[P2]='P4'"),
+ /* 117 */ "Close" OpHelp(""),
+ /* 118 */ "ColumnsUsed" OpHelp(""),
+ /* 119 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
+ /* 120 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
+ /* 121 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
+ /* 122 */ "NewRowid" OpHelp("r[P2]=rowid"),
+ /* 123 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
+ /* 124 */ "RowCell" OpHelp(""),
+ /* 125 */ "Delete" OpHelp(""),
+ /* 126 */ "ResetCount" OpHelp(""),
+ /* 127 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
+ /* 128 */ "SorterData" OpHelp("r[P2]=data"),
+ /* 129 */ "RowData" OpHelp("r[P2]=data"),
+ /* 130 */ "Rowid" OpHelp("r[P2]=rowid"),
+ /* 131 */ "NullRow" OpHelp(""),
+ /* 132 */ "SeekEnd" OpHelp(""),
+ /* 133 */ "IdxInsert" OpHelp("key=r[P2]"),
+ /* 134 */ "SorterInsert" OpHelp("key=r[P2]"),
+ /* 135 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
+ /* 136 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
+ /* 137 */ "IdxRowid" OpHelp("r[P2]=rowid"),
+ /* 138 */ "FinishSeek" OpHelp(""),
+ /* 139 */ "Destroy" OpHelp(""),
+ /* 140 */ "Clear" OpHelp(""),
+ /* 141 */ "ResetSorter" OpHelp(""),
+ /* 142 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
+ /* 143 */ "SqlExec" OpHelp(""),
+ /* 144 */ "ParseSchema" OpHelp(""),
+ /* 145 */ "LoadAnalysis" OpHelp(""),
+ /* 146 */ "DropTable" OpHelp(""),
+ /* 147 */ "DropIndex" OpHelp(""),
+ /* 148 */ "DropTrigger" OpHelp(""),
+ /* 149 */ "IntegrityCk" OpHelp(""),
+ /* 150 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
+ /* 151 */ "Param" OpHelp(""),
+ /* 152 */ "Real" OpHelp("r[P2]=P4"),
+ /* 153 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
+ /* 154 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
+ /* 155 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
+ /* 156 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
+ /* 157 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
+ /* 158 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
+ /* 159 */ "AggValue" OpHelp("r[P3]=value N=P2"),
+ /* 160 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
+ /* 161 */ "Expire" OpHelp(""),
+ /* 162 */ "CursorLock" OpHelp(""),
+ /* 163 */ "CursorUnlock" OpHelp(""),
+ /* 164 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
+ /* 165 */ "VBegin" OpHelp(""),
+ /* 166 */ "VCreate" OpHelp(""),
+ /* 167 */ "VDestroy" OpHelp(""),
+ /* 168 */ "VOpen" OpHelp(""),
+ /* 169 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
+ /* 170 */ "VRename" OpHelp(""),
+ /* 171 */ "Pagecount" OpHelp(""),
+ /* 172 */ "MaxPgcnt" OpHelp(""),
+ /* 173 */ "Trace" OpHelp(""),
+ /* 174 */ "CursorHint" OpHelp(""),
+ /* 175 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
+ /* 176 */ "Noop" OpHelp(""),
+ /* 177 */ "Explain" OpHelp(""),
+ /* 178 */ "Abortable" OpHelp(""),
};
return azName[i];
}
@@ -39996,7 +40223,8 @@ static int unixBackupDir(const char *z, int *pJ){
int j = *pJ;
int i;
if( j<=0 ) return 0;
- for(i=j-1; ALWAYS(i>0) && z[i-1]!='/'; i--){}
+ for(i=j-1; i>0 && z[i-1]!='/'; i--){}
+ if( i==0 ) return 0;
if( z[i]=='.' && i==j-2 && z[i+1]=='.' ) return 0;
*pJ = i-1;
return 1;
@@ -50436,6 +50664,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
p->page.pExtra = &p[1];
p->isBulkLocal = 0;
p->isAnchor = 0;
+ p->pLruPrev = 0; /* Initializing this saves a valgrind error */
}
(*pCache->pnPurgeable)++;
return p;
@@ -52354,6 +52583,7 @@ struct PagerSavepoint {
Bitvec *pInSavepoint; /* Set of pages in this savepoint */
Pgno nOrig; /* Original number of pages in file */
Pgno iSubRec; /* Index of first record in sub-journal */
+ int bTruncateOnRelease; /* If stmt journal may be truncated on RELEASE */
#ifndef SQLITE_OMIT_WAL
u32 aWalData[WAL_SAVEPOINT_NDATA]; /* WAL savepoint context */
#endif
@@ -52989,6 +53219,9 @@ static int subjRequiresPage(PgHdr *pPg){
for(i=0; inSavepoint; i++){
p = &pPager->aSavepoint[i];
if( p->nOrig>=pgno && 0==sqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){
+ for(i=i+1; inSavepoint; i++){
+ pPager->aSavepoint[i].bTruncateOnRelease = 0;
+ }
return 1;
}
}
@@ -58767,6 +59000,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
}
aNew[ii].iSubRec = pPager->nSubRec;
aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);
+ aNew[ii].bTruncateOnRelease = 1;
if( !aNew[ii].pInSavepoint ){
return SQLITE_NOMEM_BKPT;
}
@@ -58848,13 +59082,15 @@ SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
/* If this is a release of the outermost savepoint, truncate
** the sub-journal to zero bytes in size. */
if( op==SAVEPOINT_RELEASE ){
- if( nNew==0 && isOpen(pPager->sjfd) ){
+ PagerSavepoint *pRel = &pPager->aSavepoint[nNew];
+ if( pRel->bTruncateOnRelease && isOpen(pPager->sjfd) ){
/* Only truncate if it is an in-memory sub-journal. */
if( sqlite3JournalIsInMemory(pPager->sjfd) ){
- rc = sqlite3OsTruncate(pPager->sjfd, 0);
+ i64 sz = (pPager->pageSize+4)*pRel->iSubRec;
+ rc = sqlite3OsTruncate(pPager->sjfd, sz);
assert( rc==SQLITE_OK );
}
- pPager->nSubRec = 0;
+ pPager->nSubRec = pRel->iSubRec;
}
}
/* Else this is a rollback operation, playback the specified savepoint.
@@ -64045,7 +64281,7 @@ struct Btree {
u8 hasIncrblobCur; /* True if there are one or more Incrblob cursors */
int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
int nBackup; /* Number of backup operations reading this btree */
- u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
+ u32 iBDataVersion; /* Combines with pBt->pPager->iDataVersion */
Btree *pNext; /* List of other sharable Btrees from the same db */
Btree *pPrev; /* Back pointer of the same list */
#ifdef SQLITE_DEBUG
@@ -64150,6 +64386,7 @@ struct BtShared {
Btree *pWriter; /* Btree with currently open write transaction */
#endif
u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */
+ int nPreformatSize; /* Size of last cell written by TransferRow() */
};
/*
@@ -65863,6 +66100,24 @@ static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
}
+/*
+** Given a record with nPayload bytes of payload stored within btree
+** page pPage, return the number of bytes of payload stored locally.
+*/
+static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){
+ int maxLocal; /* Maximum amount of payload held locally */
+ maxLocal = pPage->maxLocal;
+ if( nPayload<=maxLocal ){
+ return nPayload;
+ }else{
+ int minLocal; /* Minimum amount of payload held locally */
+ int surplus; /* Overflow payload available for local storage */
+ minLocal = pPage->minLocal;
+ surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4);
+ return ( surplus <= maxLocal ) ? surplus : minLocal;
+ }
+}
+
/*
** The following routines are implementations of the MemPage.xParseCell()
** method.
@@ -67439,19 +67694,23 @@ static void freeTempSpace(BtShared *pBt){
*/
SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){
BtShared *pBt = p->pBt;
- BtCursor *pCur;
/* Close all cursors opened via this handle. */
assert( sqlite3_mutex_held(p->db->mutex) );
sqlite3BtreeEnter(p);
- pCur = pBt->pCursor;
- while( pCur ){
- BtCursor *pTmp = pCur;
- pCur = pCur->pNext;
- if( pTmp->pBtree==p ){
- sqlite3BtreeCloseCursor(pTmp);
+
+ /* Verify that no other cursors have this Btree open */
+#ifdef SQLITE_DEBUG
+ {
+ BtCursor *pCur = pBt->pCursor;
+ while( pCur ){
+ BtCursor *pTmp = pCur;
+ pCur = pCur->pNext;
+ assert( pTmp->pBtree!=p );
+
}
}
+#endif
/* Rollback any active transaction and free the handle structure.
** The call to sqlite3BtreeRollback() drops any table-locks held by
@@ -67603,6 +67862,7 @@ SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve,
((pageSize-1)&pageSize)==0 ){
assert( (pageSize & 7)==0 );
assert( !pBt->pCursor );
+ if( nReserve>32 && pageSize==512 ) pageSize = 1024;
pBt->pageSize = (u32)pageSize;
freeTempSpace(pBt);
}
@@ -68832,7 +69092,7 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
sqlite3BtreeLeave(p);
return rc;
}
- p->iDataVersion--; /* Compensate for pPager->iDataVersion++; */
+ p->iBDataVersion--; /* Compensate for pPager->iDataVersion++; */
pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
}
@@ -69242,7 +69502,14 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
unlockBtreeIfUnused(pBt);
sqlite3_free(pCur->aOverflow);
sqlite3_free(pCur->pKey);
- sqlite3BtreeLeave(pBtree);
+ if( (pBt->openFlags & BTREE_SINGLE) && pBt->pCursor==0 ){
+ /* Since the BtShared is not sharable, there is no need to
+ ** worry about the missing sqlite3BtreeLeave() call here. */
+ assert( pBtree->sharable==0 );
+ sqlite3BtreeClose(pBtree);
+ }else{
+ sqlite3BtreeLeave(pBtree);
+ }
pCur->pBtree = 0;
}
return SQLITE_OK;
@@ -72338,7 +72605,9 @@ static int balance_nonroot(
}
pgno = get4byte(pRight);
while( 1 ){
- rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
+ if( rc==SQLITE_OK ){
+ rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
+ }
if( rc ){
memset(apOld, 0, (i+1)*sizeof(MemPage*));
goto balance_cleanup;
@@ -72377,12 +72646,10 @@ static int balance_nonroot(
if( pBt->btsFlags & BTS_FAST_SECURE ){
int iOff;
+ /* If the following if() condition is not true, the db is corrupted.
+ ** The call to dropCell() below will detect this. */
iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
- if( (iOff+szNew[i])>(int)pBt->usableSize ){
- rc = SQLITE_CORRUPT_BKPT;
- memset(apOld, 0, (i+1)*sizeof(MemPage*));
- goto balance_cleanup;
- }else{
+ if( (iOff+szNew[i])<=(int)pBt->usableSize ){
memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
}
@@ -72676,6 +72943,9 @@ static int balance_nonroot(
apOld[i] = 0;
rc = sqlite3PagerWrite(pNew->pDbPage);
nNew++;
+ if( sqlite3PagerPageRefcount(pNew->pDbPage)!=1+(i==(iParentIdx-nxDiv)) ){
+ rc = SQLITE_CORRUPT_BKPT;
+ }
if( rc ) goto balance_cleanup;
}else{
assert( i>0 );
@@ -72712,7 +72982,7 @@ static int balance_nonroot(
aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
aPgFlags[i] = apNew[i]->pDbPage->flags;
for(j=0; jpKeyInfo==0 );
if( pCur->eState==CURSOR_FAULT ){
assert( pCur->skipNext!=SQLITE_OK );
@@ -73398,7 +73669,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
** keys with no associated data. If the cursor was opened expecting an
** intkey table, the caller should be inserting integer keys with a
** blob of associated data. */
- assert( (pX->pKey==0)==(pCur->pKeyInfo==0) );
+ assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
/* Save the positions of any other cursors open on this table.
**
@@ -73508,7 +73779,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
|| CORRUPT_DB );
pPage = pCur->pPage;
- assert( pPage->intKey || pX->nKey>=0 );
+ assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
assert( pPage->leaf || !pPage->intKey );
if( pPage->nFree<0 ){
if( pCur->eState>CURSOR_INVALID ){
@@ -73525,7 +73796,21 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
assert( pPage->isInit );
newCell = pBt->pTmpSpace;
assert( newCell!=0 );
- rc = fillInCell(pPage, newCell, pX, &szNew);
+ if( flags & BTREE_PREFORMAT ){
+ rc = SQLITE_OK;
+ szNew = pBt->nPreformatSize;
+ if( szNew<4 ) szNew = 4;
+ if( ISAUTOVACUUM && szNew>pPage->maxLocal ){
+ CellInfo info;
+ pPage->xParseCell(pPage, newCell, &info);
+ if( info.nPayload!=info.nLocal ){
+ Pgno ovfl = get4byte(&newCell[szNew-4]);
+ ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc);
+ }
+ }
+ }else{
+ rc = fillInCell(pPage, newCell, pX, &szNew);
+ }
if( rc ) goto end_insert;
assert( szNew==pPage->xCellSize(pPage, newCell) );
assert( szNew <= MX_CELL_SIZE(pBt) );
@@ -73632,6 +73917,114 @@ end_insert:
return rc;
}
+/*
+** This function is used as part of copying the current row from cursor
+** pSrc into cursor pDest. If the cursors are open on intkey tables, then
+** parameter iKey is used as the rowid value when the record is copied
+** into pDest. Otherwise, the record is copied verbatim.
+**
+** This function does not actually write the new value to cursor pDest.
+** Instead, it creates and populates any required overflow pages and
+** writes the data for the new cell into the BtShared.pTmpSpace buffer
+** for the destination database. The size of the cell, in bytes, is left
+** in BtShared.nPreformatSize. The caller completes the insertion by
+** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
+*/
+SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
+ int rc = SQLITE_OK;
+ BtShared *pBt = pDest->pBt;
+ u8 *aOut = pBt->pTmpSpace; /* Pointer to next output buffer */
+ const u8 *aIn; /* Pointer to next input buffer */
+ u32 nIn; /* Size of input buffer aIn[] */
+ u32 nRem; /* Bytes of data still to copy */
+
+ getCellInfo(pSrc);
+ aOut += putVarint32(aOut, pSrc->info.nPayload);
+ if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
+ nIn = pSrc->info.nLocal;
+ aIn = pSrc->info.pPayload;
+ if( aIn+nIn>pSrc->pPage->aDataEnd ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ nRem = pSrc->info.nPayload;
+ if( nIn==nRem && nInpPage->maxLocal ){
+ memcpy(aOut, aIn, nIn);
+ pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace);
+ }else{
+ Pager *pSrcPager = pSrc->pBt->pPager;
+ u8 *pPgnoOut = 0;
+ Pgno ovflIn = 0;
+ DbPage *pPageIn = 0;
+ MemPage *pPageOut = 0;
+ u32 nOut; /* Size of output buffer aOut[] */
+
+ nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
+ pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace);
+ if( nOutinfo.nPayload ){
+ pPgnoOut = &aOut[nOut];
+ pBt->nPreformatSize += 4;
+ }
+
+ if( nRem>nIn ){
+ if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
+ }
+
+ do {
+ nRem -= nOut;
+ do{
+ assert( nOut>0 );
+ if( nIn>0 ){
+ int nCopy = MIN(nOut, nIn);
+ memcpy(aOut, aIn, nCopy);
+ nOut -= nCopy;
+ nIn -= nCopy;
+ aOut += nCopy;
+ aIn += nCopy;
+ }
+ if( nOut>0 ){
+ sqlite3PagerUnref(pPageIn);
+ pPageIn = 0;
+ rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
+ if( rc==SQLITE_OK ){
+ aIn = (const u8*)sqlite3PagerGetData(pPageIn);
+ ovflIn = get4byte(aIn);
+ aIn += 4;
+ nIn = pSrc->pBt->usableSize - 4;
+ }
+ }
+ }while( rc==SQLITE_OK && nOut>0 );
+
+ if( rc==SQLITE_OK && nRem>0 ){
+ Pgno pgnoNew;
+ MemPage *pNew = 0;
+ rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
+ put4byte(pPgnoOut, pgnoNew);
+ if( ISAUTOVACUUM && pPageOut ){
+ ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc);
+ }
+ releasePage(pPageOut);
+ pPageOut = pNew;
+ if( pPageOut ){
+ pPgnoOut = pPageOut->aData;
+ put4byte(pPgnoOut, 0);
+ aOut = &pPgnoOut[4];
+ nOut = MIN(pBt->usableSize - 4, nRem);
+ }
+ }
+ }while( nRem>0 && rc==SQLITE_OK );
+
+ releasePage(pPageOut);
+ sqlite3PagerUnref(pPageIn);
+ }
+
+ return rc;
+}
+
/*
** Delete the entry that the cursor is pointing to.
**
@@ -74229,7 +74622,7 @@ SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
assert( idx>=0 && idx<=15 );
if( idx==BTREE_DATA_VERSION ){
- *pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion;
+ *pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iBDataVersion;
}else{
*pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);
}
@@ -78020,7 +78413,7 @@ SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
p->pNext = db->pVdbe;
p->pPrev = 0;
db->pVdbe = p;
- p->magic = VDBE_MAGIC_INIT;
+ p->iVdbeMagic = VDBE_MAGIC_INIT;
p->pParse = pParse;
pParse->pVdbe = p;
assert( pParse->aLabel==0 );
@@ -78221,7 +78614,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
VdbeOp *pOp;
i = p->nOp;
- assert( p->magic==VDBE_MAGIC_INIT );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
assert( op>=0 && op<0xff );
if( p->nOpAlloc<=i ){
return growOp3(p, op, p1, p2, p3);
@@ -78456,9 +78849,10 @@ SQLITE_PRIVATE void sqlite3VdbeExplainPop(Parse *pParse){
** The zWhere string must have been obtained from sqlite3_malloc().
** This routine will take ownership of the allocated memory.
*/
-SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere, u16 p5){
int j;
sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);
+ sqlite3VdbeChangeP5(p, p5);
for(j=0; jdb->nDb; j++) sqlite3VdbeUsesBtree(p, j);
sqlite3MayAbort(p->pParse);
}
@@ -78550,7 +78944,7 @@ static SQLITE_NOINLINE void resizeResolveLabel(Parse *p, Vdbe *v, int j){
SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
Parse *p = v->pParse;
int j = ADDR(x);
- assert( v->magic==VDBE_MAGIC_INIT );
+ assert( v->iVdbeMagic==VDBE_MAGIC_INIT );
assert( j<-p->nLabel );
assert( j>=0 );
#ifdef SQLITE_DEBUG
@@ -78875,7 +79269,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
** Return the address of the next instruction to be inserted.
*/
SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
- assert( p->magic==VDBE_MAGIC_INIT );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
return p->nOp;
}
@@ -78960,7 +79354,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(
int i;
VdbeOp *pOut, *pFirst;
assert( nOp>0 );
- assert( p->magic==VDBE_MAGIC_INIT );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
if( p->nOp + nOp > p->nOpAlloc && growOpArray(p, nOp) ){
return 0;
}
@@ -79284,7 +79678,7 @@ SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int
sqlite3 *db;
assert( p!=0 );
db = p->db;
- assert( p->magic==VDBE_MAGIC_INIT );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
assert( p->aOp!=0 || db->mallocFailed );
if( db->mallocFailed ){
if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
@@ -79413,7 +79807,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
/* C89 specifies that the constant "dummy" will be initialized to all
** zeros, which is correct. MSVC generates a warning, nevertheless. */
static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
- assert( p->magic==VDBE_MAGIC_INIT );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
if( addr<0 ){
addr = p->nOp - 1;
}
@@ -80098,7 +80492,7 @@ SQLITE_PRIVATE int sqlite3VdbeList(
Op *pOp; /* Current opcode */
assert( p->explain );
- assert( p->magic==VDBE_MAGIC_RUN );
+ assert( p->iVdbeMagic==VDBE_MAGIC_RUN );
assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
/* Even though this opcode does not use dynamic strings for
@@ -80278,14 +80672,14 @@ SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
int i;
#endif
assert( p!=0 );
- assert( p->magic==VDBE_MAGIC_INIT || p->magic==VDBE_MAGIC_RESET );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT || p->iVdbeMagic==VDBE_MAGIC_RESET );
/* There should be at least one opcode.
*/
assert( p->nOp>0 );
/* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
- p->magic = VDBE_MAGIC_RUN;
+ p->iVdbeMagic = VDBE_MAGIC_RUN;
#ifdef SQLITE_DEBUG
for(i=0; inMem; i++){
@@ -80341,8 +80735,10 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
assert( p!=0 );
assert( p->nOp>0 );
assert( pParse!=0 );
- assert( p->magic==VDBE_MAGIC_INIT );
+ assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
assert( pParse==p->pParse );
+ p->pVList = pParse->pVList;
+ pParse->pVList = 0;
db = p->db;
assert( db->mallocFailed==0 );
nVar = pParse->nVar;
@@ -80427,8 +80823,6 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
}
}
- p->pVList = pParse->pVList;
- pParse->pVList = 0;
if( db->mallocFailed ){
p->nVar = 0;
p->nCursor = 0;
@@ -80456,20 +80850,15 @@ SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
return;
}
assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE );
+ assert( pCx->pBtx==0 || pCx->isEphemeral );
switch( pCx->eCurType ){
case CURTYPE_SORTER: {
sqlite3VdbeSorterClose(p->db, pCx);
break;
}
case CURTYPE_BTREE: {
- if( pCx->isEphemeral ){
- if( pCx->pBtx ) sqlite3BtreeClose(pCx->pBtx);
- /* The pCx->pCursor will be close automatically, if it exists, by
- ** the call above. */
- }else{
- assert( pCx->uc.pCursor!=0 );
- sqlite3BtreeCloseCursor(pCx->uc.pCursor);
- }
+ assert( pCx->uc.pCursor!=0 );
+ sqlite3BtreeCloseCursor(pCx->uc.pCursor);
break;
}
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -81026,7 +81415,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
** one, or the complete transaction if there is no statement transaction.
*/
- if( p->magic!=VDBE_MAGIC_RUN ){
+ if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
return SQLITE_OK;
}
if( db->mallocFailed ){
@@ -81184,7 +81573,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
assert( db->nVdbeRead>=db->nVdbeWrite );
assert( db->nVdbeWrite>=0 );
}
- p->magic = VDBE_MAGIC_HALT;
+ p->iVdbeMagic = VDBE_MAGIC_HALT;
checkActiveVdbeCnt(db);
if( db->mallocFailed ){
p->rc = SQLITE_NOMEM_BKPT;
@@ -81357,7 +81746,7 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
}
}
#endif
- p->magic = VDBE_MAGIC_RESET;
+ p->iVdbeMagic = VDBE_MAGIC_RESET;
return p->rc & db->errMask;
}
@@ -81367,7 +81756,7 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
*/
SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
int rc = SQLITE_OK;
- if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){
+ if( p->iVdbeMagic==VDBE_MAGIC_RUN || p->iVdbeMagic==VDBE_MAGIC_HALT ){
rc = sqlite3VdbeReset(p);
assert( (rc & p->db->errMask)==rc );
}
@@ -81428,7 +81817,7 @@ SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
sqlite3DbFree(db, pSub);
}
- if( p->magic!=VDBE_MAGIC_INIT ){
+ if( p->iVdbeMagic!=VDBE_MAGIC_INIT ){
releaseMemArray(p->aVar, p->nVar);
sqlite3DbFree(db, p->pVList);
sqlite3DbFree(db, p->pFree);
@@ -81476,7 +81865,7 @@ SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){
if( p->pNext ){
p->pNext->pPrev = p->pPrev;
}
- p->magic = VDBE_MAGIC_DEAD;
+ p->iVdbeMagic = VDBE_MAGIC_DEAD;
p->db = 0;
sqlite3DbFreeNN(db, p);
}
@@ -81553,6 +81942,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){
assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
if( p->deferredMoveto ){
u32 iMap;
+ assert( !p->isEphemeral );
if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){
*pp = p->pAltCursor;
*piCol = iMap - 1;
@@ -83855,7 +84245,7 @@ static int sqlite3Step(Vdbe *p){
int rc;
assert(p);
- if( p->magic!=VDBE_MAGIC_RUN ){
+ if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
/* We used to require that sqlite3_reset() be called before retrying
** sqlite3_step() after any error or after SQLITE_DONE. But beginning
** with version 3.7.0, we changed this so that sqlite3_reset() would
@@ -84571,7 +84961,7 @@ static int vdbeUnbind(Vdbe *p, int i){
return SQLITE_MISUSE_BKPT;
}
sqlite3_mutex_enter(p->db->mutex);
- if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){
+ if( p->iVdbeMagic!=VDBE_MAGIC_RUN || p->pc>=0 ){
sqlite3Error(p->db, SQLITE_MISUSE);
sqlite3_mutex_leave(p->db->mutex);
sqlite3_log(SQLITE_MISUSE,
@@ -84925,7 +85315,7 @@ SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){
*/
SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
Vdbe *v = (Vdbe*)pStmt;
- return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
+ return v!=0 && v->iVdbeMagic==VDBE_MAGIC_RUN && v->pc>=0;
}
/*
@@ -85417,7 +85807,7 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql(
assert( idx>0 );
}
zRawSql += nToken;
- nextIndex = idx + 1;
+ nextIndex = MAX(idx + 1, nextIndex);
assert( idx>0 && idx<=p->nVar );
pVar = &p->aVar[idx-1];
if( pVar->flags & MEM_Null ){
@@ -85761,11 +86151,6 @@ static VdbeCursor *allocateCursor(
assert( iCur>=0 && iCurnCursor );
if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/
- /* Before calling sqlite3VdbeFreeCursor(), ensure the isEphemeral flag
- ** is clear. Otherwise, if this is an ephemeral cursor created by
- ** OP_OpenDup, the cursor will not be closed and will still be part
- ** of a BtShared.pCursor list. */
- if( p->apCsr[iCur]->pBtx==0 ) p->apCsr[iCur]->isEphemeral = 0;
sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
p->apCsr[iCur] = 0;
}
@@ -86263,7 +86648,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
#endif
/*** INSERT STACK UNION HERE ***/
- assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
+ assert( p->iVdbeMagic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
sqlite3VdbeEnter(p);
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
if( db->xProgress ){
@@ -87023,6 +87408,26 @@ case OP_IntCopy: { /* out2 */
break;
}
+/* Opcode: ChngCntRow P1 P2 * * *
+** Synopsis: output=r[P1]
+**
+** Output value in register P1 as the chance count for a DML statement,
+** due to the "PRAGMA count_changes=ON" setting. Or, if there was a
+** foreign key error in the statement, trigger the error now.
+**
+** This opcode is a variant of OP_ResultRow that checks the foreign key
+** immediate constraint count and throws an error if the count is
+** non-zero. The P2 opcode must be 1.
+*/
+case OP_ChngCntRow: {
+ assert( pOp->p2==1 );
+ if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){
+ goto abort_due_to_error;
+ }
+ /* Fall through to the next case, OP_ResultRow */
+ /* no break */ deliberate_fall_through
+}
+
/* Opcode: ResultRow P1 P2 * * *
** Synopsis: output=r[P1@P2]
**
@@ -87039,34 +87444,6 @@ case OP_ResultRow: {
assert( pOp->p1>0 );
assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );
- /* If this statement has violated immediate foreign key constraints, do
- ** not return the number of rows modified. And do not RELEASE the statement
- ** transaction. It needs to be rolled back. */
- if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
- assert( db->flags&SQLITE_CountRows );
- assert( p->usesStmtJournal );
- goto abort_due_to_error;
- }
-
- /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then
- ** DML statements invoke this opcode to return the number of rows
- ** modified to the user. This is the only way that a VM that
- ** opens a statement transaction may invoke this opcode.
- **
- ** In case this is such a statement, close any statement transaction
- ** opened by this VM before returning control to the user. This is to
- ** ensure that statement-transactions are always nested, not overlapping.
- ** If the open statement-transaction is not closed here, then the user
- ** may step another VM that opens its own statement transaction. This
- ** may lead to overlapping statement transactions.
- **
- ** The statement transaction is never a top-level transaction. Hence
- ** the RELEASE call below can never fail.
- */
- assert( p->iStatement==0 || db->flags&SQLITE_CountRows );
- rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);
- assert( rc==SQLITE_OK );
-
/* Invalidate all ephemeral cursor row caches */
p->cacheCtr = (p->cacheCtr + 2)|1;
@@ -89459,7 +89836,7 @@ case OP_OpenDup: {
pOrig = p->apCsr[pOp->p2];
assert( pOrig );
- assert( pOrig->pBtx!=0 ); /* Only ephemeral cursors can be duplicated */
+ assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */
pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE);
if( pCx==0 ) goto no_mem;
@@ -89469,7 +89846,10 @@ case OP_OpenDup: {
pCx->isTable = pOrig->isTable;
pCx->pgnoRoot = pOrig->pgnoRoot;
pCx->isOrdered = pOrig->isOrdered;
- rc = sqlite3BtreeCursor(pOrig->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
+ pCx->pBtx = pOrig->pBtx;
+ pCx->hasBeenDuped = 1;
+ pOrig->hasBeenDuped = 1;
+ rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
pCx->pKeyInfo, pCx->uc.pCursor);
/* The sqlite3BtreeCursor() routine can only fail for the first cursor
** opened for a database. Since there is already an open cursor when this
@@ -89535,9 +89915,10 @@ case OP_OpenEphemeral: {
aMem[pOp->p3].z = "";
}
pCx = p->apCsr[pOp->p1];
- if( pCx && pCx->pBtx ){
- /* If the ephermeral table is already open, erase all existing content
- ** so that the table is empty again, rather than creating a new table. */
+ if( pCx && !pCx->hasBeenDuped ){
+ /* If the ephermeral table is already open and has no duplicates from
+ ** OP_OpenDup, then erase all existing content so that the table is
+ ** empty again, rather than creating a new table. */
assert( pCx->isEphemeral );
pCx->seqCount = 0;
pCx->cacheStatus = CACHE_STALE;
@@ -89551,33 +89932,36 @@ case OP_OpenEphemeral: {
vfsFlags);
if( rc==SQLITE_OK ){
rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);
- }
- if( rc==SQLITE_OK ){
- /* If a transient index is required, create it by calling
- ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before
- ** opening it. If a transient table is required, just use the
- ** automatically created table with root-page 1 (an BLOB_INTKEY table).
- */
- if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
- assert( pOp->p4type==P4_KEYINFO );
- rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot,
- BTREE_BLOBKEY | pOp->p5);
- if( rc==SQLITE_OK ){
- assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
- assert( pKeyInfo->db==db );
- assert( pKeyInfo->enc==ENC(db) );
- rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
- pKeyInfo, pCx->uc.pCursor);
+ if( rc==SQLITE_OK ){
+ /* If a transient index is required, create it by calling
+ ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before
+ ** opening it. If a transient table is required, just use the
+ ** automatically created table with root-page 1 (an BLOB_INTKEY table).
+ */
+ if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
+ assert( pOp->p4type==P4_KEYINFO );
+ rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot,
+ BTREE_BLOBKEY | pOp->p5);
+ if( rc==SQLITE_OK ){
+ assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
+ assert( pKeyInfo->db==db );
+ assert( pKeyInfo->enc==ENC(db) );
+ rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
+ pKeyInfo, pCx->uc.pCursor);
+ }
+ pCx->isTable = 0;
+ }else{
+ pCx->pgnoRoot = SCHEMA_ROOT;
+ rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR,
+ 0, pCx->uc.pCursor);
+ pCx->isTable = 1;
}
- pCx->isTable = 0;
- }else{
- pCx->pgnoRoot = SCHEMA_ROOT;
- rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR,
- 0, pCx->uc.pCursor);
- pCx->isTable = 1;
+ }
+ pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
+ if( rc ){
+ sqlite3BtreeClose(pCx->pBtx);
}
}
- pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
}
if( rc ) goto abort_due_to_error;
pCx->nullRow = 1;
@@ -90011,13 +90395,13 @@ seek_not_found:
**
** There are three possible outcomes from this opcode:
**
-**
If after This.P1 steps, the cursor is still point to a place that
-** is earlier in the btree than the target row,
-** then fall through into the subsquence OP_SeekGE opcode.
+**
If after This.P1 steps, the cursor is still pointing to a place that
+** is earlier in the btree than the target row, then fall through
+** into the subsquence OP_SeekGE opcode.
**
**
If the cursor is successfully moved to the target row by 0 or more
** sqlite3BtreeNext() calls, then jump to This.P2, which will land just
-** past the OP_IdxGT opcode that follows the OP_SeekGE.
+** past the OP_IdxGT or OP_IdxGE opcode that follows the OP_SeekGE.
**
**