From 5549c52f3ba36eeaca8cea48e9f67389f2f5d68d Mon Sep 17 00:00:00 2001 From: zhanglei <357733652@qq.com> Date: Wed, 4 Feb 2026 17:52:29 +0800 Subject: [PATCH 1/4] feat: support go database client --- client/session.go | 11 + database/.gitignore | 2 + database/batch.go | 30 + database/bind.go | 350 ++ database/column/blob.go | 34 + database/column/bool.go | 35 + database/column/column.go | 61 + database/column/date.go | 34 + database/column/double.go | 35 + database/column/float.go | 36 + database/column/int32.go | 33 + database/column/int64.go | 54 + database/column/string.go | 31 + database/column/timestamp.go | 34 + database/conn.go | 134 + database/conn_exec.go | 27 + database/context.go | 103 + database/driver/driver.go | 16 + database/exec_test.go | 25 + database/iotdb.go | 29 + database/iotdb_std.go | 207 ++ database/iotdb_std_test.go | 16 + database/options.go | 141 + database/query_parameters.go | 23 + database/query_test.go | 71 + database/rows.go | 20 + database/rows_std.go | 66 + database/std_conn_opener.go | 83 + database/std_connect.go | 12 + go.mod | 9 +- go.sum | 2 + vendor/github.com/davecgh/go-spew/LICENSE | 15 + .../github.com/davecgh/go-spew/spew/bypass.go | 145 + .../davecgh/go-spew/spew/bypasssafe.go | 38 + .../github.com/davecgh/go-spew/spew/common.go | 341 ++ .../github.com/davecgh/go-spew/spew/config.go | 306 ++ vendor/github.com/davecgh/go-spew/spew/doc.go | 211 ++ .../github.com/davecgh/go-spew/spew/dump.go | 509 +++ .../github.com/davecgh/go-spew/spew/format.go | 419 +++ .../github.com/davecgh/go-spew/spew/spew.go | 148 + vendor/github.com/pkg/errors/.gitignore | 24 + vendor/github.com/pkg/errors/.travis.yml | 10 + vendor/github.com/pkg/errors/LICENSE | 23 + vendor/github.com/pkg/errors/README.md | 59 + vendor/github.com/pkg/errors/appveyor.yml | 32 + vendor/github.com/pkg/errors/errors.go | 288 ++ vendor/github.com/pkg/errors/go113.go | 38 + vendor/github.com/pkg/errors/stack.go | 177 + vendor/github.com/pmezard/go-difflib/LICENSE | 27 + .../pmezard/go-difflib/difflib/difflib.go | 772 +++++ vendor/github.com/stretchr/testify/LICENSE | 21 + .../testify/assert/assertion_compare.go | 458 +++ .../assert/assertion_compare_can_convert.go | 16 + .../assert/assertion_compare_legacy.go | 16 + .../testify/assert/assertion_format.go | 763 +++++ .../testify/assert/assertion_format.go.tmpl | 5 + .../testify/assert/assertion_forward.go | 1514 ++++++++ .../testify/assert/assertion_forward.go.tmpl | 5 + .../testify/assert/assertion_order.go | 81 + .../stretchr/testify/assert/assertions.go | 1856 ++++++++++ .../github.com/stretchr/testify/assert/doc.go | 45 + .../stretchr/testify/assert/errors.go | 10 + .../testify/assert/forward_assertions.go | 16 + .../testify/assert/http_assertions.go | 162 + .../stretchr/testify/require/doc.go | 28 + .../testify/require/forward_requirements.go | 16 + .../stretchr/testify/require/require.go | 1935 +++++++++++ .../stretchr/testify/require/require.go.tmpl | 6 + .../testify/require/require_forward.go | 1515 ++++++++ .../testify/require/require_forward.go.tmpl | 5 + .../stretchr/testify/require/requirements.go | 29 + .../github.com/stretchr/testify/suite/doc.go | 65 + .../stretchr/testify/suite/interfaces.go | 66 + .../stretchr/testify/suite/stats.go | 46 + .../stretchr/testify/suite/suite.go | 248 ++ vendor/gopkg.in/yaml.v3/LICENSE | 50 + vendor/gopkg.in/yaml.v3/NOTICE | 13 + vendor/gopkg.in/yaml.v3/README.md | 150 + vendor/gopkg.in/yaml.v3/apic.go | 747 ++++ vendor/gopkg.in/yaml.v3/decode.go | 1000 ++++++ vendor/gopkg.in/yaml.v3/emitterc.go | 2020 +++++++++++ vendor/gopkg.in/yaml.v3/encode.go | 577 ++++ vendor/gopkg.in/yaml.v3/parserc.go | 1258 +++++++ vendor/gopkg.in/yaml.v3/readerc.go | 434 +++ vendor/gopkg.in/yaml.v3/resolve.go | 326 ++ vendor/gopkg.in/yaml.v3/scannerc.go | 3038 +++++++++++++++++ vendor/gopkg.in/yaml.v3/sorter.go | 134 + vendor/gopkg.in/yaml.v3/writerc.go | 48 + vendor/gopkg.in/yaml.v3/yaml.go | 698 ++++ vendor/gopkg.in/yaml.v3/yamlh.go | 807 +++++ vendor/gopkg.in/yaml.v3/yamlprivateh.go | 198 ++ 91 files changed, 25770 insertions(+), 1 deletion(-) create mode 100644 database/.gitignore create mode 100644 database/batch.go create mode 100644 database/bind.go create mode 100644 database/column/blob.go create mode 100644 database/column/bool.go create mode 100644 database/column/column.go create mode 100644 database/column/date.go create mode 100644 database/column/double.go create mode 100644 database/column/float.go create mode 100644 database/column/int32.go create mode 100644 database/column/int64.go create mode 100644 database/column/string.go create mode 100644 database/column/timestamp.go create mode 100644 database/conn.go create mode 100644 database/conn_exec.go create mode 100644 database/context.go create mode 100644 database/driver/driver.go create mode 100644 database/exec_test.go create mode 100644 database/iotdb.go create mode 100644 database/iotdb_std.go create mode 100644 database/iotdb_std_test.go create mode 100644 database/options.go create mode 100644 database/query_parameters.go create mode 100644 database/query_test.go create mode 100644 database/rows.go create mode 100644 database/rows_std.go create mode 100644 database/std_conn_opener.go create mode 100644 database/std_connect.go create mode 100644 vendor/github.com/davecgh/go-spew/LICENSE create mode 100644 vendor/github.com/davecgh/go-spew/spew/bypass.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/bypasssafe.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/common.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/config.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/doc.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/dump.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/format.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/spew.go create mode 100644 vendor/github.com/pkg/errors/.gitignore create mode 100644 vendor/github.com/pkg/errors/.travis.yml create mode 100644 vendor/github.com/pkg/errors/LICENSE create mode 100644 vendor/github.com/pkg/errors/README.md create mode 100644 vendor/github.com/pkg/errors/appveyor.yml create mode 100644 vendor/github.com/pkg/errors/errors.go create mode 100644 vendor/github.com/pkg/errors/go113.go create mode 100644 vendor/github.com/pkg/errors/stack.go create mode 100644 vendor/github.com/pmezard/go-difflib/LICENSE create mode 100644 vendor/github.com/pmezard/go-difflib/difflib/difflib.go create mode 100644 vendor/github.com/stretchr/testify/LICENSE create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_compare.go create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl create mode 100644 vendor/github.com/stretchr/testify/assert/assertion_order.go create mode 100644 vendor/github.com/stretchr/testify/assert/assertions.go create mode 100644 vendor/github.com/stretchr/testify/assert/doc.go create mode 100644 vendor/github.com/stretchr/testify/assert/errors.go create mode 100644 vendor/github.com/stretchr/testify/assert/forward_assertions.go create mode 100644 vendor/github.com/stretchr/testify/assert/http_assertions.go create mode 100644 vendor/github.com/stretchr/testify/require/doc.go create mode 100644 vendor/github.com/stretchr/testify/require/forward_requirements.go create mode 100644 vendor/github.com/stretchr/testify/require/require.go create mode 100644 vendor/github.com/stretchr/testify/require/require.go.tmpl create mode 100644 vendor/github.com/stretchr/testify/require/require_forward.go create mode 100644 vendor/github.com/stretchr/testify/require/require_forward.go.tmpl create mode 100644 vendor/github.com/stretchr/testify/require/requirements.go create mode 100644 vendor/github.com/stretchr/testify/suite/doc.go create mode 100644 vendor/github.com/stretchr/testify/suite/interfaces.go create mode 100644 vendor/github.com/stretchr/testify/suite/stats.go create mode 100644 vendor/github.com/stretchr/testify/suite/suite.go create mode 100644 vendor/gopkg.in/yaml.v3/LICENSE create mode 100644 vendor/gopkg.in/yaml.v3/NOTICE create mode 100644 vendor/gopkg.in/yaml.v3/README.md create mode 100644 vendor/gopkg.in/yaml.v3/apic.go create mode 100644 vendor/gopkg.in/yaml.v3/decode.go create mode 100644 vendor/gopkg.in/yaml.v3/emitterc.go create mode 100644 vendor/gopkg.in/yaml.v3/encode.go create mode 100644 vendor/gopkg.in/yaml.v3/parserc.go create mode 100644 vendor/gopkg.in/yaml.v3/readerc.go create mode 100644 vendor/gopkg.in/yaml.v3/resolve.go create mode 100644 vendor/gopkg.in/yaml.v3/scannerc.go create mode 100644 vendor/gopkg.in/yaml.v3/sorter.go create mode 100644 vendor/gopkg.in/yaml.v3/writerc.go create mode 100644 vendor/gopkg.in/yaml.v3/yaml.go create mode 100644 vendor/gopkg.in/yaml.v3/yamlh.go create mode 100644 vendor/gopkg.in/yaml.v3/yamlprivateh.go diff --git a/client/session.go b/client/session.go index 2cd1e82..b604d2b 100644 --- a/client/session.go +++ b/client/session.go @@ -524,6 +524,17 @@ func (s *Session) ExecuteStatement(sql string) (*SessionDataSet, error) { return s.ExecuteStatementWithContext(context.Background(), sql) } +func (s *Session) Ping(ctx context.Context) error { + status, err := s.client.TestConnectionEmptyRPC(ctx) + if err != nil { + return err + } + if status.GetCode() == SuccessStatus { + return nil + } + return errors.New("Ping failed: " + status.GetMessage()) +} + func (s *Session) ExecuteNonQueryStatement(sql string) error { request := rpc.TSExecuteStatementReq{ SessionId: s.sessionId, diff --git a/database/.gitignore b/database/.gitignore new file mode 100644 index 0000000..331c58f --- /dev/null +++ b/database/.gitignore @@ -0,0 +1,2 @@ +.idea +vendor \ No newline at end of file diff --git a/database/batch.go b/database/batch.go new file mode 100644 index 0000000..9e5e78b --- /dev/null +++ b/database/batch.go @@ -0,0 +1,30 @@ +package iotdb_go + +import ( + "context" + "database/sql/driver" + "github.com/pkg/errors" +) + +type stdBatch struct { + debugf func(format string, v ...any) +} + +func (s *stdBatch) NumInput() int { return -1 } + +func (s *stdBatch) Exec(args []driver.Value) (driver.Result, error) { + return nil, errors.New("not implemented") +} + +func (s *stdBatch) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { + return nil, driver.ErrSkip +} + +func (s *stdBatch) Query(args []driver.Value) (driver.Rows, error) { + // Note: not implementing driver.StmtQueryContext accordingly + return nil, errors.New("only Exec method supported in batch mode") +} + +func (s *stdBatch) Close() error { + return nil +} diff --git a/database/bind.go b/database/bind.go new file mode 100644 index 0000000..fa699b5 --- /dev/null +++ b/database/bind.go @@ -0,0 +1,350 @@ +package iotdb_go + +import ( + std_driver "database/sql/driver" + "fmt" + "github.com/apache/iotdb-client-go/v2/database/driver" + "github.com/pkg/errors" + "reflect" + "regexp" + "strings" + "time" +) + +var ( + ErrInvalidTimezone = errors.New("invalid timezone value") +) + +func Named(name string, value any) driver.NamedValue { + return driver.NamedValue{ + Name: name, + Value: value, + } +} + +type TimeUnit uint8 + +const ( + Seconds TimeUnit = iota + MilliSeconds + MicroSeconds + NanoSeconds +) + +type GroupSet struct { + Value []any +} + +type ArraySet []any + +func DateNamed(name string, value time.Time, scale TimeUnit) driver.NamedDateValue { + return driver.NamedDateValue{ + Name: name, + Value: value, + Scale: uint8(scale), + } +} + +var ( + bindNumericRe = regexp.MustCompile(`\$[0-9]+`) + bindPositionalRe = regexp.MustCompile(`[^\\][?]`) +) + +func bind(tz *time.Location, query string, args ...any) (string, error) { + if len(args) == 0 { + return query, nil + } + var ( + haveNumeric bool + havePositional bool + ) + + allArgumentsNamed, err := checkAllNamedArguments(args...) + if err != nil { + return "", err + } + + if allArgumentsNamed { + return bindNamed(tz, query, args...) + } + + haveNumeric = bindNumericRe.MatchString(query) + havePositional = bindPositionalRe.MatchString(query) + if haveNumeric && havePositional { + return "", ErrBindMixedParamsFormats + } + if haveNumeric { + return bindNumeric(tz, query, args...) + } + return bindPositional(tz, query, args...) +} + +func checkAllNamedArguments(args ...any) (bool, error) { + var ( + haveNamed bool + haveAnonymous bool + ) + for _, v := range args { + switch v.(type) { + case driver.NamedValue, driver.NamedDateValue: + haveNamed = true + default: + haveAnonymous = true + } + if haveNamed && haveAnonymous { + return haveNamed, ErrBindMixedParamsFormats + } + } + return haveNamed, nil +} + +func bindPositional(tz *time.Location, query string, args ...any) (_ string, err error) { + var ( + lastMatchIndex = -1 // Position of previous match for copying + argIndex = 0 // Index for the argument at current position + buf = make([]byte, 0, len(query)) + unbindCount = 0 // Number of positional arguments that couldn't be matched + ) + + for i := 0; i < len(query); i++ { + // It's fine looping through the query string as bytes, because the (fixed) characters we're looking for + // are in the ASCII range to won't take up more than one byte. + if query[i] == '?' { + if i > 0 && query[i-1] == '\\' { + // Copy all previous index to here characters + buf = append(buf, query[lastMatchIndex+1:i-1]...) + buf = append(buf, '?') + } else { + // Copy all previous index to here characters + buf = append(buf, query[lastMatchIndex+1:i]...) + + // Append the argument value + if argIndex < len(args) { + v := args[argIndex] + if fn, ok := v.(std_driver.Valuer); ok { + if v, err = fn.Value(); err != nil { + return "", nil + } + } + + value, err := format(tz, Seconds, v) + if err != nil { + return "", err + } + + buf = append(buf, value...) + argIndex++ + } else { + unbindCount++ + } + } + + lastMatchIndex = i + } + } + + // If there were no replacements, quick return without copying the string + if lastMatchIndex < 0 { + return query, nil + } + + // Append the remainder + buf = append(buf, query[lastMatchIndex+1:]...) + + if unbindCount > 0 { + return "", fmt.Errorf("have no arg for param ? at last %d positions", unbindCount) + } + + return string(buf), nil +} + +func bindNumeric(tz *time.Location, query string, args ...any) (_ string, err error) { + var ( + unbind = make(map[string]struct{}) + params = make(map[string]string) + ) + for i, v := range args { + if fn, ok := v.(std_driver.Valuer); ok { + if v, err = fn.Value(); err != nil { + return "", nil + } + } + val, err := format(tz, Seconds, v) + if err != nil { + return "", err + } + params[fmt.Sprintf("$%d", i+1)] = val + } + query = bindNumericRe.ReplaceAllStringFunc(query, func(n string) string { + if _, found := params[n]; !found { + unbind[n] = struct{}{} + return "" + } + return params[n] + }) + for param := range unbind { + return "", fmt.Errorf("have no arg for %s param", param) + } + return query, nil +} + +var bindNamedRe = regexp.MustCompile(`@[a-zA-Z0-9\_]+`) + +func bindNamed(tz *time.Location, query string, args ...any) (_ string, err error) { + var ( + unbind = make(map[string]struct{}) + params = make(map[string]string) + ) + for _, v := range args { + switch v := v.(type) { + case driver.NamedValue: + value := v.Value + if fn, ok := v.Value.(std_driver.Valuer); ok { + if value, err = fn.Value(); err != nil { + return "", err + } + } + val, err := format(tz, Seconds, value) + if err != nil { + return "", err + } + params["@"+v.Name] = val + case driver.NamedDateValue: + val, err := format(tz, TimeUnit(v.Scale), v.Value) + if err != nil { + return "", err + } + params["@"+v.Name] = val + } + } + query = bindNamedRe.ReplaceAllStringFunc(query, func(n string) string { + if _, found := params[n]; !found { + unbind[n] = struct{}{} + return "" + } + return params[n] + }) + for param := range unbind { + return "", fmt.Errorf("have no arg for %q param", param) + } + return query, nil +} + +func formatTime(value time.Time) (string, error) { + str := value.Format(time.DateTime) + return str, nil +} + +var stringQuoteReplacer = strings.NewReplacer(`\`, `\\`, `'`, `\'`) + +func format(tz *time.Location, scale TimeUnit, v any) (string, error) { + quote := func(v string) string { + return "'" + stringQuoteReplacer.Replace(v) + "'" + } + switch v := v.(type) { + case nil: + return "NULL", nil + case string: + return quote(v), nil + case time.Time: + return formatTime(v) + case *time.Time: + if v == nil { + return "NULL", nil + } + return formatTime(*v) + case bool: + if v { + return "1", nil + } + return "0", nil + case GroupSet: + val, err := join(tz, scale, v.Value) + if err != nil { + return "", err + } + return fmt.Sprintf("(%s)", val), nil + case []GroupSet: + val, err := join(tz, scale, v) + if err != nil { + return "", err + } + return val, err + case ArraySet: + val, err := join(tz, scale, v) + if err != nil { + return "", err + } + return fmt.Sprintf("[%s]", val), nil + case fmt.Stringer: + if v := reflect.ValueOf(v); v.Kind() == reflect.Pointer && + v.IsNil() && + v.Type().Elem().Implements(reflect.TypeOf((*fmt.Stringer)(nil)).Elem()) { + return "NULL", nil + } + return quote(v.String()), nil + } + switch v := reflect.ValueOf(v); v.Kind() { + case reflect.String: + return quote(v.String()), nil + case reflect.Slice, reflect.Array: + values := make([]string, 0, v.Len()) + for i := 0; i < v.Len(); i++ { + val, err := format(tz, scale, v.Index(i).Interface()) + if err != nil { + return "", err + } + values = append(values, val) + } + return fmt.Sprintf("[%s]", strings.Join(values, ", ")), nil + case reflect.Map: // map + values := make([]string, 0, len(v.MapKeys())) + for _, key := range v.MapKeys() { + name := fmt.Sprint(key.Interface()) + if key.Kind() == reflect.String { + name = fmt.Sprintf("'%s'", name) + } + val, err := format(tz, scale, v.MapIndex(key).Interface()) + if err != nil { + return "", err + } + values = append(values, fmt.Sprintf("%s, %s", name, val)) + } + return "map(" + strings.Join(values, ", ") + ")", nil + case reflect.Ptr: + if v.IsNil() { + return "NULL", nil + } + return format(tz, scale, v.Elem().Interface()) + } + return fmt.Sprint(v), nil +} + +func join[E any](tz *time.Location, scale TimeUnit, values []E) (string, error) { + items := make([]string, len(values), len(values)) + for i := range values { + val, err := format(tz, scale, values[i]) + if err != nil { + return "", err + } + items[i] = val + } + return strings.Join(items, ", "), nil +} + +func rebind(in []std_driver.NamedValue) []any { + args := make([]any, 0, len(in)) + for _, v := range in { + switch { + case len(v.Name) != 0: + args = append(args, driver.NamedValue{ + Name: v.Name, + Value: v.Value, + }) + + default: + args = append(args, v.Value) + } + } + return args +} diff --git a/database/column/blob.go b/database/column/blob.go new file mode 100644 index 0000000..6f88ea5 --- /dev/null +++ b/database/column/blob.go @@ -0,0 +1,34 @@ +package column + +import "github.com/apache/iotdb-client-go/v2/client" + +type Blob struct { + name string +} + +func (b *Blob) Name() string { + return b.name +} +func (b *Blob) Type() Type { + return "BLOB" +} + +func (b *Blob) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetBlob(b.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/column/bool.go b/database/column/bool.go new file mode 100644 index 0000000..c27fc7e --- /dev/null +++ b/database/column/bool.go @@ -0,0 +1,35 @@ +package column + +import ( + "github.com/apache/iotdb-client-go/v2/client" +) + +type Bool struct { + name string +} + +func (b *Bool) Name() string { + return b.name +} +func (b *Bool) Type() Type { + return "BOOLEAN" +} +func (b *Bool) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetBoolean(b.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/column/column.go b/database/column/column.go new file mode 100644 index 0000000..ed8f925 --- /dev/null +++ b/database/column/column.go @@ -0,0 +1,61 @@ +package column + +import ( + "github.com/apache/iotdb-client-go/v2/client" +) + +type Type string + +type Interface interface { + Name() string + Type() Type + Row(stat *client.SessionDataSet, ptr bool) any +} + +func GenColumn(dataType string, name string) Interface { + switch dataType { + case "BOOLEAN": + return &Bool{ + name: name, + } + case "INT32": + return &Int32{ + name: name, + } + case "INT64": + { + return &Int64{ + name: name, + } + } + case "FLOAT": + return &Float{ + name: name, + } + case "DOUBLE": + return &Double{ + name: name, + } + case "TEXT": + { + return &String{ + name: name, + } + } + case "TIMESTAMP": + break + case "DATE": + return &Date{ + name: name, + } + case "BLOB": + return &Blob{ + name: name, + } + case "STRING": + return &String{ + name: name, + } + } + return nil +} diff --git a/database/column/date.go b/database/column/date.go new file mode 100644 index 0000000..fc8c75a --- /dev/null +++ b/database/column/date.go @@ -0,0 +1,34 @@ +package column + +import "github.com/apache/iotdb-client-go/v2/client" + +type Date struct { + name string +} + +func (b *Date) Name() string { + return b.name +} +func (b *Date) Type() Type { + return "DATE" +} + +func (b *Date) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetDate(b.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/column/double.go b/database/column/double.go new file mode 100644 index 0000000..9344c25 --- /dev/null +++ b/database/column/double.go @@ -0,0 +1,35 @@ +package column + +import ( + "github.com/apache/iotdb-client-go/v2/client" +) + +type Double struct { + name string +} + +func (d *Double) Name() string { + return d.name +} +func (d *Double) Type() Type { + return "DOUBLE" +} +func (d *Double) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetDouble(d.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/column/float.go b/database/column/float.go new file mode 100644 index 0000000..8b784b0 --- /dev/null +++ b/database/column/float.go @@ -0,0 +1,36 @@ +package column + +import ( + "github.com/apache/iotdb-client-go/v2/client" +) + +type Float struct { + name string +} + +func (f *Float) Name() string { + return f.name +} +func (f *Float) Type() Type { + return "FLOAT" +} + +func (f *Float) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetFloat(f.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/column/int32.go b/database/column/int32.go new file mode 100644 index 0000000..df67286 --- /dev/null +++ b/database/column/int32.go @@ -0,0 +1,33 @@ +package column + +import "github.com/apache/iotdb-client-go/v2/client" + +type Int32 struct { + name string +} + +func (i *Int32) Name() string { + return i.name +} +func (i *Int32) Type() Type { + return "INT32" +} +func (i *Int32) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetInt(i.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/column/int64.go b/database/column/int64.go new file mode 100644 index 0000000..23222f8 --- /dev/null +++ b/database/column/int64.go @@ -0,0 +1,54 @@ +package column + +import ( + "github.com/apache/iotdb-client-go/v2/client" + "reflect" +) + +type Int64 struct { + name string +} + +func (i *Int64) Name() string { + return i.name +} +func (i *Int64) Type() Type { + return "INT64" +} +func (i *Int64) Rows() int { + return 0 +} +func (i *Int64) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetInt(i.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} +func (i *Int64) ScanRow(dest any, row int) error { + return nil +} +func (i *Int64) Append(v any) (nulls []uint8, err error) { + return nil, nil +} +func (i *Int64) AppendRow(v any) error { + return nil +} +func (i *Int64) ScanType() reflect.Type { + return reflect.TypeOf(&String{}) +} +func (i *Int64) Reset() { + return +} diff --git a/database/column/string.go b/database/column/string.go new file mode 100644 index 0000000..c5ef9e8 --- /dev/null +++ b/database/column/string.go @@ -0,0 +1,31 @@ +package column + +import ( + "github.com/apache/iotdb-client-go/v2/client" +) + +type String struct { + name string +} + +func (s *String) Name() string { + return s.name +} +func (s *String) Type() Type { + return "STRING" +} +func (s *String) Row(stat *client.SessionDataSet, ptr bool) any { + getString, err := stat.GetString(s.name) + if err != nil { + if !ptr { + return getString + } + return &getString + } + if !ptr { + return getString + } + return &getString +} + +var _ Interface = (*String)(nil) diff --git a/database/column/timestamp.go b/database/column/timestamp.go new file mode 100644 index 0000000..d14ba9a --- /dev/null +++ b/database/column/timestamp.go @@ -0,0 +1,34 @@ +package column + +import "github.com/apache/iotdb-client-go/v2/client" + +type Timestamp struct { + name string +} + +func (t *Timestamp) Name() string { + return t.name +} +func (t *Timestamp) Type() Type { + return "TIMESTAMP" +} + +func (t *Timestamp) Row(stat *client.SessionDataSet, ptr bool) any { + if stat == nil { + if ptr { + return nil + } + return 0 + } + value, err := stat.GetDate(t.name) + if err != nil { + if ptr { + return nil + } + return 0 + } + if ptr { + return &value + } + return value +} diff --git a/database/conn.go b/database/conn.go new file mode 100644 index 0000000..60ed7a7 --- /dev/null +++ b/database/conn.go @@ -0,0 +1,134 @@ +package iotdb_go + +import ( + "context" + "fmt" + "github.com/apache/iotdb-client-go/v2/client" + "github.com/apache/iotdb-client-go/v2/database/column" + "github.com/pkg/errors" + "log" + "net" + "os" + "time" +) + +func dial(ctx context.Context, addr string, num int, opt *Options) (*connect, error) { + if addr == "" { + return nil, errors.New("empty addr") + } + // 使用 net.SplitHostPort 分割地址和端口 + host, port, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + var ( + conn client.SessionPool + debugf = func(format string, v ...any) {} + ) + + if opt.Debug { + if opt.Debugf != nil { + debugf = func(format string, v ...any) { + opt.Debugf( + "[iotdb][%s][id=%d] "+format, + append([]interface{}{opt.Addr, num}, v...)..., + ) + } + } else { + debugf = log.New(os.Stdout, fmt.Sprintf("[iotdb][%s][id=%d]", opt.Addr, num), 0).Printf + } + } + + config := &client.PoolConfig{ + Host: host, + Port: port, + UserName: opt.UserName, + Password: opt.Password, + } + + conn = client.NewSessionPool(config, 3, 60000, 60000, false) + + var ( + netConn = &connect{ + id: num, + opt: opt, + conn: conn, + debugfFunc: debugf, + connectedAt: time.Now(), + } + ) + + return netConn, nil +} + +type connect struct { + id int + opt *Options + conn client.SessionPool + debugfFunc func(format string, v ...any) + connectedAt time.Time + timeZone *time.Location +} + +func (c *connect) debugf(format string, v ...any) { + c.debugfFunc(format, v...) +} + +func (c *connect) isBad() bool { + return false +} +func (c *connect) close() error { + c.conn.Close() + return nil +} + +func (c *connect) ping(ctx context.Context) (err error) { + session, err := c.conn.GetSession() + defer c.conn.PutBack(session) + if err != nil { + return err + } + return session.Ping(ctx) +} + +func (c *connect) query(ctx context.Context, release nativeTransportRelease, query string, args ...any) (*rows, error) { + var ( + options = queryOptions(ctx) + body, err = bindQueryOrAppendParameters(&options, query, c.timeZone, args...) + ) + session, err := c.conn.GetSession() + defer c.conn.PutBack(session) + if err != nil { + release(c, err) + return nil, err + } + var timeout int64 = int64(c.opt.DialTimeout.Seconds() * 1000) + if timeout == 0 { + timeout = 5000 + } + statement, err := session.ExecuteQueryStatement(body, &timeout) + if err != nil { + release(c, err) + return nil, err + } + + // column list + names := statement.GetColumnNames() + columnsList := make([]column.Interface, len(names)) + for k, name := range names { + dataType := statement.GetColumnTypes()[k] + col := column.GenColumn(dataType, name) + if col == nil { + continue + } + columnsList[k] = col + } + return &rows{ + set: statement, + columns: columnsList, + }, nil +} + +func (c *connect) commit() error { + return nil +} diff --git a/database/conn_exec.go b/database/conn_exec.go new file mode 100644 index 0000000..de45eee --- /dev/null +++ b/database/conn_exec.go @@ -0,0 +1,27 @@ +package iotdb_go + +import ( + "context" +) + +func (c *connect) exec(ctx context.Context, query string, args ...any) error { + var ( + options = queryOptions(ctx) + body, err = bindQueryOrAppendParameters(&options, query, c.timeZone, args...) + ) + if err != nil { + return err + } + + session, err := c.conn.GetSession() + if err != nil { + return err + } + defer c.conn.PutBack(session) + + _, err = session.ExecuteStatement(body) + if err != nil { + return err + } + return nil +} diff --git a/database/context.go b/database/context.go new file mode 100644 index 0000000..b4e1681 --- /dev/null +++ b/database/context.go @@ -0,0 +1,103 @@ +package iotdb_go + +import ( + "context" + "maps" + "slices" + "time" +) + +type Parameters map[string]string + +type Settings map[string]any + +// ColumnNameAndType represents a column name and type +type ColumnNameAndType struct { + Name string + Type string +} + +var _contextOptionKey = &QueryOptions{ + settings: Settings{ + "_contextOption": struct{}{}, + }, +} + +type ( + QueryOption func(*QueryOptions) error + AsyncOptions struct { + ok bool + wait bool + } + QueryOptions struct { + async AsyncOptions + queryID string + quotaKey string + jwt string + + settings Settings + parameters Parameters + blockBufferSize uint8 + userLocation *time.Location + columnNamesAndTypes []ColumnNameAndType + clientInfo ClientInfo + } +) + +// clone returns a copy of QueryOptions where Settings and Parameters are safely mutable. +func (q *QueryOptions) clone() QueryOptions { + c := QueryOptions{ + async: q.async, + queryID: q.queryID, + quotaKey: q.quotaKey, + settings: nil, + parameters: nil, + blockBufferSize: q.blockBufferSize, + userLocation: q.userLocation, + columnNamesAndTypes: nil, + } + + if q.settings != nil { + c.settings = maps.Clone(q.settings) + } + + if q.parameters != nil { + c.parameters = maps.Clone(q.parameters) + } + + if q.columnNamesAndTypes != nil { + c.columnNamesAndTypes = slices.Clone(q.columnNamesAndTypes) + } + + if q.clientInfo.Products != nil || q.clientInfo.Comment != nil { + c.clientInfo = q.clientInfo.Append(ClientInfo{}) + } + + return c +} + +// queryOptions returns a mutable copy of the QueryOptions struct within the given context. +// If iotdb context was not provided, an empty struct with a valid Settings map is returned. +// If the context has a deadline greater than 1s then max_execution_time setting is appended. +func queryOptions(ctx context.Context) QueryOptions { + var opt QueryOptions + + if ctxOpt, ok := ctx.Value(_contextOptionKey).(QueryOptions); ok { + opt = ctxOpt.clone() + } else { + opt = QueryOptions{ + settings: make(Settings), + } + } + + deadline, ok := ctx.Deadline() + if !ok { + return opt + } + + if sec := time.Until(deadline).Seconds(); sec > 1 { + opt.settings["max_execution_time"] = int(sec + 5) + } + + return opt +} diff --git a/database/driver/driver.go b/database/driver/driver.go new file mode 100644 index 0000000..ac0308c --- /dev/null +++ b/database/driver/driver.go @@ -0,0 +1,16 @@ +package driver + +import "time" + +type ( + NamedValue struct { + Name string + Value any + } + + NamedDateValue struct { + Name string + Value time.Time + Scale uint8 + } +) diff --git a/database/exec_test.go b/database/exec_test.go new file mode 100644 index 0000000..6f84d7d --- /dev/null +++ b/database/exec_test.go @@ -0,0 +1,25 @@ +package iotdb_go + +import ( + "context" + "fmt" + "testing" +) + +func TestConnectionPool_ExecContext(t *testing.T) { + execContext, err := conn.ExecContext(context.Background(), "insert into root.ln.wf02.wt02(timestamp,status) values(?,?)", 2, true) + if err != nil { + t.Fatalf("failed to execute query: %v", err) + return + } + id, err := execContext.LastInsertId() + if err != nil { + return + } + fmt.Println(id) + affected, err := execContext.RowsAffected() + if err != nil { + return + } + fmt.Println(affected) +} diff --git a/database/iotdb.go b/database/iotdb.go new file mode 100644 index 0000000..afe5232 --- /dev/null +++ b/database/iotdb.go @@ -0,0 +1,29 @@ +package iotdb_go + +import ( + "context" + "errors" +) + +// nativeTransport represents an implementation (TCP or HTTP) that can be pooled by the main iotdb struct. +// Implementations are not expected to be thread safe, which is why we provide acquire/release functions. +type nativeTransport interface { + query(ctx context.Context, release nativeTransportRelease, query string, args ...any) (*rows, error) +} + +// nativeTransport represents an implementation (TCP or HTTP) that can be pooled by the main iotdb struct. +// Implementations are not expected to be thread safe, which is why we provide acquire/release functions. +type nativeTransportAcquire func(context.Context) (nativeTransport, error) +type nativeTransportRelease func(nativeTransport, error) + +var ( + ErrBatchInvalid = errors.New("iotdb: batch is invalid. check appended data is correct") + ErrBatchAlreadySent = errors.New("iotdb: batch has already been sent") + ErrBatchNotSent = errors.New("iotdb: invalid retry, batch not sent yet") + ErrAcquireConnTimeout = errors.New("iotdb: acquire conn timeout. you can increase the number of max open conn or the dial timeout") + ErrUnsupportedServerRevision = errors.New("iotdb: unsupported server revision") + ErrBindMixedParamsFormats = errors.New("iotdb [bind]: mixed named, numeric or positional parameters") + ErrAcquireConnNoAddress = errors.New("iotdb: no valid address supplied") + ErrServerUnexpectedData = errors.New("code: 101, message: Unexpected packet Data received from client") + ErrConnectionClosed = errors.New("iotdb: connection is closed") +) diff --git a/database/iotdb_std.go b/database/iotdb_std.go new file mode 100644 index 0000000..bfbcebc --- /dev/null +++ b/database/iotdb_std.go @@ -0,0 +1,207 @@ +package iotdb_go + +import ( + "context" + "database/sql" + "database/sql/driver" + "errors" + "io" + "log" + "net" + "os" + "syscall" +) + +var globalConnID int64 + +func init() { + var debugf = func(format string, v ...any) {} + sql.Register("iotdb", &stdDriver{debugf: debugf}) +} + +// isConnBrokenError returns true if the error class indicates that the +// db connection is no longer usable and should be marked bad +func isConnBrokenError(err error) bool { + if errors.Is(err, io.EOF) || errors.Is(err, syscall.EPIPE) || errors.Is(err, syscall.ECONNRESET) { + return true + } + if _, ok := err.(*net.OpError); ok { + return true + } + return false +} + +type stdDriver struct { + opt *Options + conn stdConnect + commit func() error + debugf func(format string, v ...any) +} + +var _ driver.Conn = (*stdDriver)(nil) +var _ driver.ConnBeginTx = (*stdDriver)(nil) +var _ driver.ExecerContext = (*stdDriver)(nil) +var _ driver.QueryerContext = (*stdDriver)(nil) +var _ driver.ConnPrepareContext = (*stdDriver)(nil) + +func (std *stdDriver) Open(dsn string) (_ driver.Conn, err error) { + var opt Options + if err := opt.fromDSN(dsn); err != nil { + std.debugf("Open dsn error: %v\n", err) + return nil, err + } + var debugf = func(format string, v ...any) {} + if opt.Debug { + debugf = log.New(os.Stdout, "[iotdb-std][opener] ", 0).Printf + } + opt.ClientInfo.Comment = []string{"database/sql"} + return (&stdConnOpener{opt: &opt, debugf: debugf}).Connect(context.Background()) +} + +var _ driver.Driver = (*stdDriver)(nil) + +func (std *stdDriver) ResetSession(ctx context.Context) error { + if std.conn.isBad() { + std.debugf("Resetting session because connection is bad") + return driver.ErrBadConn + } + return nil +} + +var _ driver.SessionResetter = (*stdDriver)(nil) + +func (std *stdDriver) Ping(ctx context.Context) error { + if std.conn.isBad() { + std.debugf("Ping: connection is bad") + return driver.ErrBadConn + } + + return std.conn.ping(ctx) +} + +var _ driver.Pinger = (*stdDriver)(nil) + +// Begin starts and returns a new transaction. +// +// Deprecated: Drivers should implement ConnBeginTx instead (or additionally). +func (std *stdDriver) Begin() (driver.Tx, error) { + if std.conn.isBad() { + std.debugf("Begin: connection is bad") + return nil, driver.ErrBadConn + } + return std, nil +} + +func (std *stdDriver) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { + if std.conn.isBad() { + std.debugf("BeginTx: connection is bad") + return nil, driver.ErrBadConn + } + + return std, nil +} + +func (std *stdDriver) Commit() error { + if std.commit == nil { + return nil + } + defer func() { + std.commit = nil + }() + + if err := std.commit(); err != nil { + if isConnBrokenError(err) { + std.debugf("Commit got EOF error: resetting connection") + return driver.ErrBadConn + } + std.debugf("Commit error: %v\n", err) + return err + } + return nil +} + +func (std *stdDriver) Rollback() error { + std.commit = nil + std.conn.close() + return nil +} + +var _ driver.Tx = (*stdDriver)(nil) + +func (std *stdDriver) CheckNamedValue(nv *driver.NamedValue) error { return nil } + +var _ driver.NamedValueChecker = (*stdDriver)(nil) + +// Prepare returns a prepared statement, bound to this connection. +func (std *stdDriver) Prepare(query string) (driver.Stmt, error) { + return std.PrepareContext(context.Background(), query) +} + +func (std *stdDriver) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { + if std.conn.isBad() { + std.debugf("QueryContext: connection is bad") + return nil, driver.ErrBadConn + } + + r, err := std.conn.query(ctx, func(nativeTransport, error) {}, query, rebind(args)...) + if isConnBrokenError(err) { + std.debugf("QueryContext got a fatal error, resetting connection: %v\n", err) + return nil, driver.ErrBadConn + } + if err != nil { + std.debugf("QueryContext error: %v\n", err) + return nil, err + } + return &stdRows{ + rows: r, + debugf: std.debugf, + }, nil +} + +func (std *stdDriver) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { + if std.conn.isBad() { + std.debugf("PrepareContext: connection is bad") + return nil, driver.ErrBadConn + } + + std.commit = std.conn.commit + return &stdBatch{ + debugf: std.debugf, + }, nil +} + +// Close invalidates and potentially stops any current +// prepared statements and transactions, marking this +// connection as no longer in use. +// +// Because the sql package maintains a free pool of +// connections and only calls Close when there's a surplus of +// idle connections, it shouldn't be necessary for drivers to +// do their own connection caching. +// +// Drivers must ensure all network calls made by Close +// do not block indefinitely (e.g. apply a timeout). +func (std *stdDriver) Close() error { + err := std.conn.close() + if err != nil { + if isConnBrokenError(err) { + std.debugf("Close got a fatal error, resetting connection: %v\n", err) + return driver.ErrBadConn + } + std.debugf("Close error: %v\n", err) + } + return err +} + +func (std *stdDriver) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { + if std.conn.isBad() { + std.debugf("ExecContext: connection is bad") + return nil, driver.ErrBadConn + } + err := std.conn.exec(ctx, query, rebind(args)...) + if err != nil { + std.debugf("ExecContext error: %v\n", err) + return nil, err + } + return driver.RowsAffected(0), nil +} diff --git a/database/iotdb_std_test.go b/database/iotdb_std_test.go new file mode 100644 index 0000000..7f8127c --- /dev/null +++ b/database/iotdb_std_test.go @@ -0,0 +1,16 @@ +package iotdb_go + +import ( + "database/sql" +) + +var conn *sql.DB + +func init() { + var err error + conn, err = sql.Open("iotdb", "iotdb://192.168.2.100:6667?username=root&password=root") + if err != nil { + panic(err) + return + } +} diff --git a/database/options.go b/database/options.go new file mode 100644 index 0000000..d252716 --- /dev/null +++ b/database/options.go @@ -0,0 +1,141 @@ +package iotdb_go + +import ( + "context" + "crypto/tls" + "github.com/apache/iotdb-client-go/v2/client" + "github.com/pkg/errors" + "net" + "net/url" + "strconv" + "strings" + "time" +) + +type ClientInfo struct { + Products []struct { + Name string + Version string + } + + Comment []string +} + +// Append returns a new copy of the combined ClientInfo structs +func (a ClientInfo) Append(b ClientInfo) ClientInfo { + c := ClientInfo{ + Products: make([]struct { + Name string + Version string + }, 0, len(a.Products)+len(b.Products)), + Comment: make([]string, 0, len(a.Comment)+len(b.Comment)), + } + + for _, p := range a.Products { + c.Products = append(c.Products, p) + } + for _, p := range b.Products { + c.Products = append(c.Products, p) + } + + for _, cm := range a.Comment { + c.Comment = append(c.Comment, cm) + } + for _, cm := range b.Comment { + c.Comment = append(c.Comment, cm) + } + + return c +} + +type ConnOpenStrategy uint8 + +const ( + ConnOpenInOrder ConnOpenStrategy = iota + ConnOpenRoundRobin + ConnOpenRandom +) + +type Options struct { + client.PoolConfig + Debug bool + ClientInfo ClientInfo + Addr []string + ConnOpenStrategy ConnOpenStrategy + DialContext func(ctx context.Context, addr string) (net.Conn, error) + TLS *tls.Config + DialTimeout time.Duration // default 30 second + Debugf func(format string, v ...any) // only works when Debug is true +} + +func ParseDSN(dsn string) (*Options, error) { + opt := &Options{} + err := opt.fromDSN(dsn) + if err != nil { + return nil, err + } + return opt, err +} + +func (o *Options) fromDSN(in string) error { + dsn, err := url.Parse(in) + if err != nil { + return err + } + if dsn.Host == "" { + return errors.New("parse dsn address failed") + } + + if dsn.User != nil { + o.PoolConfig.UserName = dsn.User.Username() + o.PoolConfig.Password, _ = dsn.User.Password() + } + + //o.PoolConfig.Password = strings.TrimPrefix(dsn.Path, "/") + o.Addr = append(o.Addr, strings.Split(dsn.Host, ",")...) + + var params = dsn.Query() + + for v := range params { + switch v { + case "fetch_size": + { + fetchSize, err := strconv.ParseInt(params.Get(v), 10, 32) + if err != nil { + return errors.Wrap(err, "fetch size invalid value") + } + o.PoolConfig.FetchSize = int32(fetchSize) + break + } + case "time_zone": + { + o.PoolConfig.TimeZone = params.Get(v) + break + } + case "connect_retry_max": + { + connectRetryMax, err := strconv.ParseInt(params.Get(v), 10, 32) + if err != nil { + return errors.Wrap(err, "connect retry max invalid value") + } + o.PoolConfig.ConnectRetryMax = int(connectRetryMax) + break + } + case "username": + { + o.PoolConfig.UserName = params.Get(v) + break + } + case "password": + { + o.PoolConfig.Password = params.Get(v) + break + } + default: + { + break + } + } + } + return nil +} diff --git a/database/query_parameters.go b/database/query_parameters.go new file mode 100644 index 0000000..a327601 --- /dev/null +++ b/database/query_parameters.go @@ -0,0 +1,23 @@ +package iotdb_go + +import ( + "errors" + "regexp" + "time" +) + +var ( + ErrInvalidValueInNamedDateValue = errors.New("invalid value in NamedDateValue for query parameter") + ErrUnsupportedQueryParameter = errors.New("unsupported query parameter type") + + hasQueryParamsRe = regexp.MustCompile("{.+:.+}") +) + +func bindQueryOrAppendParameters(options *QueryOptions, query string, timezone *time.Location, args ...any) (string, error) { + // prefer native query parameters over legacy bind if query parameters provided explicit + if len(options.parameters) > 0 { + return query, nil + } + + return bind(timezone, query, args...) +} diff --git a/database/query_test.go b/database/query_test.go new file mode 100644 index 0000000..b64d0eb --- /dev/null +++ b/database/query_test.go @@ -0,0 +1,71 @@ +package iotdb_go + +import ( + "context" + "github.com/stretchr/testify/assert" + "testing" + "time" +) + +func TestConnectionPool_QueryContext(t *testing.T) { + + start, err := time.Parse(time.DateTime, "2026-01-01 00:00:00") + if err != nil { + t.Fatalf("parse start time error: %v", err) + return + } + + end, err := time.Parse(time.DateTime, "2026-01-01 00:00:00") + if err != nil { + t.Fatalf("parse end time error: %v", err) + return + } + row, err := conn.QueryContext(context.Background(), "select count(value) from root.device.** where time > ? and time < ? order by count(value) desc limit 10 ALIGN BY DEVICE;", + start, end) + if err != nil { + t.Fatalf("query error: %v", err) + return + } + type Device struct { + Device string + Count int64 + } + for { + var de Device + next := row.Next() + if !next { + break + } + err := row.Scan(&de.Device, &de.Count) + if err != nil { + t.Fatalf("scan device error: %v", err) + return + } + assert.NotEqual(t, "", de.Device) + } + +} + +func TestConnectionPool_QueryRowContext(t *testing.T) { + start, err := time.Parse(time.DateTime, "2026-01-01 00:00:00") + if err != nil { + t.Fatalf("parse start time error: %v", err) + return + } + + end, err := time.Parse(time.DateTime, "2026-01-01 00:00:00") + if err != nil { + t.Fatalf("parse end time error: %v", err) + return + } + + row := conn.QueryRowContext(context.Background(), "select sum(value) from root.device.dev10033642143439443283;", + start, end) + var count float64 + err = row.Scan(&count) + if err != nil { + t.Fatalf("scan device error: %v", err) + return + } + return +} diff --git a/database/rows.go b/database/rows.go new file mode 100644 index 0000000..f779ded --- /dev/null +++ b/database/rows.go @@ -0,0 +1,20 @@ +package iotdb_go + +import ( + "errors" + "github.com/apache/iotdb-client-go/v2/client" + "github.com/apache/iotdb-client-go/v2/database/column" +) + +type rows struct { + set *client.SessionDataSet + columns []column.Interface +} + +func (r *rows) Next() (bool, error) { + if r.set == nil { + return false, errors.New("rows is nil") + } + + return r.set.Next() +} diff --git a/database/rows_std.go b/database/rows_std.go new file mode 100644 index 0000000..a92d929 --- /dev/null +++ b/database/rows_std.go @@ -0,0 +1,66 @@ +package iotdb_go + +import ( + "database/sql/driver" + "github.com/pkg/errors" + "io" +) + +type stdRows struct { + rows *rows + debugf func(format string, v ...any) +} + +// Columns returns the names of the columns. The number of +// columns of the result is inferred from the length of the +// slice. If a particular column name isn't known, an empty +// string should be returned for that entry. +func (s *stdRows) Columns() []string { + return s.rows.set.GetColumnNames() +} + +// Close closes the rows iterator. +func (s *stdRows) Close() error { + return nil +} + +// Next is called to populate the next row of data into +// the provided slice. The provided slice will be the same +// size as the Columns() are wide. +// +// Next should return io.EOF when there are no more rows. +// +// The dest should not be written to outside of Next. Care +// should be taken when closing Rows not to modify +// a buffer held in dest. +func (s *stdRows) Next(dest []driver.Value) error { + if len(s.rows.set.GetColumnNames()) != len(dest) { + return errors.New("column count mismatch") + } + next, err := s.rows.Next() + if err != nil { + s.debugf("rows.Next() failed: %v", err) + return err + } + if !next { + return io.EOF + } + if next { + for i := range dest { + + switch value := s.rows.columns[i].Row(s.rows.set, false).(type) { + case driver.Valuer: + v, err := value.Value() + if err != nil { + s.debugf("Next row error: %v\n", err) + return err + } + dest[i] = v + default: + dest[i] = value + break + } + } + } + return nil +} diff --git a/database/std_conn_opener.go b/database/std_conn_opener.go new file mode 100644 index 0000000..44166b1 --- /dev/null +++ b/database/std_conn_opener.go @@ -0,0 +1,83 @@ +package iotdb_go + +import ( + "context" + "database/sql/driver" + "fmt" + "log" + "math/rand" + "os" + "sync/atomic" +) + +type stdConnOpener struct { + err error + opt *Options + debugf func(format string, v ...any) +} + +func (o *stdConnOpener) Driver() driver.Driver { + var debugf = func(format string, v ...any) {} + if o.opt.Debug { + if o.opt.Debugf != nil { + debugf = o.opt.Debugf + } else { + debugf = log.New(os.Stdout, "[iotdb-std] ", 0).Printf + } + } + return &stdDriver{ + opt: o.opt, + debugf: debugf, + } +} + +func (o *stdConnOpener) Connect(ctx context.Context) (_ driver.Conn, err error) { + if o.err != nil { + o.debugf("[connect] opener error: %v\n", o.err) + return nil, o.err + } + var ( + conn stdConnect + connID = int(atomic.AddInt64(&globalConnID, 1)) + dialFunc func(ctx context.Context, addr string, num int, opt *Options) (stdConnect, error) + ) + + dialFunc = func(ctx context.Context, addr string, num int, opt *Options) (stdConnect, error) { + return dial(ctx, addr, num, opt) + } + + if o.opt.Addr == nil || len(o.opt.Addr) == 0 { + return nil, ErrAcquireConnNoAddress + } + + for i := range o.opt.Addr { + var num int + switch o.opt.ConnOpenStrategy { + case ConnOpenInOrder: + num = i + case ConnOpenRoundRobin: + num = (connID + i) % len(o.opt.Addr) + case ConnOpenRandom: + random := rand.Int() + num = (random + i) % len(o.opt.Addr) + } + if conn, err = dialFunc(ctx, o.opt.Addr[num], connID, o.opt); err == nil { + var debugf = func(format string, v ...any) {} + if o.opt.Debug { + if o.opt.Debugf != nil { + debugf = o.opt.Debugf + } else { + debugf = log.New(os.Stdout, fmt.Sprintf("[iotdb-std][conn=%d][%s] ", num, o.opt.Addr[num]), 0).Printf + } + } + return &stdDriver{ + conn: conn, + debugf: debugf, + }, nil + } else { + o.debugf("[connect] error connecting to %s on connection %d: %v\n", o.opt.Addr[num], connID, err) + } + } + + return nil, err +} diff --git a/database/std_connect.go b/database/std_connect.go new file mode 100644 index 0000000..111d36c --- /dev/null +++ b/database/std_connect.go @@ -0,0 +1,12 @@ +package iotdb_go + +import "context" + +type stdConnect interface { + isBad() bool + close() error + query(ctx context.Context, release nativeTransportRelease, query string, args ...any) (*rows, error) + exec(ctx context.Context, query string, args ...any) error + ping(ctx context.Context) (err error) + commit() error +} diff --git a/go.mod b/go.mod index caff166..a2a1faf 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,15 @@ module github.com/apache/iotdb-client-go/v2 -go 1.13 +go 1.24.3 require ( github.com/apache/thrift v0.15.0 + github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.2 ) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum index e4c4107..000d73e 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs 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/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE new file mode 100644 index 0000000..bc52e96 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2012-2016 Dave Collins + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go new file mode 100644 index 0000000..7929947 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -0,0 +1,145 @@ +// Copyright (c) 2015-2016 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when the code is not running on Google App Engine, compiled by GopherJS, and +// "-tags safe" is not added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// Go versions prior to 1.4 are disabled because they use a different layout +// for interfaces which make the implementation of unsafeReflectValue more complex. +// +build !js,!appengine,!safe,!disableunsafe,go1.4 + +package spew + +import ( + "reflect" + "unsafe" +) + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = false + + // ptrSize is the size of a pointer on the current arch. + ptrSize = unsafe.Sizeof((*byte)(nil)) +) + +type flag uintptr + +var ( + // flagRO indicates whether the value field of a reflect.Value + // is read-only. + flagRO flag + + // flagAddr indicates whether the address of the reflect.Value's + // value may be taken. + flagAddr flag +) + +// flagKindMask holds the bits that make up the kind +// part of the flags field. In all the supported versions, +// it is in the lower 5 bits. +const flagKindMask = flag(0x1f) + +// Different versions of Go have used different +// bit layouts for the flags type. This table +// records the known combinations. +var okFlags = []struct { + ro, addr flag +}{{ + // From Go 1.4 to 1.5 + ro: 1 << 5, + addr: 1 << 7, +}, { + // Up to Go tip. + ro: 1<<5 | 1<<6, + addr: 1 << 8, +}} + +var flagValOffset = func() uintptr { + field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") + if !ok { + panic("reflect.Value has no flag field") + } + return field.Offset +}() + +// flagField returns a pointer to the flag field of a reflect.Value. +func flagField(v *reflect.Value) *flag { + return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) +} + +// unsafeReflectValue converts the passed reflect.Value into a one that bypasses +// the typical safety restrictions preventing access to unaddressable and +// unexported data. It works by digging the raw pointer to the underlying +// value out of the protected value and generating a new unprotected (unsafe) +// reflect.Value to it. +// +// This allows us to check for implementations of the Stringer and error +// interfaces to be used for pretty printing ordinarily unaddressable and +// inaccessible values such as unexported struct fields. +func unsafeReflectValue(v reflect.Value) reflect.Value { + if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { + return v + } + flagFieldPtr := flagField(&v) + *flagFieldPtr &^= flagRO + *flagFieldPtr |= flagAddr + return v +} + +// Sanity checks against future reflect package changes +// to the type or semantics of the Value.flag field. +func init() { + field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") + if !ok { + panic("reflect.Value has no flag field") + } + if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { + panic("reflect.Value flag field has changed kind") + } + type t0 int + var t struct { + A t0 + // t0 will have flagEmbedRO set. + t0 + // a will have flagStickyRO set + a t0 + } + vA := reflect.ValueOf(t).FieldByName("A") + va := reflect.ValueOf(t).FieldByName("a") + vt0 := reflect.ValueOf(t).FieldByName("t0") + + // Infer flagRO from the difference between the flags + // for the (otherwise identical) fields in t. + flagPublic := *flagField(&vA) + flagWithRO := *flagField(&va) | *flagField(&vt0) + flagRO = flagPublic ^ flagWithRO + + // Infer flagAddr from the difference between a value + // taken from a pointer and not. + vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") + flagNoPtr := *flagField(&vA) + flagPtr := *flagField(&vPtrA) + flagAddr = flagNoPtr ^ flagPtr + + // Check that the inferred flags tally with one of the known versions. + for _, f := range okFlags { + if flagRO == f.ro && flagAddr == f.addr { + return + } + } + panic("reflect.Value read-only flag has changed semantics") +} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go new file mode 100644 index 0000000..205c28d --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -0,0 +1,38 @@ +// Copyright (c) 2015-2016 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when the code is running on Google App Engine, compiled by GopherJS, or +// "-tags safe" is added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// +build js appengine safe disableunsafe !go1.4 + +package spew + +import "reflect" + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = true +) + +// unsafeReflectValue typically converts the passed reflect.Value into a one +// that bypasses the typical safety restrictions preventing access to +// unaddressable and unexported data. However, doing this relies on access to +// the unsafe package. This is a stub version which simply returns the passed +// reflect.Value when the unsafe package is not available. +func unsafeReflectValue(v reflect.Value) reflect.Value { + return v +} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go new file mode 100644 index 0000000..1be8ce9 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/common.go @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "io" + "reflect" + "sort" + "strconv" +) + +// Some constants in the form of bytes to avoid string overhead. This mirrors +// the technique used in the fmt package. +var ( + panicBytes = []byte("(PANIC=") + plusBytes = []byte("+") + iBytes = []byte("i") + trueBytes = []byte("true") + falseBytes = []byte("false") + interfaceBytes = []byte("(interface {})") + commaNewlineBytes = []byte(",\n") + newlineBytes = []byte("\n") + openBraceBytes = []byte("{") + openBraceNewlineBytes = []byte("{\n") + closeBraceBytes = []byte("}") + asteriskBytes = []byte("*") + colonBytes = []byte(":") + colonSpaceBytes = []byte(": ") + openParenBytes = []byte("(") + closeParenBytes = []byte(")") + spaceBytes = []byte(" ") + pointerChainBytes = []byte("->") + nilAngleBytes = []byte("") + maxNewlineBytes = []byte("\n") + maxShortBytes = []byte("") + circularBytes = []byte("") + circularShortBytes = []byte("") + invalidAngleBytes = []byte("") + openBracketBytes = []byte("[") + closeBracketBytes = []byte("]") + percentBytes = []byte("%") + precisionBytes = []byte(".") + openAngleBytes = []byte("<") + closeAngleBytes = []byte(">") + openMapBytes = []byte("map[") + closeMapBytes = []byte("]") + lenEqualsBytes = []byte("len=") + capEqualsBytes = []byte("cap=") +) + +// hexDigits is used to map a decimal value to a hex digit. +var hexDigits = "0123456789abcdef" + +// catchPanic handles any panics that might occur during the handleMethods +// calls. +func catchPanic(w io.Writer, v reflect.Value) { + if err := recover(); err != nil { + w.Write(panicBytes) + fmt.Fprintf(w, "%v", err) + w.Write(closeParenBytes) + } +} + +// handleMethods attempts to call the Error and String methods on the underlying +// type the passed reflect.Value represents and outputes the result to Writer w. +// +// It handles panics in any called methods by catching and displaying the error +// as the formatted value. +func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { + // We need an interface to check if the type implements the error or + // Stringer interface. However, the reflect package won't give us an + // interface on certain things like unexported struct fields in order + // to enforce visibility rules. We use unsafe, when it's available, + // to bypass these restrictions since this package does not mutate the + // values. + if !v.CanInterface() { + if UnsafeDisabled { + return false + } + + v = unsafeReflectValue(v) + } + + // Choose whether or not to do error and Stringer interface lookups against + // the base type or a pointer to the base type depending on settings. + // Technically calling one of these methods with a pointer receiver can + // mutate the value, however, types which choose to satisify an error or + // Stringer interface with a pointer receiver should not be mutating their + // state inside these interface methods. + if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { + v = unsafeReflectValue(v) + } + if v.CanAddr() { + v = v.Addr() + } + + // Is it an error or Stringer? + switch iface := v.Interface().(type) { + case error: + defer catchPanic(w, v) + if cs.ContinueOnMethod { + w.Write(openParenBytes) + w.Write([]byte(iface.Error())) + w.Write(closeParenBytes) + w.Write(spaceBytes) + return false + } + + w.Write([]byte(iface.Error())) + return true + + case fmt.Stringer: + defer catchPanic(w, v) + if cs.ContinueOnMethod { + w.Write(openParenBytes) + w.Write([]byte(iface.String())) + w.Write(closeParenBytes) + w.Write(spaceBytes) + return false + } + w.Write([]byte(iface.String())) + return true + } + return false +} + +// printBool outputs a boolean value as true or false to Writer w. +func printBool(w io.Writer, val bool) { + if val { + w.Write(trueBytes) + } else { + w.Write(falseBytes) + } +} + +// printInt outputs a signed integer value to Writer w. +func printInt(w io.Writer, val int64, base int) { + w.Write([]byte(strconv.FormatInt(val, base))) +} + +// printUint outputs an unsigned integer value to Writer w. +func printUint(w io.Writer, val uint64, base int) { + w.Write([]byte(strconv.FormatUint(val, base))) +} + +// printFloat outputs a floating point value using the specified precision, +// which is expected to be 32 or 64bit, to Writer w. +func printFloat(w io.Writer, val float64, precision int) { + w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) +} + +// printComplex outputs a complex value using the specified float precision +// for the real and imaginary parts to Writer w. +func printComplex(w io.Writer, c complex128, floatPrecision int) { + r := real(c) + w.Write(openParenBytes) + w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) + i := imag(c) + if i >= 0 { + w.Write(plusBytes) + } + w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) + w.Write(iBytes) + w.Write(closeParenBytes) +} + +// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' +// prefix to Writer w. +func printHexPtr(w io.Writer, p uintptr) { + // Null pointer. + num := uint64(p) + if num == 0 { + w.Write(nilAngleBytes) + return + } + + // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix + buf := make([]byte, 18) + + // It's simpler to construct the hex string right to left. + base := uint64(16) + i := len(buf) - 1 + for num >= base { + buf[i] = hexDigits[num%base] + num /= base + i-- + } + buf[i] = hexDigits[num] + + // Add '0x' prefix. + i-- + buf[i] = 'x' + i-- + buf[i] = '0' + + // Strip unused leading bytes. + buf = buf[i:] + w.Write(buf) +} + +// valuesSorter implements sort.Interface to allow a slice of reflect.Value +// elements to be sorted. +type valuesSorter struct { + values []reflect.Value + strings []string // either nil or same len and values + cs *ConfigState +} + +// newValuesSorter initializes a valuesSorter instance, which holds a set of +// surrogate keys on which the data should be sorted. It uses flags in +// ConfigState to decide if and how to populate those surrogate keys. +func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { + vs := &valuesSorter{values: values, cs: cs} + if canSortSimply(vs.values[0].Kind()) { + return vs + } + if !cs.DisableMethods { + vs.strings = make([]string, len(values)) + for i := range vs.values { + b := bytes.Buffer{} + if !handleMethods(cs, &b, vs.values[i]) { + vs.strings = nil + break + } + vs.strings[i] = b.String() + } + } + if vs.strings == nil && cs.SpewKeys { + vs.strings = make([]string, len(values)) + for i := range vs.values { + vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) + } + } + return vs +} + +// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted +// directly, or whether it should be considered for sorting by surrogate keys +// (if the ConfigState allows it). +func canSortSimply(kind reflect.Kind) bool { + // This switch parallels valueSortLess, except for the default case. + switch kind { + case reflect.Bool: + return true + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return true + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + return true + case reflect.Float32, reflect.Float64: + return true + case reflect.String: + return true + case reflect.Uintptr: + return true + case reflect.Array: + return true + } + return false +} + +// Len returns the number of values in the slice. It is part of the +// sort.Interface implementation. +func (s *valuesSorter) Len() int { + return len(s.values) +} + +// Swap swaps the values at the passed indices. It is part of the +// sort.Interface implementation. +func (s *valuesSorter) Swap(i, j int) { + s.values[i], s.values[j] = s.values[j], s.values[i] + if s.strings != nil { + s.strings[i], s.strings[j] = s.strings[j], s.strings[i] + } +} + +// valueSortLess returns whether the first value should sort before the second +// value. It is used by valueSorter.Less as part of the sort.Interface +// implementation. +func valueSortLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Bool: + return !a.Bool() && b.Bool() + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return a.Int() < b.Int() + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + return a.Uint() < b.Uint() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.String: + return a.String() < b.String() + case reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Array: + // Compare the contents of both arrays. + l := a.Len() + for i := 0; i < l; i++ { + av := a.Index(i) + bv := b.Index(i) + if av.Interface() == bv.Interface() { + continue + } + return valueSortLess(av, bv) + } + } + return a.String() < b.String() +} + +// Less returns whether the value at index i should sort before the +// value at index j. It is part of the sort.Interface implementation. +func (s *valuesSorter) Less(i, j int) bool { + if s.strings == nil { + return valueSortLess(s.values[i], s.values[j]) + } + return s.strings[i] < s.strings[j] +} + +// sortValues is a sort function that handles both native types and any type that +// can be converted to error or Stringer. Other inputs are sorted according to +// their Value.String() value to ensure display stability. +func sortValues(values []reflect.Value, cs *ConfigState) { + if len(values) == 0 { + return + } + sort.Sort(newValuesSorter(values, cs)) +} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go new file mode 100644 index 0000000..2e3d22f --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/config.go @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "io" + "os" +) + +// ConfigState houses the configuration options used by spew to format and +// display values. There is a global instance, Config, that is used to control +// all top-level Formatter and Dump functionality. Each ConfigState instance +// provides methods equivalent to the top-level functions. +// +// The zero value for ConfigState provides no indentation. You would typically +// want to set it to a space or a tab. +// +// Alternatively, you can use NewDefaultConfig to get a ConfigState instance +// with default settings. See the documentation of NewDefaultConfig for default +// values. +type ConfigState struct { + // Indent specifies the string to use for each indentation level. The + // global config instance that all top-level functions use set this to a + // single space by default. If you would like more indentation, you might + // set this to a tab with "\t" or perhaps two spaces with " ". + Indent string + + // MaxDepth controls the maximum number of levels to descend into nested + // data structures. The default, 0, means there is no limit. + // + // NOTE: Circular data structures are properly detected, so it is not + // necessary to set this value unless you specifically want to limit deeply + // nested data structures. + MaxDepth int + + // DisableMethods specifies whether or not error and Stringer interfaces are + // invoked for types that implement them. + DisableMethods bool + + // DisablePointerMethods specifies whether or not to check for and invoke + // error and Stringer interfaces on types which only accept a pointer + // receiver when the current type is not a pointer. + // + // NOTE: This might be an unsafe action since calling one of these methods + // with a pointer receiver could technically mutate the value, however, + // in practice, types which choose to satisify an error or Stringer + // interface with a pointer receiver should not be mutating their state + // inside these interface methods. As a result, this option relies on + // access to the unsafe package, so it will not have any effect when + // running in environments without access to the unsafe package such as + // Google App Engine or with the "safe" build tag specified. + DisablePointerMethods bool + + // DisablePointerAddresses specifies whether to disable the printing of + // pointer addresses. This is useful when diffing data structures in tests. + DisablePointerAddresses bool + + // DisableCapacities specifies whether to disable the printing of capacities + // for arrays, slices, maps and channels. This is useful when diffing + // data structures in tests. + DisableCapacities bool + + // ContinueOnMethod specifies whether or not recursion should continue once + // a custom error or Stringer interface is invoked. The default, false, + // means it will print the results of invoking the custom error or Stringer + // interface and return immediately instead of continuing to recurse into + // the internals of the data type. + // + // NOTE: This flag does not have any effect if method invocation is disabled + // via the DisableMethods or DisablePointerMethods options. + ContinueOnMethod bool + + // SortKeys specifies map keys should be sorted before being printed. Use + // this to have a more deterministic, diffable output. Note that only + // native types (bool, int, uint, floats, uintptr and string) and types + // that support the error or Stringer interfaces (if methods are + // enabled) are supported, with other types sorted according to the + // reflect.Value.String() output which guarantees display stability. + SortKeys bool + + // SpewKeys specifies that, as a last resort attempt, map keys should + // be spewed to strings and sorted by those strings. This is only + // considered if SortKeys is true. + SpewKeys bool +} + +// Config is the active configuration of the top-level functions. +// The configuration can be changed by modifying the contents of spew.Config. +var Config = ConfigState{Indent: " "} + +// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the formatted string as a value that satisfies error. See NewFormatter +// for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { + return fmt.Errorf(format, c.convertArgs(a)...) +} + +// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprint(w, c.convertArgs(a)...) +} + +// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { + return fmt.Fprintf(w, format, c.convertArgs(a)...) +} + +// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it +// passed with a Formatter interface returned by c.NewFormatter. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprintln(w, c.convertArgs(a)...) +} + +// Print is a wrapper for fmt.Print that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Print(a ...interface{}) (n int, err error) { + return fmt.Print(c.convertArgs(a)...) +} + +// Printf is a wrapper for fmt.Printf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { + return fmt.Printf(format, c.convertArgs(a)...) +} + +// Println is a wrapper for fmt.Println that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Println(a ...interface{}) (n int, err error) { + return fmt.Println(c.convertArgs(a)...) +} + +// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprint(a ...interface{}) string { + return fmt.Sprint(c.convertArgs(a)...) +} + +// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprintf(format string, a ...interface{}) string { + return fmt.Sprintf(format, c.convertArgs(a)...) +} + +// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it +// were passed with a Formatter interface returned by c.NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprintln(a ...interface{}) string { + return fmt.Sprintln(c.convertArgs(a)...) +} + +/* +NewFormatter returns a custom formatter that satisfies the fmt.Formatter +interface. As a result, it integrates cleanly with standard fmt package +printing functions. The formatter is useful for inline printing of smaller data +types similar to the standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Typically this function shouldn't be called directly. It is much easier to make +use of the custom formatter by calling one of the convenience functions such as +c.Printf, c.Println, or c.Printf. +*/ +func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { + return newFormatter(c, v) +} + +// Fdump formats and displays the passed arguments to io.Writer w. It formats +// exactly the same as Dump. +func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { + fdump(c, w, a...) +} + +/* +Dump displays the passed parameters to standard out with newlines, customizable +indentation, and additional debug information such as complete types and all +pointer addresses used to indirect to the final value. It provides the +following features over the built-in printing facilities provided by the fmt +package: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output + +The configuration options are controlled by modifying the public members +of c. See ConfigState for options documentation. + +See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to +get the formatted result as a string. +*/ +func (c *ConfigState) Dump(a ...interface{}) { + fdump(c, os.Stdout, a...) +} + +// Sdump returns a string with the passed arguments formatted exactly the same +// as Dump. +func (c *ConfigState) Sdump(a ...interface{}) string { + var buf bytes.Buffer + fdump(c, &buf, a...) + return buf.String() +} + +// convertArgs accepts a slice of arguments and returns a slice of the same +// length with each argument converted to a spew Formatter interface using +// the ConfigState associated with s. +func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { + formatters = make([]interface{}, len(args)) + for index, arg := range args { + formatters[index] = newFormatter(c, arg) + } + return formatters +} + +// NewDefaultConfig returns a ConfigState with the following default settings. +// +// Indent: " " +// MaxDepth: 0 +// DisableMethods: false +// DisablePointerMethods: false +// ContinueOnMethod: false +// SortKeys: false +func NewDefaultConfig() *ConfigState { + return &ConfigState{Indent: " "} +} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go new file mode 100644 index 0000000..aacaac6 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/doc.go @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* +Package spew implements a deep pretty printer for Go data structures to aid in +debugging. + +A quick overview of the additional features spew provides over the built-in +printing facilities for Go data types are as follows: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output (only when using + Dump style) + +There are two different approaches spew allows for dumping Go data structures: + + * Dump style which prints with newlines, customizable indentation, + and additional debug information such as types and all pointer addresses + used to indirect to the final value + * A custom Formatter interface that integrates cleanly with the standard fmt + package and replaces %v, %+v, %#v, and %#+v to provide inline printing + similar to the default %v while providing the additional functionality + outlined above and passing unsupported format verbs such as %x and %q + along to fmt + +Quick Start + +This section demonstrates how to quickly get started with spew. See the +sections below for further details on formatting and configuration options. + +To dump a variable with full newlines, indentation, type, and pointer +information use Dump, Fdump, or Sdump: + spew.Dump(myVar1, myVar2, ...) + spew.Fdump(someWriter, myVar1, myVar2, ...) + str := spew.Sdump(myVar1, myVar2, ...) + +Alternatively, if you would prefer to use format strings with a compacted inline +printing style, use the convenience wrappers Printf, Fprintf, etc with +%v (most compact), %+v (adds pointer addresses), %#v (adds types), or +%#+v (adds types and pointer addresses): + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + +Configuration Options + +Configuration of spew is handled by fields in the ConfigState type. For +convenience, all of the top-level functions use a global state available +via the spew.Config global. + +It is also possible to create a ConfigState instance that provides methods +equivalent to the top-level functions. This allows concurrent configuration +options. See the ConfigState documentation for more details. + +The following configuration options are available: + * Indent + String to use for each indentation level for Dump functions. + It is a single space by default. A popular alternative is "\t". + + * MaxDepth + Maximum number of levels to descend into nested data structures. + There is no limit by default. + + * DisableMethods + Disables invocation of error and Stringer interface methods. + Method invocation is enabled by default. + + * DisablePointerMethods + Disables invocation of error and Stringer interface methods on types + which only accept pointer receivers from non-pointer variables. + Pointer method invocation is enabled by default. + + * DisablePointerAddresses + DisablePointerAddresses specifies whether to disable the printing of + pointer addresses. This is useful when diffing data structures in tests. + + * DisableCapacities + DisableCapacities specifies whether to disable the printing of + capacities for arrays, slices, maps and channels. This is useful when + diffing data structures in tests. + + * ContinueOnMethod + Enables recursion into types after invoking error and Stringer interface + methods. Recursion after method invocation is disabled by default. + + * SortKeys + Specifies map keys should be sorted before being printed. Use + this to have a more deterministic, diffable output. Note that + only native types (bool, int, uint, floats, uintptr and string) + and types which implement error or Stringer interfaces are + supported with other types sorted according to the + reflect.Value.String() output which guarantees display + stability. Natural map order is used by default. + + * SpewKeys + Specifies that, as a last resort attempt, map keys should be + spewed to strings and sorted by those strings. This is only + considered if SortKeys is true. + +Dump Usage + +Simply call spew.Dump with a list of variables you want to dump: + + spew.Dump(myVar1, myVar2, ...) + +You may also call spew.Fdump if you would prefer to output to an arbitrary +io.Writer. For example, to dump to standard error: + + spew.Fdump(os.Stderr, myVar1, myVar2, ...) + +A third option is to call spew.Sdump to get the formatted output as a string: + + str := spew.Sdump(myVar1, myVar2, ...) + +Sample Dump Output + +See the Dump example for details on the setup of the types and variables being +shown here. + + (main.Foo) { + unexportedField: (*main.Bar)(0xf84002e210)({ + flag: (main.Flag) flagTwo, + data: (uintptr) + }), + ExportedField: (map[interface {}]interface {}) (len=1) { + (string) (len=3) "one": (bool) true + } + } + +Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C +command as shown. + ([]uint8) (len=32 cap=32) { + 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | + 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| + 00000020 31 32 |12| + } + +Custom Formatter + +Spew provides a custom formatter that implements the fmt.Formatter interface +so that it integrates cleanly with standard fmt package printing functions. The +formatter is useful for inline printing of smaller data types similar to the +standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Custom Formatter Usage + +The simplest way to make use of the spew custom formatter is to call one of the +convenience functions such as spew.Printf, spew.Println, or spew.Printf. The +functions have syntax you are most likely already familiar with: + + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + spew.Println(myVar, myVar2) + spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + +See the Index for the full list convenience functions. + +Sample Formatter Output + +Double pointer to a uint8: + %v: <**>5 + %+v: <**>(0xf8400420d0->0xf8400420c8)5 + %#v: (**uint8)5 + %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 + +Pointer to circular struct with a uint8 field and a pointer to itself: + %v: <*>{1 <*>} + %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} + %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} + %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} + +See the Printf example for details on the setup of variables being shown +here. + +Errors + +Since it is possible for custom Stringer/error interfaces to panic, spew +detects them and handles them internally by printing the panic information +inline with the output. Since spew is intended to provide deep pretty printing +capabilities on structures, it intentionally does not return any errors. +*/ +package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go new file mode 100644 index 0000000..f78d89f --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -0,0 +1,509 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "encoding/hex" + "fmt" + "io" + "os" + "reflect" + "regexp" + "strconv" + "strings" +) + +var ( + // uint8Type is a reflect.Type representing a uint8. It is used to + // convert cgo types to uint8 slices for hexdumping. + uint8Type = reflect.TypeOf(uint8(0)) + + // cCharRE is a regular expression that matches a cgo char. + // It is used to detect character arrays to hexdump them. + cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) + + // cUnsignedCharRE is a regular expression that matches a cgo unsigned + // char. It is used to detect unsigned character arrays to hexdump + // them. + cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) + + // cUint8tCharRE is a regular expression that matches a cgo uint8_t. + // It is used to detect uint8_t arrays to hexdump them. + cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) +) + +// dumpState contains information about the state of a dump operation. +type dumpState struct { + w io.Writer + depth int + pointers map[uintptr]int + ignoreNextType bool + ignoreNextIndent bool + cs *ConfigState +} + +// indent performs indentation according to the depth level and cs.Indent +// option. +func (d *dumpState) indent() { + if d.ignoreNextIndent { + d.ignoreNextIndent = false + return + } + d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) +} + +// unpackValue returns values inside of non-nil interfaces when possible. +// This is useful for data types like structs, arrays, slices, and maps which +// can contain varying types packed inside an interface. +func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Interface && !v.IsNil() { + v = v.Elem() + } + return v +} + +// dumpPtr handles formatting of pointers by indirecting them as necessary. +func (d *dumpState) dumpPtr(v reflect.Value) { + // Remove pointers at or below the current depth from map used to detect + // circular refs. + for k, depth := range d.pointers { + if depth >= d.depth { + delete(d.pointers, k) + } + } + + // Keep list of all dereferenced pointers to show later. + pointerChain := make([]uintptr, 0) + + // Figure out how many levels of indirection there are by dereferencing + // pointers and unpacking interfaces down the chain while detecting circular + // references. + nilFound := false + cycleFound := false + indirects := 0 + ve := v + for ve.Kind() == reflect.Ptr { + if ve.IsNil() { + nilFound = true + break + } + indirects++ + addr := ve.Pointer() + pointerChain = append(pointerChain, addr) + if pd, ok := d.pointers[addr]; ok && pd < d.depth { + cycleFound = true + indirects-- + break + } + d.pointers[addr] = d.depth + + ve = ve.Elem() + if ve.Kind() == reflect.Interface { + if ve.IsNil() { + nilFound = true + break + } + ve = ve.Elem() + } + } + + // Display type information. + d.w.Write(openParenBytes) + d.w.Write(bytes.Repeat(asteriskBytes, indirects)) + d.w.Write([]byte(ve.Type().String())) + d.w.Write(closeParenBytes) + + // Display pointer information. + if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { + d.w.Write(openParenBytes) + for i, addr := range pointerChain { + if i > 0 { + d.w.Write(pointerChainBytes) + } + printHexPtr(d.w, addr) + } + d.w.Write(closeParenBytes) + } + + // Display dereferenced value. + d.w.Write(openParenBytes) + switch { + case nilFound: + d.w.Write(nilAngleBytes) + + case cycleFound: + d.w.Write(circularBytes) + + default: + d.ignoreNextType = true + d.dump(ve) + } + d.w.Write(closeParenBytes) +} + +// dumpSlice handles formatting of arrays and slices. Byte (uint8 under +// reflection) arrays and slices are dumped in hexdump -C fashion. +func (d *dumpState) dumpSlice(v reflect.Value) { + // Determine whether this type should be hex dumped or not. Also, + // for types which should be hexdumped, try to use the underlying data + // first, then fall back to trying to convert them to a uint8 slice. + var buf []uint8 + doConvert := false + doHexDump := false + numEntries := v.Len() + if numEntries > 0 { + vt := v.Index(0).Type() + vts := vt.String() + switch { + // C types that need to be converted. + case cCharRE.MatchString(vts): + fallthrough + case cUnsignedCharRE.MatchString(vts): + fallthrough + case cUint8tCharRE.MatchString(vts): + doConvert = true + + // Try to use existing uint8 slices and fall back to converting + // and copying if that fails. + case vt.Kind() == reflect.Uint8: + // We need an addressable interface to convert the type + // to a byte slice. However, the reflect package won't + // give us an interface on certain things like + // unexported struct fields in order to enforce + // visibility rules. We use unsafe, when available, to + // bypass these restrictions since this package does not + // mutate the values. + vs := v + if !vs.CanInterface() || !vs.CanAddr() { + vs = unsafeReflectValue(vs) + } + if !UnsafeDisabled { + vs = vs.Slice(0, numEntries) + + // Use the existing uint8 slice if it can be + // type asserted. + iface := vs.Interface() + if slice, ok := iface.([]uint8); ok { + buf = slice + doHexDump = true + break + } + } + + // The underlying data needs to be converted if it can't + // be type asserted to a uint8 slice. + doConvert = true + } + + // Copy and convert the underlying type if needed. + if doConvert && vt.ConvertibleTo(uint8Type) { + // Convert and copy each element into a uint8 byte + // slice. + buf = make([]uint8, numEntries) + for i := 0; i < numEntries; i++ { + vv := v.Index(i) + buf[i] = uint8(vv.Convert(uint8Type).Uint()) + } + doHexDump = true + } + } + + // Hexdump the entire slice as needed. + if doHexDump { + indent := strings.Repeat(d.cs.Indent, d.depth) + str := indent + hex.Dump(buf) + str = strings.Replace(str, "\n", "\n"+indent, -1) + str = strings.TrimRight(str, d.cs.Indent) + d.w.Write([]byte(str)) + return + } + + // Recursively call dump for each item. + for i := 0; i < numEntries; i++ { + d.dump(d.unpackValue(v.Index(i))) + if i < (numEntries - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } +} + +// dump is the main workhorse for dumping a value. It uses the passed reflect +// value to figure out what kind of object we are dealing with and formats it +// appropriately. It is a recursive function, however circular data structures +// are detected and handled properly. +func (d *dumpState) dump(v reflect.Value) { + // Handle invalid reflect values immediately. + kind := v.Kind() + if kind == reflect.Invalid { + d.w.Write(invalidAngleBytes) + return + } + + // Handle pointers specially. + if kind == reflect.Ptr { + d.indent() + d.dumpPtr(v) + return + } + + // Print type information unless already handled elsewhere. + if !d.ignoreNextType { + d.indent() + d.w.Write(openParenBytes) + d.w.Write([]byte(v.Type().String())) + d.w.Write(closeParenBytes) + d.w.Write(spaceBytes) + } + d.ignoreNextType = false + + // Display length and capacity if the built-in len and cap functions + // work with the value's kind and the len/cap itself is non-zero. + valueLen, valueCap := 0, 0 + switch v.Kind() { + case reflect.Array, reflect.Slice, reflect.Chan: + valueLen, valueCap = v.Len(), v.Cap() + case reflect.Map, reflect.String: + valueLen = v.Len() + } + if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { + d.w.Write(openParenBytes) + if valueLen != 0 { + d.w.Write(lenEqualsBytes) + printInt(d.w, int64(valueLen), 10) + } + if !d.cs.DisableCapacities && valueCap != 0 { + if valueLen != 0 { + d.w.Write(spaceBytes) + } + d.w.Write(capEqualsBytes) + printInt(d.w, int64(valueCap), 10) + } + d.w.Write(closeParenBytes) + d.w.Write(spaceBytes) + } + + // Call Stringer/error interfaces if they exist and the handle methods flag + // is enabled + if !d.cs.DisableMethods { + if (kind != reflect.Invalid) && (kind != reflect.Interface) { + if handled := handleMethods(d.cs, d.w, v); handled { + return + } + } + } + + switch kind { + case reflect.Invalid: + // Do nothing. We should never get here since invalid has already + // been handled above. + + case reflect.Bool: + printBool(d.w, v.Bool()) + + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + printInt(d.w, v.Int(), 10) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + printUint(d.w, v.Uint(), 10) + + case reflect.Float32: + printFloat(d.w, v.Float(), 32) + + case reflect.Float64: + printFloat(d.w, v.Float(), 64) + + case reflect.Complex64: + printComplex(d.w, v.Complex(), 32) + + case reflect.Complex128: + printComplex(d.w, v.Complex(), 64) + + case reflect.Slice: + if v.IsNil() { + d.w.Write(nilAngleBytes) + break + } + fallthrough + + case reflect.Array: + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + d.dumpSlice(v) + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.String: + d.w.Write([]byte(strconv.Quote(v.String()))) + + case reflect.Interface: + // The only time we should get here is for nil interfaces due to + // unpackValue calls. + if v.IsNil() { + d.w.Write(nilAngleBytes) + } + + case reflect.Ptr: + // Do nothing. We should never get here since pointers have already + // been handled above. + + case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + d.w.Write(nilAngleBytes) + break + } + + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + numEntries := v.Len() + keys := v.MapKeys() + if d.cs.SortKeys { + sortValues(keys, d.cs) + } + for i, key := range keys { + d.dump(d.unpackValue(key)) + d.w.Write(colonSpaceBytes) + d.ignoreNextIndent = true + d.dump(d.unpackValue(v.MapIndex(key))) + if i < (numEntries - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.Struct: + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + vt := v.Type() + numFields := v.NumField() + for i := 0; i < numFields; i++ { + d.indent() + vtf := vt.Field(i) + d.w.Write([]byte(vtf.Name)) + d.w.Write(colonSpaceBytes) + d.ignoreNextIndent = true + d.dump(d.unpackValue(v.Field(i))) + if i < (numFields - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.Uintptr: + printHexPtr(d.w, uintptr(v.Uint())) + + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + printHexPtr(d.w, v.Pointer()) + + // There were not any other types at the time this code was written, but + // fall back to letting the default fmt package handle it in case any new + // types are added. + default: + if v.CanInterface() { + fmt.Fprintf(d.w, "%v", v.Interface()) + } else { + fmt.Fprintf(d.w, "%v", v.String()) + } + } +} + +// fdump is a helper function to consolidate the logic from the various public +// methods which take varying writers and config states. +func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { + for _, arg := range a { + if arg == nil { + w.Write(interfaceBytes) + w.Write(spaceBytes) + w.Write(nilAngleBytes) + w.Write(newlineBytes) + continue + } + + d := dumpState{w: w, cs: cs} + d.pointers = make(map[uintptr]int) + d.dump(reflect.ValueOf(arg)) + d.w.Write(newlineBytes) + } +} + +// Fdump formats and displays the passed arguments to io.Writer w. It formats +// exactly the same as Dump. +func Fdump(w io.Writer, a ...interface{}) { + fdump(&Config, w, a...) +} + +// Sdump returns a string with the passed arguments formatted exactly the same +// as Dump. +func Sdump(a ...interface{}) string { + var buf bytes.Buffer + fdump(&Config, &buf, a...) + return buf.String() +} + +/* +Dump displays the passed parameters to standard out with newlines, customizable +indentation, and additional debug information such as complete types and all +pointer addresses used to indirect to the final value. It provides the +following features over the built-in printing facilities provided by the fmt +package: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output + +The configuration options are controlled by an exported package global, +spew.Config. See ConfigState for options documentation. + +See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to +get the formatted result as a string. +*/ +func Dump(a ...interface{}) { + fdump(&Config, os.Stdout, a...) +} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go new file mode 100644 index 0000000..b04edb7 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/format.go @@ -0,0 +1,419 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "reflect" + "strconv" + "strings" +) + +// supportedFlags is a list of all the character flags supported by fmt package. +const supportedFlags = "0-+# " + +// formatState implements the fmt.Formatter interface and contains information +// about the state of a formatting operation. The NewFormatter function can +// be used to get a new Formatter which can be used directly as arguments +// in standard fmt package printing calls. +type formatState struct { + value interface{} + fs fmt.State + depth int + pointers map[uintptr]int + ignoreNextType bool + cs *ConfigState +} + +// buildDefaultFormat recreates the original format string without precision +// and width information to pass in to fmt.Sprintf in the case of an +// unrecognized type. Unless new types are added to the language, this +// function won't ever be called. +func (f *formatState) buildDefaultFormat() (format string) { + buf := bytes.NewBuffer(percentBytes) + + for _, flag := range supportedFlags { + if f.fs.Flag(int(flag)) { + buf.WriteRune(flag) + } + } + + buf.WriteRune('v') + + format = buf.String() + return format +} + +// constructOrigFormat recreates the original format string including precision +// and width information to pass along to the standard fmt package. This allows +// automatic deferral of all format strings this package doesn't support. +func (f *formatState) constructOrigFormat(verb rune) (format string) { + buf := bytes.NewBuffer(percentBytes) + + for _, flag := range supportedFlags { + if f.fs.Flag(int(flag)) { + buf.WriteRune(flag) + } + } + + if width, ok := f.fs.Width(); ok { + buf.WriteString(strconv.Itoa(width)) + } + + if precision, ok := f.fs.Precision(); ok { + buf.Write(precisionBytes) + buf.WriteString(strconv.Itoa(precision)) + } + + buf.WriteRune(verb) + + format = buf.String() + return format +} + +// unpackValue returns values inside of non-nil interfaces when possible and +// ensures that types for values which have been unpacked from an interface +// are displayed when the show types flag is also set. +// This is useful for data types like structs, arrays, slices, and maps which +// can contain varying types packed inside an interface. +func (f *formatState) unpackValue(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Interface { + f.ignoreNextType = false + if !v.IsNil() { + v = v.Elem() + } + } + return v +} + +// formatPtr handles formatting of pointers by indirecting them as necessary. +func (f *formatState) formatPtr(v reflect.Value) { + // Display nil if top level pointer is nil. + showTypes := f.fs.Flag('#') + if v.IsNil() && (!showTypes || f.ignoreNextType) { + f.fs.Write(nilAngleBytes) + return + } + + // Remove pointers at or below the current depth from map used to detect + // circular refs. + for k, depth := range f.pointers { + if depth >= f.depth { + delete(f.pointers, k) + } + } + + // Keep list of all dereferenced pointers to possibly show later. + pointerChain := make([]uintptr, 0) + + // Figure out how many levels of indirection there are by derferencing + // pointers and unpacking interfaces down the chain while detecting circular + // references. + nilFound := false + cycleFound := false + indirects := 0 + ve := v + for ve.Kind() == reflect.Ptr { + if ve.IsNil() { + nilFound = true + break + } + indirects++ + addr := ve.Pointer() + pointerChain = append(pointerChain, addr) + if pd, ok := f.pointers[addr]; ok && pd < f.depth { + cycleFound = true + indirects-- + break + } + f.pointers[addr] = f.depth + + ve = ve.Elem() + if ve.Kind() == reflect.Interface { + if ve.IsNil() { + nilFound = true + break + } + ve = ve.Elem() + } + } + + // Display type or indirection level depending on flags. + if showTypes && !f.ignoreNextType { + f.fs.Write(openParenBytes) + f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) + f.fs.Write([]byte(ve.Type().String())) + f.fs.Write(closeParenBytes) + } else { + if nilFound || cycleFound { + indirects += strings.Count(ve.Type().String(), "*") + } + f.fs.Write(openAngleBytes) + f.fs.Write([]byte(strings.Repeat("*", indirects))) + f.fs.Write(closeAngleBytes) + } + + // Display pointer information depending on flags. + if f.fs.Flag('+') && (len(pointerChain) > 0) { + f.fs.Write(openParenBytes) + for i, addr := range pointerChain { + if i > 0 { + f.fs.Write(pointerChainBytes) + } + printHexPtr(f.fs, addr) + } + f.fs.Write(closeParenBytes) + } + + // Display dereferenced value. + switch { + case nilFound: + f.fs.Write(nilAngleBytes) + + case cycleFound: + f.fs.Write(circularShortBytes) + + default: + f.ignoreNextType = true + f.format(ve) + } +} + +// format is the main workhorse for providing the Formatter interface. It +// uses the passed reflect value to figure out what kind of object we are +// dealing with and formats it appropriately. It is a recursive function, +// however circular data structures are detected and handled properly. +func (f *formatState) format(v reflect.Value) { + // Handle invalid reflect values immediately. + kind := v.Kind() + if kind == reflect.Invalid { + f.fs.Write(invalidAngleBytes) + return + } + + // Handle pointers specially. + if kind == reflect.Ptr { + f.formatPtr(v) + return + } + + // Print type information unless already handled elsewhere. + if !f.ignoreNextType && f.fs.Flag('#') { + f.fs.Write(openParenBytes) + f.fs.Write([]byte(v.Type().String())) + f.fs.Write(closeParenBytes) + } + f.ignoreNextType = false + + // Call Stringer/error interfaces if they exist and the handle methods + // flag is enabled. + if !f.cs.DisableMethods { + if (kind != reflect.Invalid) && (kind != reflect.Interface) { + if handled := handleMethods(f.cs, f.fs, v); handled { + return + } + } + } + + switch kind { + case reflect.Invalid: + // Do nothing. We should never get here since invalid has already + // been handled above. + + case reflect.Bool: + printBool(f.fs, v.Bool()) + + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + printInt(f.fs, v.Int(), 10) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + printUint(f.fs, v.Uint(), 10) + + case reflect.Float32: + printFloat(f.fs, v.Float(), 32) + + case reflect.Float64: + printFloat(f.fs, v.Float(), 64) + + case reflect.Complex64: + printComplex(f.fs, v.Complex(), 32) + + case reflect.Complex128: + printComplex(f.fs, v.Complex(), 64) + + case reflect.Slice: + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + fallthrough + + case reflect.Array: + f.fs.Write(openBracketBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + numEntries := v.Len() + for i := 0; i < numEntries; i++ { + if i > 0 { + f.fs.Write(spaceBytes) + } + f.ignoreNextType = true + f.format(f.unpackValue(v.Index(i))) + } + } + f.depth-- + f.fs.Write(closeBracketBytes) + + case reflect.String: + f.fs.Write([]byte(v.String())) + + case reflect.Interface: + // The only time we should get here is for nil interfaces due to + // unpackValue calls. + if v.IsNil() { + f.fs.Write(nilAngleBytes) + } + + case reflect.Ptr: + // Do nothing. We should never get here since pointers have already + // been handled above. + + case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + + f.fs.Write(openMapBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + keys := v.MapKeys() + if f.cs.SortKeys { + sortValues(keys, f.cs) + } + for i, key := range keys { + if i > 0 { + f.fs.Write(spaceBytes) + } + f.ignoreNextType = true + f.format(f.unpackValue(key)) + f.fs.Write(colonBytes) + f.ignoreNextType = true + f.format(f.unpackValue(v.MapIndex(key))) + } + } + f.depth-- + f.fs.Write(closeMapBytes) + + case reflect.Struct: + numFields := v.NumField() + f.fs.Write(openBraceBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + vt := v.Type() + for i := 0; i < numFields; i++ { + if i > 0 { + f.fs.Write(spaceBytes) + } + vtf := vt.Field(i) + if f.fs.Flag('+') || f.fs.Flag('#') { + f.fs.Write([]byte(vtf.Name)) + f.fs.Write(colonBytes) + } + f.format(f.unpackValue(v.Field(i))) + } + } + f.depth-- + f.fs.Write(closeBraceBytes) + + case reflect.Uintptr: + printHexPtr(f.fs, uintptr(v.Uint())) + + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + printHexPtr(f.fs, v.Pointer()) + + // There were not any other types at the time this code was written, but + // fall back to letting the default fmt package handle it if any get added. + default: + format := f.buildDefaultFormat() + if v.CanInterface() { + fmt.Fprintf(f.fs, format, v.Interface()) + } else { + fmt.Fprintf(f.fs, format, v.String()) + } + } +} + +// Format satisfies the fmt.Formatter interface. See NewFormatter for usage +// details. +func (f *formatState) Format(fs fmt.State, verb rune) { + f.fs = fs + + // Use standard formatting for verbs that are not v. + if verb != 'v' { + format := f.constructOrigFormat(verb) + fmt.Fprintf(fs, format, f.value) + return + } + + if f.value == nil { + if fs.Flag('#') { + fs.Write(interfaceBytes) + } + fs.Write(nilAngleBytes) + return + } + + f.format(reflect.ValueOf(f.value)) +} + +// newFormatter is a helper function to consolidate the logic from the various +// public methods which take varying config states. +func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { + fs := &formatState{value: v, cs: cs} + fs.pointers = make(map[uintptr]int) + return fs +} + +/* +NewFormatter returns a custom formatter that satisfies the fmt.Formatter +interface. As a result, it integrates cleanly with standard fmt package +printing functions. The formatter is useful for inline printing of smaller data +types similar to the standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Typically this function shouldn't be called directly. It is much easier to make +use of the custom formatter by calling one of the convenience functions such as +Printf, Println, or Fprintf. +*/ +func NewFormatter(v interface{}) fmt.Formatter { + return newFormatter(&Config, v) +} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go new file mode 100644 index 0000000..32c0e33 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/spew.go @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "fmt" + "io" +) + +// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the formatted string as a value that satisfies error. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Errorf(format string, a ...interface{}) (err error) { + return fmt.Errorf(format, convertArgs(a)...) +} + +// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprint(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprint(w, convertArgs(a)...) +} + +// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { + return fmt.Fprintf(w, format, convertArgs(a)...) +} + +// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it +// passed with a default Formatter interface returned by NewFormatter. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprintln(w, convertArgs(a)...) +} + +// Print is a wrapper for fmt.Print that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) +func Print(a ...interface{}) (n int, err error) { + return fmt.Print(convertArgs(a)...) +} + +// Printf is a wrapper for fmt.Printf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Printf(format string, a ...interface{}) (n int, err error) { + return fmt.Printf(format, convertArgs(a)...) +} + +// Println is a wrapper for fmt.Println that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) +func Println(a ...interface{}) (n int, err error) { + return fmt.Println(convertArgs(a)...) +} + +// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprint(a ...interface{}) string { + return fmt.Sprint(convertArgs(a)...) +} + +// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprintf(format string, a ...interface{}) string { + return fmt.Sprintf(format, convertArgs(a)...) +} + +// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it +// were passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprintln(a ...interface{}) string { + return fmt.Sprintln(convertArgs(a)...) +} + +// convertArgs accepts a slice of arguments and returns a slice of the same +// length with each argument converted to a default spew Formatter interface. +func convertArgs(args []interface{}) (formatters []interface{}) { + formatters = make([]interface{}, len(args)) + for index, arg := range args { + formatters[index] = NewFormatter(arg) + } + return formatters +} diff --git a/vendor/github.com/pkg/errors/.gitignore b/vendor/github.com/pkg/errors/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/vendor/github.com/pkg/errors/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_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 diff --git a/vendor/github.com/pkg/errors/.travis.yml b/vendor/github.com/pkg/errors/.travis.yml new file mode 100644 index 0000000..9159de0 --- /dev/null +++ b/vendor/github.com/pkg/errors/.travis.yml @@ -0,0 +1,10 @@ +language: go +go_import_path: github.com/pkg/errors +go: + - 1.11.x + - 1.12.x + - 1.13.x + - tip + +script: + - make check diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE new file mode 100644 index 0000000..835ba3e --- /dev/null +++ b/vendor/github.com/pkg/errors/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Dave Cheney +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. + +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 HOLDER 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/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md new file mode 100644 index 0000000..54dfdcb1 --- /dev/null +++ b/vendor/github.com/pkg/errors/README.md @@ -0,0 +1,59 @@ +# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) [![Sourcegraph](https://sourcegraph.com/github.com/pkg/errors/-/badge.svg)](https://sourcegraph.com/github.com/pkg/errors?badge) + +Package errors provides simple error handling primitives. + +`go get github.com/pkg/errors` + +The traditional error handling idiom in Go is roughly akin to +```go +if err != nil { + return err +} +``` +which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. + +## Adding context to an error + +The errors.Wrap function returns a new error that adds context to the original error. For example +```go +_, err := ioutil.ReadAll(r) +if err != nil { + return errors.Wrap(err, "read failed") +} +``` +## Retrieving the cause of an error + +Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. +```go +type causer interface { + Cause() error +} +``` +`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: +```go +switch err := errors.Cause(err).(type) { +case *MyError: + // handle specifically +default: + // unknown error +} +``` + +[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). + +## Roadmap + +With the upcoming [Go2 error proposals](https://go.googlesource.com/proposal/+/master/design/go2draft.md) this package is moving into maintenance mode. The roadmap for a 1.0 release is as follows: + +- 0.9. Remove pre Go 1.9 and Go 1.10 support, address outstanding pull requests (if possible) +- 1.0. Final release. + +## Contributing + +Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. + +Before sending a PR, please discuss your change by raising an issue. + +## License + +BSD-2-Clause diff --git a/vendor/github.com/pkg/errors/appveyor.yml b/vendor/github.com/pkg/errors/appveyor.yml new file mode 100644 index 0000000..a932ead --- /dev/null +++ b/vendor/github.com/pkg/errors/appveyor.yml @@ -0,0 +1,32 @@ +version: build-{build}.{branch} + +clone_folder: C:\gopath\src\github.com\pkg\errors +shallow_clone: true # for startup speed + +environment: + GOPATH: C:\gopath + +platform: + - x64 + +# http://www.appveyor.com/docs/installed-software +install: + # some helpful output for debugging builds + - go version + - go env + # pre-installed MinGW at C:\MinGW is 32bit only + # but MSYS2 at C:\msys64 has mingw64 + - set PATH=C:\msys64\mingw64\bin;%PATH% + - gcc --version + - g++ --version + +build_script: + - go install -v ./... + +test_script: + - set PATH=C:\gopath\bin;%PATH% + - go test -v ./... + +#artifacts: +# - path: '%GOPATH%\bin\*.exe' +deploy: off diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go new file mode 100644 index 0000000..161aea2 --- /dev/null +++ b/vendor/github.com/pkg/errors/errors.go @@ -0,0 +1,288 @@ +// Package errors provides simple error handling primitives. +// +// The traditional error handling idiom in Go is roughly akin to +// +// if err != nil { +// return err +// } +// +// which when applied recursively up the call stack results in error reports +// without context or debugging information. The errors package allows +// programmers to add context to the failure path in their code in a way +// that does not destroy the original value of the error. +// +// Adding context to an error +// +// The errors.Wrap function returns a new error that adds context to the +// original error by recording a stack trace at the point Wrap is called, +// together with the supplied message. For example +// +// _, err := ioutil.ReadAll(r) +// if err != nil { +// return errors.Wrap(err, "read failed") +// } +// +// If additional control is required, the errors.WithStack and +// errors.WithMessage functions destructure errors.Wrap into its component +// operations: annotating an error with a stack trace and with a message, +// respectively. +// +// Retrieving the cause of an error +// +// Using errors.Wrap constructs a stack of errors, adding context to the +// preceding error. Depending on the nature of the error it may be necessary +// to reverse the operation of errors.Wrap to retrieve the original error +// for inspection. Any error value which implements this interface +// +// type causer interface { +// Cause() error +// } +// +// can be inspected by errors.Cause. errors.Cause will recursively retrieve +// the topmost error that does not implement causer, which is assumed to be +// the original cause. For example: +// +// switch err := errors.Cause(err).(type) { +// case *MyError: +// // handle specifically +// default: +// // unknown error +// } +// +// Although the causer interface is not exported by this package, it is +// considered a part of its stable public interface. +// +// Formatted printing of errors +// +// All error values returned from this package implement fmt.Formatter and can +// be formatted by the fmt package. The following verbs are supported: +// +// %s print the error. If the error has a Cause it will be +// printed recursively. +// %v see %s +// %+v extended format. Each Frame of the error's StackTrace will +// be printed in detail. +// +// Retrieving the stack trace of an error or wrapper +// +// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are +// invoked. This information can be retrieved with the following interface: +// +// type stackTracer interface { +// StackTrace() errors.StackTrace +// } +// +// The returned errors.StackTrace type is defined as +// +// type StackTrace []Frame +// +// The Frame type represents a call site in the stack trace. Frame supports +// the fmt.Formatter interface that can be used for printing information about +// the stack trace of this error. For example: +// +// if err, ok := err.(stackTracer); ok { +// for _, f := range err.StackTrace() { +// fmt.Printf("%+s:%d\n", f, f) +// } +// } +// +// Although the stackTracer interface is not exported by this package, it is +// considered a part of its stable public interface. +// +// See the documentation for Frame.Format for more details. +package errors + +import ( + "fmt" + "io" +) + +// New returns an error with the supplied message. +// New also records the stack trace at the point it was called. +func New(message string) error { + return &fundamental{ + msg: message, + stack: callers(), + } +} + +// Errorf formats according to a format specifier and returns the string +// as a value that satisfies error. +// Errorf also records the stack trace at the point it was called. +func Errorf(format string, args ...interface{}) error { + return &fundamental{ + msg: fmt.Sprintf(format, args...), + stack: callers(), + } +} + +// fundamental is an error that has a message and a stack, but no caller. +type fundamental struct { + msg string + *stack +} + +func (f *fundamental) Error() string { return f.msg } + +func (f *fundamental) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + io.WriteString(s, f.msg) + f.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, f.msg) + case 'q': + fmt.Fprintf(s, "%q", f.msg) + } +} + +// WithStack annotates err with a stack trace at the point WithStack was called. +// If err is nil, WithStack returns nil. +func WithStack(err error) error { + if err == nil { + return nil + } + return &withStack{ + err, + callers(), + } +} + +type withStack struct { + error + *stack +} + +func (w *withStack) Cause() error { return w.error } + +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withStack) Unwrap() error { return w.error } + +func (w *withStack) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v", w.Cause()) + w.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, w.Error()) + case 'q': + fmt.Fprintf(s, "%q", w.Error()) + } +} + +// Wrap returns an error annotating err with a stack trace +// at the point Wrap is called, and the supplied message. +// If err is nil, Wrap returns nil. +func Wrap(err error, message string) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: message, + } + return &withStack{ + err, + callers(), + } +} + +// Wrapf returns an error annotating err with a stack trace +// at the point Wrapf is called, and the format specifier. +// If err is nil, Wrapf returns nil. +func Wrapf(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } + return &withStack{ + err, + callers(), + } +} + +// WithMessage annotates err with a new message. +// If err is nil, WithMessage returns nil. +func WithMessage(err error, message string) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: message, + } +} + +// WithMessagef annotates err with the format specifier. +// If err is nil, WithMessagef returns nil. +func WithMessagef(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } +} + +type withMessage struct { + cause error + msg string +} + +func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } +func (w *withMessage) Cause() error { return w.cause } + +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withMessage) Unwrap() error { return w.cause } + +func (w *withMessage) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v\n", w.Cause()) + io.WriteString(s, w.msg) + return + } + fallthrough + case 's', 'q': + io.WriteString(s, w.Error()) + } +} + +// Cause returns the underlying cause of the error, if possible. +// An error value has a cause if it implements the following +// interface: +// +// type causer interface { +// Cause() error +// } +// +// If the error does not implement Cause, the original error will +// be returned. If the error is nil, nil will be returned without further +// investigation. +func Cause(err error) error { + type causer interface { + Cause() error + } + + for err != nil { + cause, ok := err.(causer) + if !ok { + break + } + err = cause.Cause() + } + return err +} diff --git a/vendor/github.com/pkg/errors/go113.go b/vendor/github.com/pkg/errors/go113.go new file mode 100644 index 0000000..be0d10d --- /dev/null +++ b/vendor/github.com/pkg/errors/go113.go @@ -0,0 +1,38 @@ +// +build go1.13 + +package errors + +import ( + stderrors "errors" +) + +// Is reports whether any error in err's chain matches target. +// +// The chain consists of err itself followed by the sequence of errors obtained by +// repeatedly calling Unwrap. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { return stderrors.Is(err, target) } + +// As finds the first error in err's chain that matches target, and if so, sets +// target to that error value and returns true. +// +// The chain consists of err itself followed by the sequence of errors obtained by +// repeatedly calling Unwrap. +// +// An error matches target if the error's concrete value is assignable to the value +// pointed to by target, or if the error has a method As(interface{}) bool such that +// As(target) returns true. In the latter case, the As method is responsible for +// setting target. +// +// As will panic if target is not a non-nil pointer to either a type that implements +// error, or to any interface type. As returns false if err is nil. +func As(err error, target interface{}) bool { return stderrors.As(err, target) } + +// Unwrap returns the result of calling the Unwrap method on err, if err's +// type contains an Unwrap method returning error. +// Otherwise, Unwrap returns nil. +func Unwrap(err error) error { + return stderrors.Unwrap(err) +} diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go new file mode 100644 index 0000000..779a834 --- /dev/null +++ b/vendor/github.com/pkg/errors/stack.go @@ -0,0 +1,177 @@ +package errors + +import ( + "fmt" + "io" + "path" + "runtime" + "strconv" + "strings" +) + +// Frame represents a program counter inside a stack frame. +// For historical reasons if Frame is interpreted as a uintptr +// its value represents the program counter + 1. +type Frame uintptr + +// pc returns the program counter for this frame; +// multiple frames may have the same PC value. +func (f Frame) pc() uintptr { return uintptr(f) - 1 } + +// file returns the full path to the file that contains the +// function for this Frame's pc. +func (f Frame) file() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + file, _ := fn.FileLine(f.pc()) + return file +} + +// line returns the line number of source code of the +// function for this Frame's pc. +func (f Frame) line() int { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return 0 + } + _, line := fn.FileLine(f.pc()) + return line +} + +// name returns the name of this function, if known. +func (f Frame) name() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + return fn.Name() +} + +// Format formats the frame according to the fmt.Formatter interface. +// +// %s source file +// %d source line +// %n function name +// %v equivalent to %s:%d +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+s function name and path of source file relative to the compile time +// GOPATH separated by \n\t (\n\t) +// %+v equivalent to %+s:%d +func (f Frame) Format(s fmt.State, verb rune) { + switch verb { + case 's': + switch { + case s.Flag('+'): + io.WriteString(s, f.name()) + io.WriteString(s, "\n\t") + io.WriteString(s, f.file()) + default: + io.WriteString(s, path.Base(f.file())) + } + case 'd': + io.WriteString(s, strconv.Itoa(f.line())) + case 'n': + io.WriteString(s, funcname(f.name())) + case 'v': + f.Format(s, 's') + io.WriteString(s, ":") + f.Format(s, 'd') + } +} + +// MarshalText formats a stacktrace Frame as a text string. The output is the +// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs. +func (f Frame) MarshalText() ([]byte, error) { + name := f.name() + if name == "unknown" { + return []byte(name), nil + } + return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil +} + +// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). +type StackTrace []Frame + +// Format formats the stack of Frames according to the fmt.Formatter interface. +// +// %s lists source files for each Frame in the stack +// %v lists the source file and line number for each Frame in the stack +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+v Prints filename, function, and line number for each Frame in the stack. +func (st StackTrace) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case s.Flag('+'): + for _, f := range st { + io.WriteString(s, "\n") + f.Format(s, verb) + } + case s.Flag('#'): + fmt.Fprintf(s, "%#v", []Frame(st)) + default: + st.formatSlice(s, verb) + } + case 's': + st.formatSlice(s, verb) + } +} + +// formatSlice will format this StackTrace into the given buffer as a slice of +// Frame, only valid when called with '%s' or '%v'. +func (st StackTrace) formatSlice(s fmt.State, verb rune) { + io.WriteString(s, "[") + for i, f := range st { + if i > 0 { + io.WriteString(s, " ") + } + f.Format(s, verb) + } + io.WriteString(s, "]") +} + +// stack represents a stack of program counters. +type stack []uintptr + +func (s *stack) Format(st fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case st.Flag('+'): + for _, pc := range *s { + f := Frame(pc) + fmt.Fprintf(st, "\n%+v", f) + } + } + } +} + +func (s *stack) StackTrace() StackTrace { + f := make([]Frame, len(*s)) + for i := 0; i < len(f); i++ { + f[i] = Frame((*s)[i]) + } + return f +} + +func callers() *stack { + const depth = 32 + var pcs [depth]uintptr + n := runtime.Callers(3, pcs[:]) + var st stack = pcs[0:n] + return &st +} + +// funcname removes the path prefix component of a function's name reported by func.Name(). +func funcname(name string) string { + i := strings.LastIndex(name, "/") + name = name[i+1:] + i = strings.Index(name, ".") + return name[i+1:] +} diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE new file mode 100644 index 0000000..c67dad6 --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2013, Patrick Mezard +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. + The names of its contributors may not 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 +HOLDER 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/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go new file mode 100644 index 0000000..003e99f --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go @@ -0,0 +1,772 @@ +// Package difflib is a partial port of Python difflib module. +// +// It provides tools to compare sequences of strings and generate textual diffs. +// +// The following class and functions have been ported: +// +// - SequenceMatcher +// +// - unified_diff +// +// - context_diff +// +// Getting unified diffs was the main goal of the port. Keep in mind this code +// is mostly suitable to output text differences in a human friendly way, there +// are no guarantees generated diffs are consumable by patch(1). +package difflib + +import ( + "bufio" + "bytes" + "fmt" + "io" + "strings" +) + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +func calculateRatio(matches, length int) float64 { + if length > 0 { + return 2.0 * float64(matches) / float64(length) + } + return 1.0 +} + +type Match struct { + A int + B int + Size int +} + +type OpCode struct { + Tag byte + I1 int + I2 int + J1 int + J2 int +} + +// SequenceMatcher compares sequence of strings. The basic +// algorithm predates, and is a little fancier than, an algorithm +// published in the late 1980's by Ratcliff and Obershelp under the +// hyperbolic name "gestalt pattern matching". The basic idea is to find +// the longest contiguous matching subsequence that contains no "junk" +// elements (R-O doesn't address junk). The same idea is then applied +// recursively to the pieces of the sequences to the left and to the right +// of the matching subsequence. This does not yield minimal edit +// sequences, but does tend to yield matches that "look right" to people. +// +// SequenceMatcher tries to compute a "human-friendly diff" between two +// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the +// longest *contiguous* & junk-free matching subsequence. That's what +// catches peoples' eyes. The Windows(tm) windiff has another interesting +// notion, pairing up elements that appear uniquely in each sequence. +// That, and the method here, appear to yield more intuitive difference +// reports than does diff. This method appears to be the least vulnerable +// to synching up on blocks of "junk lines", though (like blank lines in +// ordinary text files, or maybe "

" lines in HTML files). That may be +// because this is the only method of the 3 that has a *concept* of +// "junk" . +// +// Timing: Basic R-O is cubic time worst case and quadratic time expected +// case. SequenceMatcher is quadratic time for the worst case and has +// expected-case behavior dependent in a complicated way on how many +// elements the sequences have in common; best case time is linear. +type SequenceMatcher struct { + a []string + b []string + b2j map[string][]int + IsJunk func(string) bool + autoJunk bool + bJunk map[string]struct{} + matchingBlocks []Match + fullBCount map[string]int + bPopular map[string]struct{} + opCodes []OpCode +} + +func NewMatcher(a, b []string) *SequenceMatcher { + m := SequenceMatcher{autoJunk: true} + m.SetSeqs(a, b) + return &m +} + +func NewMatcherWithJunk(a, b []string, autoJunk bool, + isJunk func(string) bool) *SequenceMatcher { + + m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} + m.SetSeqs(a, b) + return &m +} + +// Set two sequences to be compared. +func (m *SequenceMatcher) SetSeqs(a, b []string) { + m.SetSeq1(a) + m.SetSeq2(b) +} + +// Set the first sequence to be compared. The second sequence to be compared is +// not changed. +// +// SequenceMatcher computes and caches detailed information about the second +// sequence, so if you want to compare one sequence S against many sequences, +// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other +// sequences. +// +// See also SetSeqs() and SetSeq2(). +func (m *SequenceMatcher) SetSeq1(a []string) { + if &a == &m.a { + return + } + m.a = a + m.matchingBlocks = nil + m.opCodes = nil +} + +// Set the second sequence to be compared. The first sequence to be compared is +// not changed. +func (m *SequenceMatcher) SetSeq2(b []string) { + if &b == &m.b { + return + } + m.b = b + m.matchingBlocks = nil + m.opCodes = nil + m.fullBCount = nil + m.chainB() +} + +func (m *SequenceMatcher) chainB() { + // Populate line -> index mapping + b2j := map[string][]int{} + for i, s := range m.b { + indices := b2j[s] + indices = append(indices, i) + b2j[s] = indices + } + + // Purge junk elements + m.bJunk = map[string]struct{}{} + if m.IsJunk != nil { + junk := m.bJunk + for s, _ := range b2j { + if m.IsJunk(s) { + junk[s] = struct{}{} + } + } + for s, _ := range junk { + delete(b2j, s) + } + } + + // Purge remaining popular elements + popular := map[string]struct{}{} + n := len(m.b) + if m.autoJunk && n >= 200 { + ntest := n/100 + 1 + for s, indices := range b2j { + if len(indices) > ntest { + popular[s] = struct{}{} + } + } + for s, _ := range popular { + delete(b2j, s) + } + } + m.bPopular = popular + m.b2j = b2j +} + +func (m *SequenceMatcher) isBJunk(s string) bool { + _, ok := m.bJunk[s] + return ok +} + +// Find longest matching block in a[alo:ahi] and b[blo:bhi]. +// +// If IsJunk is not defined: +// +// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where +// alo <= i <= i+k <= ahi +// blo <= j <= j+k <= bhi +// and for all (i',j',k') meeting those conditions, +// k >= k' +// i <= i' +// and if i == i', j <= j' +// +// In other words, of all maximal matching blocks, return one that +// starts earliest in a, and of all those maximal matching blocks that +// start earliest in a, return the one that starts earliest in b. +// +// If IsJunk is defined, first the longest matching block is +// determined as above, but with the additional restriction that no +// junk element appears in the block. Then that block is extended as +// far as possible by matching (only) junk elements on both sides. So +// the resulting block never matches on junk except as identical junk +// happens to be adjacent to an "interesting" match. +// +// If no blocks match, return (alo, blo, 0). +func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match { + // CAUTION: stripping common prefix or suffix would be incorrect. + // E.g., + // ab + // acab + // Longest matching block is "ab", but if common prefix is + // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so + // strip, so ends up claiming that ab is changed to acab by + // inserting "ca" in the middle. That's minimal but unintuitive: + // "it's obvious" that someone inserted "ac" at the front. + // Windiff ends up at the same place as diff, but by pairing up + // the unique 'b's and then matching the first two 'a's. + besti, bestj, bestsize := alo, blo, 0 + + // find longest junk-free match + // during an iteration of the loop, j2len[j] = length of longest + // junk-free match ending with a[i-1] and b[j] + j2len := map[int]int{} + for i := alo; i != ahi; i++ { + // look at all instances of a[i] in b; note that because + // b2j has no junk keys, the loop is skipped if a[i] is junk + newj2len := map[int]int{} + for _, j := range m.b2j[m.a[i]] { + // a[i] matches b[j] + if j < blo { + continue + } + if j >= bhi { + break + } + k := j2len[j-1] + 1 + newj2len[j] = k + if k > bestsize { + besti, bestj, bestsize = i-k+1, j-k+1, k + } + } + j2len = newj2len + } + + // Extend the best by non-junk elements on each end. In particular, + // "popular" non-junk elements aren't in b2j, which greatly speeds + // the inner loop above, but also means "the best" match so far + // doesn't contain any junk *or* popular non-junk elements. + for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) && + m.a[besti-1] == m.b[bestj-1] { + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + } + for besti+bestsize < ahi && bestj+bestsize < bhi && + !m.isBJunk(m.b[bestj+bestsize]) && + m.a[besti+bestsize] == m.b[bestj+bestsize] { + bestsize += 1 + } + + // Now that we have a wholly interesting match (albeit possibly + // empty!), we may as well suck up the matching junk on each + // side of it too. Can't think of a good reason not to, and it + // saves post-processing the (possibly considerable) expense of + // figuring out what to do with it. In the case of an empty + // interesting match, this is clearly the right thing to do, + // because no other kind of match is possible in the regions. + for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) && + m.a[besti-1] == m.b[bestj-1] { + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + } + for besti+bestsize < ahi && bestj+bestsize < bhi && + m.isBJunk(m.b[bestj+bestsize]) && + m.a[besti+bestsize] == m.b[bestj+bestsize] { + bestsize += 1 + } + + return Match{A: besti, B: bestj, Size: bestsize} +} + +// Return list of triples describing matching subsequences. +// +// Each triple is of the form (i, j, n), and means that +// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in +// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are +// adjacent triples in the list, and the second is not the last triple in the +// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe +// adjacent equal blocks. +// +// The last triple is a dummy, (len(a), len(b), 0), and is the only +// triple with n==0. +func (m *SequenceMatcher) GetMatchingBlocks() []Match { + if m.matchingBlocks != nil { + return m.matchingBlocks + } + + var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match + matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match { + match := m.findLongestMatch(alo, ahi, blo, bhi) + i, j, k := match.A, match.B, match.Size + if match.Size > 0 { + if alo < i && blo < j { + matched = matchBlocks(alo, i, blo, j, matched) + } + matched = append(matched, match) + if i+k < ahi && j+k < bhi { + matched = matchBlocks(i+k, ahi, j+k, bhi, matched) + } + } + return matched + } + matched := matchBlocks(0, len(m.a), 0, len(m.b), nil) + + // It's possible that we have adjacent equal blocks in the + // matching_blocks list now. + nonAdjacent := []Match{} + i1, j1, k1 := 0, 0, 0 + for _, b := range matched { + // Is this block adjacent to i1, j1, k1? + i2, j2, k2 := b.A, b.B, b.Size + if i1+k1 == i2 && j1+k1 == j2 { + // Yes, so collapse them -- this just increases the length of + // the first block by the length of the second, and the first + // block so lengthened remains the block to compare against. + k1 += k2 + } else { + // Not adjacent. Remember the first block (k1==0 means it's + // the dummy we started with), and make the second block the + // new block to compare against. + if k1 > 0 { + nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) + } + i1, j1, k1 = i2, j2, k2 + } + } + if k1 > 0 { + nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) + } + + nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0}) + m.matchingBlocks = nonAdjacent + return m.matchingBlocks +} + +// Return list of 5-tuples describing how to turn a into b. +// +// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple +// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the +// tuple preceding it, and likewise for j1 == the previous j2. +// +// The tags are characters, with these meanings: +// +// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2] +// +// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case. +// +// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case. +// +// 'e' (equal): a[i1:i2] == b[j1:j2] +func (m *SequenceMatcher) GetOpCodes() []OpCode { + if m.opCodes != nil { + return m.opCodes + } + i, j := 0, 0 + matching := m.GetMatchingBlocks() + opCodes := make([]OpCode, 0, len(matching)) + for _, m := range matching { + // invariant: we've pumped out correct diffs to change + // a[:i] into b[:j], and the next matching block is + // a[ai:ai+size] == b[bj:bj+size]. So we need to pump + // out a diff to change a[i:ai] into b[j:bj], pump out + // the matching block, and move (i,j) beyond the match + ai, bj, size := m.A, m.B, m.Size + tag := byte(0) + if i < ai && j < bj { + tag = 'r' + } else if i < ai { + tag = 'd' + } else if j < bj { + tag = 'i' + } + if tag > 0 { + opCodes = append(opCodes, OpCode{tag, i, ai, j, bj}) + } + i, j = ai+size, bj+size + // the list of matching blocks is terminated by a + // sentinel with size 0 + if size > 0 { + opCodes = append(opCodes, OpCode{'e', ai, i, bj, j}) + } + } + m.opCodes = opCodes + return m.opCodes +} + +// Isolate change clusters by eliminating ranges with no changes. +// +// Return a generator of groups with up to n lines of context. +// Each group is in the same format as returned by GetOpCodes(). +func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { + if n < 0 { + n = 3 + } + codes := m.GetOpCodes() + if len(codes) == 0 { + codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} + } + // Fixup leading and trailing groups if they show no changes. + if codes[0].Tag == 'e' { + c := codes[0] + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2} + } + if codes[len(codes)-1].Tag == 'e' { + c := codes[len(codes)-1] + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)} + } + nn := n + n + groups := [][]OpCode{} + group := []OpCode{} + for _, c := range codes { + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + // End the current group and start a new one whenever + // there is a large range with no changes. + if c.Tag == 'e' && i2-i1 > nn { + group = append(group, OpCode{c.Tag, i1, min(i2, i1+n), + j1, min(j2, j1+n)}) + groups = append(groups, group) + group = []OpCode{} + i1, j1 = max(i1, i2-n), max(j1, j2-n) + } + group = append(group, OpCode{c.Tag, i1, i2, j1, j2}) + } + if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') { + groups = append(groups, group) + } + return groups +} + +// Return a measure of the sequences' similarity (float in [0,1]). +// +// Where T is the total number of elements in both sequences, and +// M is the number of matches, this is 2.0*M / T. +// Note that this is 1 if the sequences are identical, and 0 if +// they have nothing in common. +// +// .Ratio() is expensive to compute if you haven't already computed +// .GetMatchingBlocks() or .GetOpCodes(), in which case you may +// want to try .QuickRatio() or .RealQuickRation() first to get an +// upper bound. +func (m *SequenceMatcher) Ratio() float64 { + matches := 0 + for _, m := range m.GetMatchingBlocks() { + matches += m.Size + } + return calculateRatio(matches, len(m.a)+len(m.b)) +} + +// Return an upper bound on ratio() relatively quickly. +// +// This isn't defined beyond that it is an upper bound on .Ratio(), and +// is faster to compute. +func (m *SequenceMatcher) QuickRatio() float64 { + // viewing a and b as multisets, set matches to the cardinality + // of their intersection; this counts the number of matches + // without regard to order, so is clearly an upper bound + if m.fullBCount == nil { + m.fullBCount = map[string]int{} + for _, s := range m.b { + m.fullBCount[s] = m.fullBCount[s] + 1 + } + } + + // avail[x] is the number of times x appears in 'b' less the + // number of times we've seen it in 'a' so far ... kinda + avail := map[string]int{} + matches := 0 + for _, s := range m.a { + n, ok := avail[s] + if !ok { + n = m.fullBCount[s] + } + avail[s] = n - 1 + if n > 0 { + matches += 1 + } + } + return calculateRatio(matches, len(m.a)+len(m.b)) +} + +// Return an upper bound on ratio() very quickly. +// +// This isn't defined beyond that it is an upper bound on .Ratio(), and +// is faster to compute than either .Ratio() or .QuickRatio(). +func (m *SequenceMatcher) RealQuickRatio() float64 { + la, lb := len(m.a), len(m.b) + return calculateRatio(min(la, lb), la+lb) +} + +// Convert range to the "ed" format +func formatRangeUnified(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 1 { + return fmt.Sprintf("%d", beginning) + } + if length == 0 { + beginning -= 1 // empty ranges begin at line just before the range + } + return fmt.Sprintf("%d,%d", beginning, length) +} + +// Unified diff parameters +type UnifiedDiff struct { + A []string // First sequence lines + FromFile string // First file name + FromDate string // First file time + B []string // Second sequence lines + ToFile string // Second file name + ToDate string // Second file time + Eol string // Headers end of line, defaults to LF + Context int // Number of context lines +} + +// Compare two sequences of lines; generate the delta as a unified diff. +// +// Unified diffs are a compact way of showing line changes and a few +// lines of context. The number of context lines is set by 'n' which +// defaults to three. +// +// By default, the diff control lines (those with ---, +++, or @@) are +// created with a trailing newline. This is helpful so that inputs +// created from file.readlines() result in diffs that are suitable for +// file.writelines() since both the inputs and outputs have trailing +// newlines. +// +// For inputs that do not have trailing newlines, set the lineterm +// argument to "" so that the output will be uniformly newline free. +// +// The unidiff format normally has a header for filenames and modification +// times. Any or all of these may be specified using strings for +// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. +// The modification times are normally expressed in the ISO 8601 format. +func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { + buf := bufio.NewWriter(writer) + defer buf.Flush() + wf := func(format string, args ...interface{}) error { + _, err := buf.WriteString(fmt.Sprintf(format, args...)) + return err + } + ws := func(s string) error { + _, err := buf.WriteString(s) + return err + } + + if len(diff.Eol) == 0 { + diff.Eol = "\n" + } + + started := false + m := NewMatcher(diff.A, diff.B) + for _, g := range m.GetGroupedOpCodes(diff.Context) { + if !started { + started = true + fromDate := "" + if len(diff.FromDate) > 0 { + fromDate = "\t" + diff.FromDate + } + toDate := "" + if len(diff.ToDate) > 0 { + toDate = "\t" + diff.ToDate + } + if diff.FromFile != "" || diff.ToFile != "" { + err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) + if err != nil { + return err + } + err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) + if err != nil { + return err + } + } + } + first, last := g[0], g[len(g)-1] + range1 := formatRangeUnified(first.I1, last.I2) + range2 := formatRangeUnified(first.J1, last.J2) + if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { + return err + } + for _, c := range g { + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + if c.Tag == 'e' { + for _, line := range diff.A[i1:i2] { + if err := ws(" " + line); err != nil { + return err + } + } + continue + } + if c.Tag == 'r' || c.Tag == 'd' { + for _, line := range diff.A[i1:i2] { + if err := ws("-" + line); err != nil { + return err + } + } + } + if c.Tag == 'r' || c.Tag == 'i' { + for _, line := range diff.B[j1:j2] { + if err := ws("+" + line); err != nil { + return err + } + } + } + } + } + return nil +} + +// Like WriteUnifiedDiff but returns the diff a string. +func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { + w := &bytes.Buffer{} + err := WriteUnifiedDiff(w, diff) + return string(w.Bytes()), err +} + +// Convert range to the "ed" format. +func formatRangeContext(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 0 { + beginning -= 1 // empty ranges begin at line just before the range + } + if length <= 1 { + return fmt.Sprintf("%d", beginning) + } + return fmt.Sprintf("%d,%d", beginning, beginning+length-1) +} + +type ContextDiff UnifiedDiff + +// Compare two sequences of lines; generate the delta as a context diff. +// +// Context diffs are a compact way of showing line changes and a few +// lines of context. The number of context lines is set by diff.Context +// which defaults to three. +// +// By default, the diff control lines (those with *** or ---) are +// created with a trailing newline. +// +// For inputs that do not have trailing newlines, set the diff.Eol +// argument to "" so that the output will be uniformly newline free. +// +// The context diff format normally has a header for filenames and +// modification times. Any or all of these may be specified using +// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. +// The modification times are normally expressed in the ISO 8601 format. +// If not specified, the strings default to blanks. +func WriteContextDiff(writer io.Writer, diff ContextDiff) error { + buf := bufio.NewWriter(writer) + defer buf.Flush() + var diffErr error + wf := func(format string, args ...interface{}) { + _, err := buf.WriteString(fmt.Sprintf(format, args...)) + if diffErr == nil && err != nil { + diffErr = err + } + } + ws := func(s string) { + _, err := buf.WriteString(s) + if diffErr == nil && err != nil { + diffErr = err + } + } + + if len(diff.Eol) == 0 { + diff.Eol = "\n" + } + + prefix := map[byte]string{ + 'i': "+ ", + 'd': "- ", + 'r': "! ", + 'e': " ", + } + + started := false + m := NewMatcher(diff.A, diff.B) + for _, g := range m.GetGroupedOpCodes(diff.Context) { + if !started { + started = true + fromDate := "" + if len(diff.FromDate) > 0 { + fromDate = "\t" + diff.FromDate + } + toDate := "" + if len(diff.ToDate) > 0 { + toDate = "\t" + diff.ToDate + } + if diff.FromFile != "" || diff.ToFile != "" { + wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) + wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol) + } + } + + first, last := g[0], g[len(g)-1] + ws("***************" + diff.Eol) + + range1 := formatRangeContext(first.I1, last.I2) + wf("*** %s ****%s", range1, diff.Eol) + for _, c := range g { + if c.Tag == 'r' || c.Tag == 'd' { + for _, cc := range g { + if cc.Tag == 'i' { + continue + } + for _, line := range diff.A[cc.I1:cc.I2] { + ws(prefix[cc.Tag] + line) + } + } + break + } + } + + range2 := formatRangeContext(first.J1, last.J2) + wf("--- %s ----%s", range2, diff.Eol) + for _, c := range g { + if c.Tag == 'r' || c.Tag == 'i' { + for _, cc := range g { + if cc.Tag == 'd' { + continue + } + for _, line := range diff.B[cc.J1:cc.J2] { + ws(prefix[cc.Tag] + line) + } + } + break + } + } + } + return diffErr +} + +// Like WriteContextDiff but returns the diff a string. +func GetContextDiffString(diff ContextDiff) (string, error) { + w := &bytes.Buffer{} + err := WriteContextDiff(w, diff) + return string(w.Bytes()), err +} + +// Split a string on "\n" while preserving them. The output can be used +// as input for UnifiedDiff and ContextDiff structures. +func SplitLines(s string) []string { + lines := strings.SplitAfter(s, "\n") + lines[len(lines)-1] += "\n" + return lines +} diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE new file mode 100644 index 0000000..4b0421c --- /dev/null +++ b/vendor/github.com/stretchr/testify/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go new file mode 100644 index 0000000..95d8e59 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -0,0 +1,458 @@ +package assert + +import ( + "bytes" + "fmt" + "reflect" + "time" +) + +type CompareType int + +const ( + compareLess CompareType = iota - 1 + compareEqual + compareGreater +) + +var ( + intType = reflect.TypeOf(int(1)) + int8Type = reflect.TypeOf(int8(1)) + int16Type = reflect.TypeOf(int16(1)) + int32Type = reflect.TypeOf(int32(1)) + int64Type = reflect.TypeOf(int64(1)) + + uintType = reflect.TypeOf(uint(1)) + uint8Type = reflect.TypeOf(uint8(1)) + uint16Type = reflect.TypeOf(uint16(1)) + uint32Type = reflect.TypeOf(uint32(1)) + uint64Type = reflect.TypeOf(uint64(1)) + + float32Type = reflect.TypeOf(float32(1)) + float64Type = reflect.TypeOf(float64(1)) + + stringType = reflect.TypeOf("") + + timeType = reflect.TypeOf(time.Time{}) + bytesType = reflect.TypeOf([]byte{}) +) + +func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { + obj1Value := reflect.ValueOf(obj1) + obj2Value := reflect.ValueOf(obj2) + + // throughout this switch we try and avoid calling .Convert() if possible, + // as this has a pretty big performance impact + switch kind { + case reflect.Int: + { + intobj1, ok := obj1.(int) + if !ok { + intobj1 = obj1Value.Convert(intType).Interface().(int) + } + intobj2, ok := obj2.(int) + if !ok { + intobj2 = obj2Value.Convert(intType).Interface().(int) + } + if intobj1 > intobj2 { + return compareGreater, true + } + if intobj1 == intobj2 { + return compareEqual, true + } + if intobj1 < intobj2 { + return compareLess, true + } + } + case reflect.Int8: + { + int8obj1, ok := obj1.(int8) + if !ok { + int8obj1 = obj1Value.Convert(int8Type).Interface().(int8) + } + int8obj2, ok := obj2.(int8) + if !ok { + int8obj2 = obj2Value.Convert(int8Type).Interface().(int8) + } + if int8obj1 > int8obj2 { + return compareGreater, true + } + if int8obj1 == int8obj2 { + return compareEqual, true + } + if int8obj1 < int8obj2 { + return compareLess, true + } + } + case reflect.Int16: + { + int16obj1, ok := obj1.(int16) + if !ok { + int16obj1 = obj1Value.Convert(int16Type).Interface().(int16) + } + int16obj2, ok := obj2.(int16) + if !ok { + int16obj2 = obj2Value.Convert(int16Type).Interface().(int16) + } + if int16obj1 > int16obj2 { + return compareGreater, true + } + if int16obj1 == int16obj2 { + return compareEqual, true + } + if int16obj1 < int16obj2 { + return compareLess, true + } + } + case reflect.Int32: + { + int32obj1, ok := obj1.(int32) + if !ok { + int32obj1 = obj1Value.Convert(int32Type).Interface().(int32) + } + int32obj2, ok := obj2.(int32) + if !ok { + int32obj2 = obj2Value.Convert(int32Type).Interface().(int32) + } + if int32obj1 > int32obj2 { + return compareGreater, true + } + if int32obj1 == int32obj2 { + return compareEqual, true + } + if int32obj1 < int32obj2 { + return compareLess, true + } + } + case reflect.Int64: + { + int64obj1, ok := obj1.(int64) + if !ok { + int64obj1 = obj1Value.Convert(int64Type).Interface().(int64) + } + int64obj2, ok := obj2.(int64) + if !ok { + int64obj2 = obj2Value.Convert(int64Type).Interface().(int64) + } + if int64obj1 > int64obj2 { + return compareGreater, true + } + if int64obj1 == int64obj2 { + return compareEqual, true + } + if int64obj1 < int64obj2 { + return compareLess, true + } + } + case reflect.Uint: + { + uintobj1, ok := obj1.(uint) + if !ok { + uintobj1 = obj1Value.Convert(uintType).Interface().(uint) + } + uintobj2, ok := obj2.(uint) + if !ok { + uintobj2 = obj2Value.Convert(uintType).Interface().(uint) + } + if uintobj1 > uintobj2 { + return compareGreater, true + } + if uintobj1 == uintobj2 { + return compareEqual, true + } + if uintobj1 < uintobj2 { + return compareLess, true + } + } + case reflect.Uint8: + { + uint8obj1, ok := obj1.(uint8) + if !ok { + uint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8) + } + uint8obj2, ok := obj2.(uint8) + if !ok { + uint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8) + } + if uint8obj1 > uint8obj2 { + return compareGreater, true + } + if uint8obj1 == uint8obj2 { + return compareEqual, true + } + if uint8obj1 < uint8obj2 { + return compareLess, true + } + } + case reflect.Uint16: + { + uint16obj1, ok := obj1.(uint16) + if !ok { + uint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16) + } + uint16obj2, ok := obj2.(uint16) + if !ok { + uint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16) + } + if uint16obj1 > uint16obj2 { + return compareGreater, true + } + if uint16obj1 == uint16obj2 { + return compareEqual, true + } + if uint16obj1 < uint16obj2 { + return compareLess, true + } + } + case reflect.Uint32: + { + uint32obj1, ok := obj1.(uint32) + if !ok { + uint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32) + } + uint32obj2, ok := obj2.(uint32) + if !ok { + uint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32) + } + if uint32obj1 > uint32obj2 { + return compareGreater, true + } + if uint32obj1 == uint32obj2 { + return compareEqual, true + } + if uint32obj1 < uint32obj2 { + return compareLess, true + } + } + case reflect.Uint64: + { + uint64obj1, ok := obj1.(uint64) + if !ok { + uint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64) + } + uint64obj2, ok := obj2.(uint64) + if !ok { + uint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64) + } + if uint64obj1 > uint64obj2 { + return compareGreater, true + } + if uint64obj1 == uint64obj2 { + return compareEqual, true + } + if uint64obj1 < uint64obj2 { + return compareLess, true + } + } + case reflect.Float32: + { + float32obj1, ok := obj1.(float32) + if !ok { + float32obj1 = obj1Value.Convert(float32Type).Interface().(float32) + } + float32obj2, ok := obj2.(float32) + if !ok { + float32obj2 = obj2Value.Convert(float32Type).Interface().(float32) + } + if float32obj1 > float32obj2 { + return compareGreater, true + } + if float32obj1 == float32obj2 { + return compareEqual, true + } + if float32obj1 < float32obj2 { + return compareLess, true + } + } + case reflect.Float64: + { + float64obj1, ok := obj1.(float64) + if !ok { + float64obj1 = obj1Value.Convert(float64Type).Interface().(float64) + } + float64obj2, ok := obj2.(float64) + if !ok { + float64obj2 = obj2Value.Convert(float64Type).Interface().(float64) + } + if float64obj1 > float64obj2 { + return compareGreater, true + } + if float64obj1 == float64obj2 { + return compareEqual, true + } + if float64obj1 < float64obj2 { + return compareLess, true + } + } + case reflect.String: + { + stringobj1, ok := obj1.(string) + if !ok { + stringobj1 = obj1Value.Convert(stringType).Interface().(string) + } + stringobj2, ok := obj2.(string) + if !ok { + stringobj2 = obj2Value.Convert(stringType).Interface().(string) + } + if stringobj1 > stringobj2 { + return compareGreater, true + } + if stringobj1 == stringobj2 { + return compareEqual, true + } + if stringobj1 < stringobj2 { + return compareLess, true + } + } + // Check for known struct types we can check for compare results. + case reflect.Struct: + { + // All structs enter here. We're not interested in most types. + if !canConvert(obj1Value, timeType) { + break + } + + // time.Time can compared! + timeObj1, ok := obj1.(time.Time) + if !ok { + timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time) + } + + timeObj2, ok := obj2.(time.Time) + if !ok { + timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time) + } + + return compare(timeObj1.UnixNano(), timeObj2.UnixNano(), reflect.Int64) + } + case reflect.Slice: + { + // We only care about the []byte type. + if !canConvert(obj1Value, bytesType) { + break + } + + // []byte can be compared! + bytesObj1, ok := obj1.([]byte) + if !ok { + bytesObj1 = obj1Value.Convert(bytesType).Interface().([]byte) + + } + bytesObj2, ok := obj2.([]byte) + if !ok { + bytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte) + } + + return CompareType(bytes.Compare(bytesObj1, bytesObj2)), true + } + } + + return compareEqual, false +} + +// Greater asserts that the first element is greater than the second +// +// assert.Greater(t, 2, 1) +// assert.Greater(t, float64(2), float64(1)) +// assert.Greater(t, "b", "a") +func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqual(t, 2, 1) +// assert.GreaterOrEqual(t, 2, 2) +// assert.GreaterOrEqual(t, "b", "a") +// assert.GreaterOrEqual(t, "b", "b") +func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) +} + +// Less asserts that the first element is less than the second +// +// assert.Less(t, 1, 2) +// assert.Less(t, float64(1), float64(2)) +// assert.Less(t, "a", "b") +func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// assert.LessOrEqual(t, 1, 2) +// assert.LessOrEqual(t, 2, 2) +// assert.LessOrEqual(t, "a", "b") +// assert.LessOrEqual(t, "b", "b") +func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) +} + +// Positive asserts that the specified element is positive +// +// assert.Positive(t, 1) +// assert.Positive(t, 1.23) +func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + zero := reflect.Zero(reflect.TypeOf(e)) + return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs...) +} + +// Negative asserts that the specified element is negative +// +// assert.Negative(t, -1) +// assert.Negative(t, -1.23) +func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + zero := reflect.Zero(reflect.TypeOf(e)) + return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs...) +} + +func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + e1Kind := reflect.ValueOf(e1).Kind() + e2Kind := reflect.ValueOf(e2).Kind() + if e1Kind != e2Kind { + return Fail(t, "Elements should be the same type", msgAndArgs...) + } + + compareResult, isComparable := compare(e1, e2, e1Kind) + if !isComparable { + return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) + } + + if !containsValue(allowedComparesResults, compareResult) { + return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) + } + + return true +} + +func containsValue(values []CompareType, value CompareType) bool { + for _, v := range values { + if v == value { + return true + } + } + + return false +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go b/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go new file mode 100644 index 0000000..da86790 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go @@ -0,0 +1,16 @@ +//go:build go1.17 +// +build go1.17 + +// TODO: once support for Go 1.16 is dropped, this file can be +// merged/removed with assertion_compare_go1.17_test.go and +// assertion_compare_legacy.go + +package assert + +import "reflect" + +// Wrapper around reflect.Value.CanConvert, for compatibility +// reasons. +func canConvert(value reflect.Value, to reflect.Type) bool { + return value.CanConvert(to) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go b/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go new file mode 100644 index 0000000..1701af2 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go @@ -0,0 +1,16 @@ +//go:build !go1.17 +// +build !go1.17 + +// TODO: once support for Go 1.16 is dropped, this file can be +// merged/removed with assertion_compare_go1.17_test.go and +// assertion_compare_can_convert.go + +package assert + +import "reflect" + +// Older versions of Go does not have the reflect.Value.CanConvert +// method. +func canConvert(value reflect.Value, to reflect.Type) bool { + return false +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go new file mode 100644 index 0000000..7880b8f --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -0,0 +1,763 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND + */ + +package assert + +import ( + http "net/http" + url "net/url" + time "time" +) + +// Conditionf uses a Comparison to assert a complex condition. +func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Condition(t, comp, append([]interface{}{msg}, args...)...) +} + +// Containsf asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") +// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") +// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") +func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Contains(t, s, contains, append([]interface{}{msg}, args...)...) +} + +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return DirExists(t, path, append([]interface{}{msg}, args...)...) +} + +// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") +func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) +} + +// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Emptyf(t, obj, "error message %s", "formatted") +func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Empty(t, object, append([]interface{}{msg}, args...)...) +} + +// Equalf asserts that two objects are equal. +// +// assert.Equalf(t, 123, 123, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Equal(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// EqualErrorf asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") +func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...) +} + +// EqualValuesf asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") +func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// Errorf asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Errorf(t, err, "error message %s", "formatted") { +// assert.Equal(t, expectedErrorf, err) +// } +func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Error(t, err, append([]interface{}{msg}, args...)...) +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...) +} + +// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") +func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...) +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...) +} + +// Eventuallyf asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) +} + +// Exactlyf asserts that two objects are equal in value and type. +// +// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") +func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// Failf reports a failure through +func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, failureMessage, append([]interface{}{msg}, args...)...) +} + +// FailNowf fails test +func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...) +} + +// Falsef asserts that the specified value is false. +// +// assert.Falsef(t, myBool, "error message %s", "formatted") +func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return False(t, value, append([]interface{}{msg}, args...)...) +} + +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return FileExists(t, path, append([]interface{}{msg}, args...)...) +} + +// Greaterf asserts that the first element is greater than the second +// +// assert.Greaterf(t, 2, 1, "error message %s", "formatted") +// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") +// assert.Greaterf(t, "b", "a", "error message %s", "formatted") +func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Greater(t, e1, e2, append([]interface{}{msg}, args...)...) +} + +// GreaterOrEqualf asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") +// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") +// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") +// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") +func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) +} + +// HTTPBodyContainsf asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) +} + +// HTTPBodyNotContainsf asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) +} + +// HTTPErrorf asserts that a specified handler returns an error status code. +// +// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...) +} + +// HTTPRedirectf asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...) +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...) +} + +// HTTPSuccessf asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...) +} + +// Implementsf asserts that an object is implemented by the specified interface. +// +// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) +} + +// InDeltaf asserts that the two numerals are within delta of each other. +// +// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") +func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...) +} + +// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...) +} + +// InDeltaSlicef is the same as InDelta, except it compares two slices. +func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...) +} + +// InEpsilonf asserts that expected and actual have a relative error less than epsilon +func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) +} + +// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) +} + +// IsDecreasingf asserts that the collection is decreasing +// +// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsDecreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsIncreasingf asserts that the collection is increasing +// +// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsIncreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsTypef asserts that the specified objects are of the same type. +func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...) +} + +// JSONEqf asserts that two JSON strings are equivalent. +// +// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// Lenf asserts that the specified object has specific length. +// Lenf also fails if the object has a type that len() not accept. +// +// assert.Lenf(t, mySlice, 3, "error message %s", "formatted") +func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Len(t, object, length, append([]interface{}{msg}, args...)...) +} + +// Lessf asserts that the first element is less than the second +// +// assert.Lessf(t, 1, 2, "error message %s", "formatted") +// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted") +// assert.Lessf(t, "a", "b", "error message %s", "formatted") +func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Less(t, e1, e2, append([]interface{}{msg}, args...)...) +} + +// LessOrEqualf asserts that the first element is less than or equal to the second +// +// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted") +// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted") +// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted") +// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted") +func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) +} + +// Negativef asserts that the specified element is negative +// +// assert.Negativef(t, -1, "error message %s", "formatted") +// assert.Negativef(t, -1.23, "error message %s", "formatted") +func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Negative(t, e, append([]interface{}{msg}, args...)...) +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) +} + +// Nilf asserts that the specified object is nil. +// +// assert.Nilf(t, err, "error message %s", "formatted") +func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Nil(t, object, append([]interface{}{msg}, args...)...) +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NoDirExists(t, path, append([]interface{}{msg}, args...)...) +} + +// NoErrorf asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoErrorf(t, err, "error message %s", "formatted") { +// assert.Equal(t, expectedObj, actualObj) +// } +func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NoError(t, err, append([]interface{}{msg}, args...)...) +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NoFileExists(t, path, append([]interface{}{msg}, args...)...) +} + +// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") +// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") +// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") +func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotContains(t, s, contains, append([]interface{}{msg}, args...)...) +} + +// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmptyf(t, obj, "error message %s", "formatted") { +// assert.Equal(t, "two", obj[1]) +// } +func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotEmpty(t, object, append([]interface{}{msg}, args...)...) +} + +// NotEqualf asserts that the specified values are NOT equal. +// +// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") +func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...) +} + +// NotNilf asserts that the specified object is not nil. +// +// assert.NotNilf(t, err, "error message %s", "formatted") +func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotNil(t, object, append([]interface{}{msg}, args...)...) +} + +// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") +func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotPanics(t, f, append([]interface{}{msg}, args...)...) +} + +// NotRegexpf asserts that a specified regexp does not match a string. +// +// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") +func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...) +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// NotSubsetf asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...) +} + +// NotZerof asserts that i is not the zero value for its type. +func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotZero(t, i, append([]interface{}{msg}, args...)...) +} + +// Panicsf asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") +func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Panics(t, f, append([]interface{}{msg}, args...)...) +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...) +} + +// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...) +} + +// Positivef asserts that the specified element is positive +// +// assert.Positivef(t, 1, "error message %s", "formatted") +// assert.Positivef(t, 1.23, "error message %s", "formatted") +func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Positive(t, e, append([]interface{}{msg}, args...)...) +} + +// Regexpf asserts that a specified regexp matches a string. +// +// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") +func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Regexp(t, rx, str, append([]interface{}{msg}, args...)...) +} + +// Samef asserts that two pointers reference the same object. +// +// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Same(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// Subsetf asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Subset(t, list, subset, append([]interface{}{msg}, args...)...) +} + +// Truef asserts that the specified value is true. +// +// assert.Truef(t, myBool, "error message %s", "formatted") +func Truef(t TestingT, value bool, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return True(t, value, append([]interface{}{msg}, args...)...) +} + +// WithinDurationf asserts that the two times are within duration delta of each other. +// +// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") +func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...) +} + +// WithinRangef asserts that a time is within a time range (inclusive). +// +// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") +func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...) +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// Zerof asserts that i is the zero value for its type. +func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Zero(t, i, append([]interface{}{msg}, args...)...) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl new file mode 100644 index 0000000..d2bb0b8 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl @@ -0,0 +1,5 @@ +{{.CommentFormat}} +func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { + if h, ok := t.(tHelper); ok { h.Helper() } + return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go new file mode 100644 index 0000000..339515b --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -0,0 +1,1514 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND + */ + +package assert + +import ( + http "net/http" + url "net/url" + time "time" +) + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Condition(a.t, comp, msgAndArgs...) +} + +// Conditionf uses a Comparison to assert a complex condition. +func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Conditionf(a.t, comp, msg, args...) +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World") +// a.Contains(["Hello", "World"], "World") +// a.Contains({"Hello": "World"}, "Hello") +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Contains(a.t, s, contains, msgAndArgs...) +} + +// Containsf asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Containsf("Hello World", "World", "error message %s", "formatted") +// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") +// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") +func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Containsf(a.t, s, contains, msg, args...) +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return DirExists(a.t, path, msgAndArgs...) +} + +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return DirExistsf(a.t, path, msg, args...) +} + +// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) +func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ElementsMatch(a.t, listA, listB, msgAndArgs...) +} + +// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") +func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ElementsMatchf(a.t, listA, listB, msg, args...) +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Empty(a.t, object, msgAndArgs...) +} + +// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Emptyf(obj, "error message %s", "formatted") +func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Emptyf(a.t, object, msg, args...) +} + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Equal(a.t, expected, actual, msgAndArgs...) +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// a.EqualError(err, expectedErrorString) +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return EqualError(a.t, theError, errString, msgAndArgs...) +} + +// EqualErrorf asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") +func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return EqualErrorf(a.t, theError, errString, msg, args...) +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123)) +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return EqualValues(a.t, expected, actual, msgAndArgs...) +} + +// EqualValuesf asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") +func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return EqualValuesf(a.t, expected, actual, msg, args...) +} + +// Equalf asserts that two objects are equal. +// +// a.Equalf(123, 123, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Equalf(a.t, expected, actual, msg, args...) +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err) { +// assert.Equal(t, expectedError, err) +// } +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Error(a.t, err, msgAndArgs...) +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorAs(a.t, err, target, msgAndArgs...) +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorAsf(a.t, err, target, msg, args...) +} + +// ErrorContains asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// a.ErrorContains(err, expectedErrorSubString) +func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorContains(a.t, theError, contains, msgAndArgs...) +} + +// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted") +func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorContainsf(a.t, theError, contains, msg, args...) +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorIs(a.t, err, target, msgAndArgs...) +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorIsf(a.t, err, target, msg, args...) +} + +// Errorf asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Errorf(err, "error message %s", "formatted") { +// assert.Equal(t, expectedErrorf, err) +// } +func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Errorf(a.t, err, msg, args...) +} + +// Eventually asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Eventually(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Eventuallyf asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Eventuallyf(a.t, condition, waitFor, tick, msg, args...) +} + +// Exactly asserts that two objects are equal in value and type. +// +// a.Exactly(int32(123), int64(123)) +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Exactly(a.t, expected, actual, msgAndArgs...) +} + +// Exactlyf asserts that two objects are equal in value and type. +// +// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") +func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Exactlyf(a.t, expected, actual, msg, args...) +} + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Fail(a.t, failureMessage, msgAndArgs...) +} + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return FailNow(a.t, failureMessage, msgAndArgs...) +} + +// FailNowf fails test +func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return FailNowf(a.t, failureMessage, msg, args...) +} + +// Failf reports a failure through +func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Failf(a.t, failureMessage, msg, args...) +} + +// False asserts that the specified value is false. +// +// a.False(myBool) +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return False(a.t, value, msgAndArgs...) +} + +// Falsef asserts that the specified value is false. +// +// a.Falsef(myBool, "error message %s", "formatted") +func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Falsef(a.t, value, msg, args...) +} + +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return FileExists(a.t, path, msgAndArgs...) +} + +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return FileExistsf(a.t, path, msg, args...) +} + +// Greater asserts that the first element is greater than the second +// +// a.Greater(2, 1) +// a.Greater(float64(2), float64(1)) +// a.Greater("b", "a") +func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Greater(a.t, e1, e2, msgAndArgs...) +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// a.GreaterOrEqual(2, 1) +// a.GreaterOrEqual(2, 2) +// a.GreaterOrEqual("b", "a") +// a.GreaterOrEqual("b", "b") +func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return GreaterOrEqual(a.t, e1, e2, msgAndArgs...) +} + +// GreaterOrEqualf asserts that the first element is greater than or equal to the second +// +// a.GreaterOrEqualf(2, 1, "error message %s", "formatted") +// a.GreaterOrEqualf(2, 2, "error message %s", "formatted") +// a.GreaterOrEqualf("b", "a", "error message %s", "formatted") +// a.GreaterOrEqualf("b", "b", "error message %s", "formatted") +func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return GreaterOrEqualf(a.t, e1, e2, msg, args...) +} + +// Greaterf asserts that the first element is greater than the second +// +// a.Greaterf(2, 1, "error message %s", "formatted") +// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") +// a.Greaterf("b", "a", "error message %s", "formatted") +func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Greaterf(a.t, e1, e2, msg, args...) +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) +} + +// HTTPBodyContainsf asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) +} + +// HTTPBodyNotContainsf asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPError(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPErrorf asserts that a specified handler returns an error status code. +// +// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPErrorf(a.t, handler, method, url, values, msg, args...) +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPRedirectf asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPRedirectf(a.t, handler, method, url, values, msg, args...) +} + +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPSuccessf asserts that a specified handler returns a success status code. +// +// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPSuccessf(a.t, handler, method, url, values, msg, args...) +} + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject)) +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Implements(a.t, interfaceObject, object, msgAndArgs...) +} + +// Implementsf asserts that an object is implemented by the specified interface. +// +// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Implementsf(a.t, interfaceObject, object, msg, args...) +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, 22/7.0, 0.01) +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaSlicef is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InDeltaSlicef(a.t, expected, actual, delta, msg, args...) +} + +// InDeltaf asserts that the two numerals are within delta of each other. +// +// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") +func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InDeltaf(a.t, expected, actual, delta, msg, args...) +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) +} + +// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. +func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) +} + +// InEpsilonf asserts that expected and actual have a relative error less than epsilon +func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return InEpsilonf(a.t, expected, actual, epsilon, msg, args...) +} + +// IsDecreasing asserts that the collection is decreasing +// +// a.IsDecreasing([]int{2, 1, 0}) +// a.IsDecreasing([]float{2, 1}) +// a.IsDecreasing([]string{"b", "a"}) +func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsDecreasing(a.t, object, msgAndArgs...) +} + +// IsDecreasingf asserts that the collection is decreasing +// +// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") +// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsDecreasingf(a.t, object, msg, args...) +} + +// IsIncreasing asserts that the collection is increasing +// +// a.IsIncreasing([]int{1, 2, 3}) +// a.IsIncreasing([]float{1, 2}) +// a.IsIncreasing([]string{"a", "b"}) +func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsIncreasing(a.t, object, msgAndArgs...) +} + +// IsIncreasingf asserts that the collection is increasing +// +// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") +// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsIncreasingf(a.t, object, msg, args...) +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// a.IsNonDecreasing([]int{1, 1, 2}) +// a.IsNonDecreasing([]float{1, 2}) +// a.IsNonDecreasing([]string{"a", "b"}) +func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonDecreasing(a.t, object, msgAndArgs...) +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonDecreasingf(a.t, object, msg, args...) +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// a.IsNonIncreasing([]int{2, 1, 1}) +// a.IsNonIncreasing([]float{2, 1}) +// a.IsNonIncreasing([]string{"b", "a"}) +func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonIncreasing(a.t, object, msgAndArgs...) +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonIncreasingf(a.t, object, msg, args...) +} + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsType(a.t, expectedType, object, msgAndArgs...) +} + +// IsTypef asserts that the specified objects are of the same type. +func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsTypef(a.t, expectedType, object, msg, args...) +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return JSONEq(a.t, expected, actual, msgAndArgs...) +} + +// JSONEqf asserts that two JSON strings are equivalent. +// +// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return JSONEqf(a.t, expected, actual, msg, args...) +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3) +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Len(a.t, object, length, msgAndArgs...) +} + +// Lenf asserts that the specified object has specific length. +// Lenf also fails if the object has a type that len() not accept. +// +// a.Lenf(mySlice, 3, "error message %s", "formatted") +func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Lenf(a.t, object, length, msg, args...) +} + +// Less asserts that the first element is less than the second +// +// a.Less(1, 2) +// a.Less(float64(1), float64(2)) +// a.Less("a", "b") +func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Less(a.t, e1, e2, msgAndArgs...) +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// a.LessOrEqual(1, 2) +// a.LessOrEqual(2, 2) +// a.LessOrEqual("a", "b") +// a.LessOrEqual("b", "b") +func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return LessOrEqual(a.t, e1, e2, msgAndArgs...) +} + +// LessOrEqualf asserts that the first element is less than or equal to the second +// +// a.LessOrEqualf(1, 2, "error message %s", "formatted") +// a.LessOrEqualf(2, 2, "error message %s", "formatted") +// a.LessOrEqualf("a", "b", "error message %s", "formatted") +// a.LessOrEqualf("b", "b", "error message %s", "formatted") +func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return LessOrEqualf(a.t, e1, e2, msg, args...) +} + +// Lessf asserts that the first element is less than the second +// +// a.Lessf(1, 2, "error message %s", "formatted") +// a.Lessf(float64(1), float64(2), "error message %s", "formatted") +// a.Lessf("a", "b", "error message %s", "formatted") +func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Lessf(a.t, e1, e2, msg, args...) +} + +// Negative asserts that the specified element is negative +// +// a.Negative(-1) +// a.Negative(-1.23) +func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Negative(a.t, e, msgAndArgs...) +} + +// Negativef asserts that the specified element is negative +// +// a.Negativef(-1, "error message %s", "formatted") +// a.Negativef(-1.23, "error message %s", "formatted") +func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Negativef(a.t, e, msg, args...) +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Never(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Neverf(a.t, condition, waitFor, tick, msg, args...) +} + +// Nil asserts that the specified object is nil. +// +// a.Nil(err) +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Nil(a.t, object, msgAndArgs...) +} + +// Nilf asserts that the specified object is nil. +// +// a.Nilf(err, "error message %s", "formatted") +func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Nilf(a.t, object, msg, args...) +} + +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoDirExists(a.t, path, msgAndArgs...) +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoDirExistsf(a.t, path, msg, args...) +} + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, expectedObj, actualObj) +// } +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoError(a.t, err, msgAndArgs...) +} + +// NoErrorf asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoErrorf(err, "error message %s", "formatted") { +// assert.Equal(t, expectedObj, actualObj) +// } +func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoErrorf(a.t, err, msg, args...) +} + +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoFileExists(a.t, path, msgAndArgs...) +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoFileExistsf(a.t, path, msg, args...) +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth") +// a.NotContains(["Hello", "World"], "Earth") +// a.NotContains({"Hello": "World"}, "Earth") +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotContains(a.t, s, contains, msgAndArgs...) +} + +// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") +// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") +// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") +func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotContainsf(a.t, s, contains, msg, args...) +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEmpty(a.t, object, msgAndArgs...) +} + +// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmptyf(obj, "error message %s", "formatted") { +// assert.Equal(t, "two", obj[1]) +// } +func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEmptyf(a.t, object, msg, args...) +} + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEqual(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValues(obj1, obj2) +func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEqualValues(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") +func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEqualValuesf(a.t, expected, actual, msg, args...) +} + +// NotEqualf asserts that the specified values are NOT equal. +// +// a.NotEqualf(obj1, obj2, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEqualf(a.t, expected, actual, msg, args...) +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorIs(a.t, err, target, msgAndArgs...) +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorIsf(a.t, err, target, msg, args...) +} + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err) +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotNil(a.t, object, msgAndArgs...) +} + +// NotNilf asserts that the specified object is not nil. +// +// a.NotNilf(err, "error message %s", "formatted") +func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotNilf(a.t, object, msg, args...) +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ RemainCalm() }) +func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotPanics(a.t, f, msgAndArgs...) +} + +// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") +func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotPanicsf(a.t, f, msg, args...) +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotRegexp(a.t, rx, str, msgAndArgs...) +} + +// NotRegexpf asserts that a specified regexp does not match a string. +// +// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") +func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotRegexpf(a.t, rx, str, msg, args...) +} + +// NotSame asserts that two pointers do not reference the same object. +// +// a.NotSame(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotSame(a.t, expected, actual, msgAndArgs...) +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotSamef(a.t, expected, actual, msg, args...) +} + +// NotSubset asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotSubset(a.t, list, subset, msgAndArgs...) +} + +// NotSubsetf asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotSubsetf(a.t, list, subset, msg, args...) +} + +// NotZero asserts that i is not the zero value for its type. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotZero(a.t, i, msgAndArgs...) +} + +// NotZerof asserts that i is not the zero value for its type. +func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotZerof(a.t, i, msg, args...) +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ GoCrazy() }) +func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Panics(a.t, f, msgAndArgs...) +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithError("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return PanicsWithError(a.t, errString, f, msgAndArgs...) +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return PanicsWithErrorf(a.t, errString, f, msg, args...) +} + +// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return PanicsWithValue(a.t, expected, f, msgAndArgs...) +} + +// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return PanicsWithValuef(a.t, expected, f, msg, args...) +} + +// Panicsf asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Panicsf(a.t, f, msg, args...) +} + +// Positive asserts that the specified element is positive +// +// a.Positive(1) +// a.Positive(1.23) +func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Positive(a.t, e, msgAndArgs...) +} + +// Positivef asserts that the specified element is positive +// +// a.Positivef(1, "error message %s", "formatted") +// a.Positivef(1.23, "error message %s", "formatted") +func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Positivef(a.t, e, msg, args...) +} + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Regexp(a.t, rx, str, msgAndArgs...) +} + +// Regexpf asserts that a specified regexp matches a string. +// +// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") +func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Regexpf(a.t, rx, str, msg, args...) +} + +// Same asserts that two pointers reference the same object. +// +// a.Same(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Same(a.t, expected, actual, msgAndArgs...) +} + +// Samef asserts that two pointers reference the same object. +// +// a.Samef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Samef(a.t, expected, actual, msg, args...) +} + +// Subset asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Subset(a.t, list, subset, msgAndArgs...) +} + +// Subsetf asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Subsetf(a.t, list, subset, msg, args...) +} + +// True asserts that the specified value is true. +// +// a.True(myBool) +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return True(a.t, value, msgAndArgs...) +} + +// Truef asserts that the specified value is true. +// +// a.Truef(myBool, "error message %s", "formatted") +func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Truef(a.t, value, msg, args...) +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + +// WithinDurationf asserts that the two times are within duration delta of each other. +// +// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") +func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return WithinDurationf(a.t, expected, actual, delta, msg, args...) +} + +// WithinRange asserts that a time is within a time range (inclusive). +// +// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) +func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return WithinRange(a.t, actual, start, end, msgAndArgs...) +} + +// WithinRangef asserts that a time is within a time range (inclusive). +// +// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") +func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return WithinRangef(a.t, actual, start, end, msg, args...) +} + +// YAMLEq asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return YAMLEq(a.t, expected, actual, msgAndArgs...) +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return YAMLEqf(a.t, expected, actual, msg, args...) +} + +// Zero asserts that i is the zero value for its type. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Zero(a.t, i, msgAndArgs...) +} + +// Zerof asserts that i is the zero value for its type. +func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Zerof(a.t, i, msg, args...) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl new file mode 100644 index 0000000..188bb9e --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl @@ -0,0 +1,5 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { + if h, ok := a.t.(tHelper); ok { h.Helper() } + return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go new file mode 100644 index 0000000..7594487 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -0,0 +1,81 @@ +package assert + +import ( + "fmt" + "reflect" +) + +// isOrdered checks that collection contains orderable elements. +func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { + objKind := reflect.TypeOf(object).Kind() + if objKind != reflect.Slice && objKind != reflect.Array { + return false + } + + objValue := reflect.ValueOf(object) + objLen := objValue.Len() + + if objLen <= 1 { + return true + } + + value := objValue.Index(0) + valueInterface := value.Interface() + firstValueKind := value.Kind() + + for i := 1; i < objLen; i++ { + prevValue := value + prevValueInterface := valueInterface + + value = objValue.Index(i) + valueInterface = value.Interface() + + compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) + + if !isComparable { + return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) + } + + if !containsValue(allowedComparesResults, compareResult) { + return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...) + } + } + + return true +} + +// IsIncreasing asserts that the collection is increasing +// +// assert.IsIncreasing(t, []int{1, 2, 3}) +// assert.IsIncreasing(t, []float{1, 2}) +// assert.IsIncreasing(t, []string{"a", "b"}) +func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// assert.IsNonIncreasing(t, []int{2, 1, 1}) +// assert.IsNonIncreasing(t, []float{2, 1}) +// assert.IsNonIncreasing(t, []string{"b", "a"}) +func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) +} + +// IsDecreasing asserts that the collection is decreasing +// +// assert.IsDecreasing(t, []int{2, 1, 0}) +// assert.IsDecreasing(t, []float{2, 1}) +// assert.IsDecreasing(t, []string{"b", "a"}) +func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// assert.IsNonDecreasing(t, []int{1, 1, 2}) +// assert.IsNonDecreasing(t, []float{1, 2}) +// assert.IsNonDecreasing(t, []string{"a", "b"}) +func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go new file mode 100644 index 0000000..2924cf3 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -0,0 +1,1856 @@ +package assert + +import ( + "bufio" + "bytes" + "encoding/json" + "errors" + "fmt" + "math" + "os" + "reflect" + "regexp" + "runtime" + "runtime/debug" + "strings" + "time" + "unicode" + "unicode/utf8" + + "github.com/davecgh/go-spew/spew" + "github.com/pmezard/go-difflib/difflib" + yaml "gopkg.in/yaml.v3" +) + +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) +} + +// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful +// for table driven tests. +type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool + +// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful +// for table driven tests. +type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool + +// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful +// for table driven tests. +type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool + +// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful +// for table driven tests. +type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool + +// Comparison is a custom function that returns true on success and false on failure +type Comparison func() (success bool) + +/* + Helper functions +*/ + +// ObjectsAreEqual determines if two objects are considered equal. +// +// This function does no assertion of any kind. +func ObjectsAreEqual(expected, actual interface{}) bool { + if expected == nil || actual == nil { + return expected == actual + } + + exp, ok := expected.([]byte) + if !ok { + return reflect.DeepEqual(expected, actual) + } + + act, ok := actual.([]byte) + if !ok { + return false + } + if exp == nil || act == nil { + return exp == nil && act == nil + } + return bytes.Equal(exp, act) +} + +// ObjectsAreEqualValues gets whether two objects are equal, or if their +// values are equal. +func ObjectsAreEqualValues(expected, actual interface{}) bool { + if ObjectsAreEqual(expected, actual) { + return true + } + + actualType := reflect.TypeOf(actual) + if actualType == nil { + return false + } + expectedValue := reflect.ValueOf(expected) + if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) { + // Attempt comparison after type conversion + return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual) + } + + return false +} + +/* CallerInfo is necessary because the assert functions use the testing object +internally, causing it to print the file:line of the assert method, rather than where +the problem actually occurred in calling code.*/ + +// CallerInfo returns an array of strings containing the file and line number +// of each stack frame leading from the current test to the assert call that +// failed. +func CallerInfo() []string { + + var pc uintptr + var ok bool + var file string + var line int + var name string + + callers := []string{} + for i := 0; ; i++ { + pc, file, line, ok = runtime.Caller(i) + if !ok { + // The breaks below failed to terminate the loop, and we ran off the + // end of the call stack. + break + } + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break + } + + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + + // testing.tRunner is the standard library function that calls + // tests. Subtests are called directly by tRunner, without going through + // the Test/Benchmark/Example function that contains the t.Run calls, so + // with subtests we should break when we hit tRunner, without adding it + // to the list of callers. + if name == "testing.tRunner" { + break + } + + parts := strings.Split(file, "/") + if len(parts) > 1 { + filename := parts[len(parts)-1] + dir := parts[len(parts)-2] + if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + } + + // Drop the package + segments := strings.Split(name, ".") + name = segments[len(segments)-1] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + } + + return callers +} + +// Stolen from the `go test` tool. +// isTest tells whether name looks like a test (or benchmark, according to prefix). +// It is a Test (say) if there is a character after Test that is not a lower-case letter. +// We don't want TesticularCancer. +func isTest(name, prefix string) bool { + if !strings.HasPrefix(name, prefix) { + return false + } + if len(name) == len(prefix) { // "Test" is ok + return true + } + r, _ := utf8.DecodeRuneInString(name[len(prefix):]) + return !unicode.IsLower(r) +} + +func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { + if len(msgAndArgs) == 0 || msgAndArgs == nil { + return "" + } + if len(msgAndArgs) == 1 { + msg := msgAndArgs[0] + if msgAsStr, ok := msg.(string); ok { + return msgAsStr + } + return fmt.Sprintf("%+v", msg) + } + if len(msgAndArgs) > 1 { + return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) + } + return "" +} + +// Aligns the provided message so that all lines after the first line start at the same location as the first line. +// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). +// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the +// basis on which the alignment occurs). +func indentMessageLines(message string, longestLabelLen int) string { + outBuf := new(bytes.Buffer) + + for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ { + // no need to align first line because it starts at the correct location (after the label) + if i != 0 { + // append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab + outBuf.WriteString("\n\t" + strings.Repeat(" ", longestLabelLen+1) + "\t") + } + outBuf.WriteString(scanner.Text()) + } + + return outBuf.String() +} + +type failNower interface { + FailNow() +} + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + Fail(t, failureMessage, msgAndArgs...) + + // We cannot extend TestingT with FailNow() and + // maintain backwards compatibility, so we fallback + // to panicking when FailNow is not available in + // TestingT. + // See issue #263 + + if t, ok := t.(failNower); ok { + t.FailNow() + } else { + panic("test failed and t is missing `FailNow()`") + } + return false +} + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + content := []labeledContent{ + {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")}, + {"Error", failureMessage}, + } + + // Add test name if the Go version supports it + if n, ok := t.(interface { + Name() string + }); ok { + content = append(content, labeledContent{"Test", n.Name()}) + } + + message := messageFromMsgAndArgs(msgAndArgs...) + if len(message) > 0 { + content = append(content, labeledContent{"Messages", message}) + } + + t.Errorf("\n%s", ""+labeledOutput(content...)) + + return false +} + +type labeledContent struct { + label string + content string +} + +// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner: +// +// \t{{label}}:{{align_spaces}}\t{{content}}\n +// +// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label. +// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this +// alignment is achieved, "\t{{content}}\n" is added for the output. +// +// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line. +func labeledOutput(content ...labeledContent) string { + longestLabel := 0 + for _, v := range content { + if len(v.label) > longestLabel { + longestLabel = len(v.label) + } + } + var output string + for _, v := range content { + output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n" + } + return output +} + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + interfaceType := reflect.TypeOf(interfaceObject).Elem() + + if object == nil { + return Fail(t, fmt.Sprintf("Cannot check if nil implements %v", interfaceType), msgAndArgs...) + } + if !reflect.TypeOf(object).Implements(interfaceType) { + return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...) + } + + return true +} + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { + return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) + } + + return true +} + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if err := validateEqualArgs(expected, actual); err != nil { + return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)", + expected, actual, err), msgAndArgs...) + } + + if !ObjectsAreEqual(expected, actual) { + diff := diff(expected, actual) + expected, actual = formatUnequalValues(expected, actual) + return Fail(t, fmt.Sprintf("Not equal: \n"+ + "expected: %s\n"+ + "actual : %s%s", expected, actual, diff), msgAndArgs...) + } + + return true + +} + +// validateEqualArgs checks whether provided arguments can be safely used in the +// Equal/NotEqual functions. +func validateEqualArgs(expected, actual interface{}) error { + if expected == nil && actual == nil { + return nil + } + + if isFunction(expected) || isFunction(actual) { + return errors.New("cannot take func type as argument") + } + return nil +} + +// Same asserts that two pointers reference the same object. +// +// assert.Same(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if !samePointers(expected, actual) { + return Fail(t, fmt.Sprintf("Not same: \n"+ + "expected: %p %#v\n"+ + "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) + } + + return true +} + +// NotSame asserts that two pointers do not reference the same object. +// +// assert.NotSame(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if samePointers(expected, actual) { + return Fail(t, fmt.Sprintf( + "Expected and actual point to the same object: %p %#v", + expected, expected), msgAndArgs...) + } + return true +} + +// samePointers compares two generic interface objects and returns whether +// they point to the same object +func samePointers(first, second interface{}) bool { + firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) + if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { + return false + } + + firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) + if firstType != secondType { + return false + } + + // compare pointer addresses + return first == second +} + +// formatUnequalValues takes two values of arbitrary types and returns string +// representations appropriate to be presented to the user. +// +// If the values are not of like type, the returned strings will be prefixed +// with the type name, and the value will be enclosed in parenthesis similar +// to a type conversion in the Go grammar. +func formatUnequalValues(expected, actual interface{}) (e string, a string) { + if reflect.TypeOf(expected) != reflect.TypeOf(actual) { + return fmt.Sprintf("%T(%s)", expected, truncatingFormat(expected)), + fmt.Sprintf("%T(%s)", actual, truncatingFormat(actual)) + } + switch expected.(type) { + case time.Duration: + return fmt.Sprintf("%v", expected), fmt.Sprintf("%v", actual) + } + return truncatingFormat(expected), truncatingFormat(actual) +} + +// truncatingFormat formats the data and truncates it if it's too long. +// +// This helps keep formatted error messages lines from exceeding the +// bufio.MaxScanTokenSize max line length that the go testing framework imposes. +func truncatingFormat(data interface{}) string { + value := fmt.Sprintf("%#v", data) + max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed. + if len(value) > max { + value = value[0:max] + "<... truncated>" + } + return value +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123)) +func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if !ObjectsAreEqualValues(expected, actual) { + diff := diff(expected, actual) + expected, actual = formatUnequalValues(expected, actual) + return Fail(t, fmt.Sprintf("Not equal: \n"+ + "expected: %s\n"+ + "actual : %s%s", expected, actual, diff), msgAndArgs...) + } + + return true + +} + +// Exactly asserts that two objects are equal in value and type. +// +// assert.Exactly(t, int32(123), int64(123)) +func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + aType := reflect.TypeOf(expected) + bType := reflect.TypeOf(actual) + + if aType != bType { + return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) + } + + return Equal(t, expected, actual, msgAndArgs...) + +} + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err) +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if !isNil(object) { + return true + } + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, "Expected value not to be nil.", msgAndArgs...) +} + +// containsKind checks if a specified kind in the slice of kinds. +func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { + for i := 0; i < len(kinds); i++ { + if kind == kinds[i] { + return true + } + } + + return false +} + +// isNil checks if a specified object is nil or not, without Failing. +func isNil(object interface{}) bool { + if object == nil { + return true + } + + value := reflect.ValueOf(object) + kind := value.Kind() + isNilableKind := containsKind( + []reflect.Kind{ + reflect.Chan, reflect.Func, + reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice, reflect.UnsafePointer}, + kind) + + if isNilableKind && value.IsNil() { + return true + } + + return false +} + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err) +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if isNil(object) { + return true + } + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) +} + +// isEmpty gets whether the specified object is considered empty or not. +func isEmpty(object interface{}) bool { + + // get nil case out of the way + if object == nil { + return true + } + + objValue := reflect.ValueOf(object) + + switch objValue.Kind() { + // collection types are empty when they have no element + case reflect.Chan, reflect.Map, reflect.Slice: + return objValue.Len() == 0 + // pointers are empty if nil or if the value they point to is empty + case reflect.Ptr: + if objValue.IsNil() { + return true + } + deref := objValue.Elem().Interface() + return isEmpty(deref) + // for all other types, compare against the zero value + // array types are empty when they match their zero-initialized state + default: + zero := reflect.Zero(objValue.Type()) + return reflect.DeepEqual(object, zero.Interface()) + } +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + pass := isEmpty(object) + if !pass { + if h, ok := t.(tHelper); ok { + h.Helper() + } + Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) + } + + return pass + +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + pass := !isEmpty(object) + if !pass { + if h, ok := t.(tHelper); ok { + h.Helper() + } + Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) + } + + return pass + +} + +// getLen try to get length of object. +// return (false, 0) if impossible. +func getLen(x interface{}) (ok bool, length int) { + v := reflect.ValueOf(x) + defer func() { + if e := recover(); e != nil { + ok = false + } + }() + return true, v.Len() +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3) +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + ok, l := getLen(object) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) + } + + if l != length { + return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) + } + return true +} + +// True asserts that the specified value is true. +// +// assert.True(t, myBool) +func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { + if !value { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, "Should be true", msgAndArgs...) + } + + return true + +} + +// False asserts that the specified value is false. +// +// assert.False(t, myBool) +func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { + if value { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, "Should be false", msgAndArgs...) + } + + return true + +} + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if err := validateEqualArgs(expected, actual); err != nil { + return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)", + expected, actual, err), msgAndArgs...) + } + + if ObjectsAreEqual(expected, actual) { + return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) + } + + return true + +} + +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValues(t, obj1, obj2) +func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if ObjectsAreEqualValues(expected, actual) { + return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) + } + + return true +} + +// containsElement try loop over the list check if the list includes the element. +// return (false, false) if impossible. +// return (true, false) if element was not found. +// return (true, true) if element was found. +func containsElement(list interface{}, element interface{}) (ok, found bool) { + + listValue := reflect.ValueOf(list) + listType := reflect.TypeOf(list) + if listType == nil { + return false, false + } + listKind := listType.Kind() + defer func() { + if e := recover(); e != nil { + ok = false + found = false + } + }() + + if listKind == reflect.String { + elementValue := reflect.ValueOf(element) + return true, strings.Contains(listValue.String(), elementValue.String()) + } + + if listKind == reflect.Map { + mapKeys := listValue.MapKeys() + for i := 0; i < len(mapKeys); i++ { + if ObjectsAreEqual(mapKeys[i].Interface(), element) { + return true, true + } + } + return true, false + } + + for i := 0; i < listValue.Len(); i++ { + if ObjectsAreEqual(listValue.Index(i).Interface(), element) { + return true, true + } + } + return true, false + +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World") +// assert.Contains(t, ["Hello", "World"], "World") +// assert.Contains(t, {"Hello": "World"}, "Hello") +func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + ok, found := containsElement(s, contains) + if !ok { + return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...) + } + if !found { + return Fail(t, fmt.Sprintf("%#v does not contain %#v", s, contains), msgAndArgs...) + } + + return true + +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth") +// assert.NotContains(t, ["Hello", "World"], "Earth") +// assert.NotContains(t, {"Hello": "World"}, "Earth") +func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + ok, found := containsElement(s, contains) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) + } + if found { + return Fail(t, fmt.Sprintf("\"%s\" should not contain \"%s\"", s, contains), msgAndArgs...) + } + + return true + +} + +// Subset asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if subset == nil { + return true // we consider nil to be equal to the nil set + } + + listKind := reflect.TypeOf(list).Kind() + if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map { + return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...) + } + + subsetKind := reflect.TypeOf(subset).Kind() + if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) + } + + if subsetKind == reflect.Map && listKind == reflect.Map { + subsetMap := reflect.ValueOf(subset) + actualMap := reflect.ValueOf(list) + + for _, k := range subsetMap.MapKeys() { + ev := subsetMap.MapIndex(k) + av := actualMap.MapIndex(k) + + if !av.IsValid() { + return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...) + } + if !ObjectsAreEqual(ev.Interface(), av.Interface()) { + return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...) + } + } + + return true + } + + subsetList := reflect.ValueOf(subset) + for i := 0; i < subsetList.Len(); i++ { + element := subsetList.Index(i).Interface() + ok, found := containsElement(list, element) + if !ok { + return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", list), msgAndArgs...) + } + if !found { + return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, element), msgAndArgs...) + } + } + + return true +} + +// NotSubset asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if subset == nil { + return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...) + } + + listKind := reflect.TypeOf(list).Kind() + if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map { + return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...) + } + + subsetKind := reflect.TypeOf(subset).Kind() + if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) + } + + if subsetKind == reflect.Map && listKind == reflect.Map { + subsetMap := reflect.ValueOf(subset) + actualMap := reflect.ValueOf(list) + + for _, k := range subsetMap.MapKeys() { + ev := subsetMap.MapIndex(k) + av := actualMap.MapIndex(k) + + if !av.IsValid() { + return true + } + if !ObjectsAreEqual(ev.Interface(), av.Interface()) { + return true + } + } + + return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...) + } + + subsetList := reflect.ValueOf(subset) + for i := 0; i < subsetList.Len(); i++ { + element := subsetList.Index(i).Interface() + ok, found := containsElement(list, element) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...) + } + if !found { + return true + } + } + + return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...) +} + +// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) +func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if isEmpty(listA) && isEmpty(listB) { + return true + } + + if !isList(t, listA, msgAndArgs...) || !isList(t, listB, msgAndArgs...) { + return false + } + + extraA, extraB := diffLists(listA, listB) + + if len(extraA) == 0 && len(extraB) == 0 { + return true + } + + return Fail(t, formatListDiff(listA, listB, extraA, extraB), msgAndArgs...) +} + +// isList checks that the provided value is array or slice. +func isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok bool) { + kind := reflect.TypeOf(list).Kind() + if kind != reflect.Array && kind != reflect.Slice { + return Fail(t, fmt.Sprintf("%q has an unsupported type %s, expecting array or slice", list, kind), + msgAndArgs...) + } + return true +} + +// diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B. +// If some element is present multiple times, each instance is counted separately (e.g. if something is 2x in A and +// 5x in B, it will be 0x in extraA and 3x in extraB). The order of items in both lists is ignored. +func diffLists(listA, listB interface{}) (extraA, extraB []interface{}) { + aValue := reflect.ValueOf(listA) + bValue := reflect.ValueOf(listB) + + aLen := aValue.Len() + bLen := bValue.Len() + + // Mark indexes in bValue that we already used + visited := make([]bool, bLen) + for i := 0; i < aLen; i++ { + element := aValue.Index(i).Interface() + found := false + for j := 0; j < bLen; j++ { + if visited[j] { + continue + } + if ObjectsAreEqual(bValue.Index(j).Interface(), element) { + visited[j] = true + found = true + break + } + } + if !found { + extraA = append(extraA, element) + } + } + + for j := 0; j < bLen; j++ { + if visited[j] { + continue + } + extraB = append(extraB, bValue.Index(j).Interface()) + } + + return +} + +func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string { + var msg bytes.Buffer + + msg.WriteString("elements differ") + if len(extraA) > 0 { + msg.WriteString("\n\nextra elements in list A:\n") + msg.WriteString(spewConfig.Sdump(extraA)) + } + if len(extraB) > 0 { + msg.WriteString("\n\nextra elements in list B:\n") + msg.WriteString(spewConfig.Sdump(extraB)) + } + msg.WriteString("\n\nlistA:\n") + msg.WriteString(spewConfig.Sdump(listA)) + msg.WriteString("\n\nlistB:\n") + msg.WriteString(spewConfig.Sdump(listB)) + + return msg.String() +} + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + result := comp() + if !result { + Fail(t, "Condition failed!", msgAndArgs...) + } + return result +} + +// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics +// methods, and represents a simple func that takes no arguments, and returns nothing. +type PanicTestFunc func() + +// didPanic returns true if the function passed to it panics. Otherwise, it returns false. +func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) { + didPanic = true + + defer func() { + message = recover() + if didPanic { + stack = string(debug.Stack()) + } + }() + + // call the target function + f() + didPanic = false + + return +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ GoCrazy() }) +func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + } + + return true +} + +// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + funcDidPanic, panicValue, panickedStack := didPanic(f) + if !funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + } + if panicValue != expected { + return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, expected, panicValue, panickedStack), msgAndArgs...) + } + + return true +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + funcDidPanic, panicValue, panickedStack := didPanic(f) + if !funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + } + panicErr, ok := panicValue.(error) + if !ok || panicErr.Error() != errString { + return Fail(t, fmt.Sprintf("func %#v should panic with error message:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, errString, panicValue, panickedStack), msgAndArgs...) + } + + return true +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ RemainCalm() }) +func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...) + } + + return true +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) +func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + dt := expected.Sub(actual) + if dt < -delta || dt > delta { + return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) + } + + return true +} + +// WithinRange asserts that a time is within a time range (inclusive). +// +// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) +func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if end.Before(start) { + return Fail(t, "Start should be before end", msgAndArgs...) + } + + if actual.Before(start) { + return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is before the range", actual, start, end), msgAndArgs...) + } else if actual.After(end) { + return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is after the range", actual, start, end), msgAndArgs...) + } + + return true +} + +func toFloat(x interface{}) (float64, bool) { + var xf float64 + xok := true + + switch xn := x.(type) { + case uint: + xf = float64(xn) + case uint8: + xf = float64(xn) + case uint16: + xf = float64(xn) + case uint32: + xf = float64(xn) + case uint64: + xf = float64(xn) + case int: + xf = float64(xn) + case int8: + xf = float64(xn) + case int16: + xf = float64(xn) + case int32: + xf = float64(xn) + case int64: + xf = float64(xn) + case float32: + xf = float64(xn) + case float64: + xf = xn + case time.Duration: + xf = float64(xn) + default: + xok = false + } + + return xf, xok +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, 22/7.0, 0.01) +func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + af, aok := toFloat(expected) + bf, bok := toFloat(actual) + + if !aok || !bok { + return Fail(t, "Parameters must be numerical", msgAndArgs...) + } + + if math.IsNaN(af) && math.IsNaN(bf) { + return true + } + + if math.IsNaN(af) { + return Fail(t, "Expected must not be NaN", msgAndArgs...) + } + + if math.IsNaN(bf) { + return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...) + } + + dt := af - bf + if dt < -delta || dt > delta { + return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) + } + + return true +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Slice || + reflect.TypeOf(expected).Kind() != reflect.Slice { + return Fail(t, "Parameters must be slice", msgAndArgs...) + } + + actualSlice := reflect.ValueOf(actual) + expectedSlice := reflect.ValueOf(expected) + + for i := 0; i < actualSlice.Len(); i++ { + result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...) + if !result { + return result + } + } + + return true +} + +// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Map || + reflect.TypeOf(expected).Kind() != reflect.Map { + return Fail(t, "Arguments must be maps", msgAndArgs...) + } + + expectedMap := reflect.ValueOf(expected) + actualMap := reflect.ValueOf(actual) + + if expectedMap.Len() != actualMap.Len() { + return Fail(t, "Arguments must have the same number of keys", msgAndArgs...) + } + + for _, k := range expectedMap.MapKeys() { + ev := expectedMap.MapIndex(k) + av := actualMap.MapIndex(k) + + if !ev.IsValid() { + return Fail(t, fmt.Sprintf("missing key %q in expected map", k), msgAndArgs...) + } + + if !av.IsValid() { + return Fail(t, fmt.Sprintf("missing key %q in actual map", k), msgAndArgs...) + } + + if !InDelta( + t, + ev.Interface(), + av.Interface(), + delta, + msgAndArgs..., + ) { + return false + } + } + + return true +} + +func calcRelativeError(expected, actual interface{}) (float64, error) { + af, aok := toFloat(expected) + bf, bok := toFloat(actual) + if !aok || !bok { + return 0, fmt.Errorf("Parameters must be numerical") + } + if math.IsNaN(af) && math.IsNaN(bf) { + return 0, nil + } + if math.IsNaN(af) { + return 0, errors.New("expected value must not be NaN") + } + if af == 0 { + return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") + } + if math.IsNaN(bf) { + return 0, errors.New("actual value must not be NaN") + } + + return math.Abs(af-bf) / math.Abs(af), nil +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if math.IsNaN(epsilon) { + return Fail(t, "epsilon must not be NaN") + } + actualEpsilon, err := calcRelativeError(expected, actual) + if err != nil { + return Fail(t, err.Error(), msgAndArgs...) + } + if actualEpsilon > epsilon { + return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ + " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...) + } + + return true +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Slice || + reflect.TypeOf(expected).Kind() != reflect.Slice { + return Fail(t, "Parameters must be slice", msgAndArgs...) + } + + actualSlice := reflect.ValueOf(actual) + expectedSlice := reflect.ValueOf(expected) + + for i := 0; i < actualSlice.Len(); i++ { + result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon) + if !result { + return result + } + } + + return true +} + +/* + Errors +*/ + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, expectedObj, actualObj) +// } +func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { + if err != nil { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...) + } + + return true +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err) { +// assert.Equal(t, expectedError, err) +// } +func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { + if err == nil { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, "An error is expected but got nil.", msgAndArgs...) + } + + return true +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualError(t, err, expectedErrorString) +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if !Error(t, theError, msgAndArgs...) { + return false + } + expected := errString + actual := theError.Error() + // don't need to use deep equals here, we know they are both strings + if expected != actual { + return Fail(t, fmt.Sprintf("Error message not equal:\n"+ + "expected: %q\n"+ + "actual : %q", expected, actual), msgAndArgs...) + } + return true +} + +// ErrorContains asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// assert.ErrorContains(t, err, expectedErrorSubString) +func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if !Error(t, theError, msgAndArgs...) { + return false + } + + actual := theError.Error() + if !strings.Contains(actual, contains) { + return Fail(t, fmt.Sprintf("Error %#v does not contain %#v", actual, contains), msgAndArgs...) + } + + return true +} + +// matchRegexp return true if a specified regexp matches a string. +func matchRegexp(rx interface{}, str interface{}) bool { + + var r *regexp.Regexp + if rr, ok := rx.(*regexp.Regexp); ok { + r = rr + } else { + r = regexp.MustCompile(fmt.Sprint(rx)) + } + + return (r.FindStringIndex(fmt.Sprint(str)) != nil) + +} + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + match := matchRegexp(rx, str) + + if !match { + Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) + } + + return match +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + match := matchRegexp(rx, str) + + if match { + Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...) + } + + return !match + +} + +// Zero asserts that i is the zero value for its type. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { + return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) + } + return true +} + +// NotZero asserts that i is not the zero value for its type. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { + return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) + } + return true +} + +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + info, err := os.Lstat(path) + if err != nil { + if os.IsNotExist(err) { + return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...) + } + return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...) + } + if info.IsDir() { + return Fail(t, fmt.Sprintf("%q is a directory", path), msgAndArgs...) + } + return true +} + +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + info, err := os.Lstat(path) + if err != nil { + return true + } + if info.IsDir() { + return true + } + return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + info, err := os.Lstat(path) + if err != nil { + if os.IsNotExist(err) { + return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...) + } + return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...) + } + if !info.IsDir() { + return Fail(t, fmt.Sprintf("%q is a file", path), msgAndArgs...) + } + return true +} + +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + info, err := os.Lstat(path) + if err != nil { + if os.IsNotExist(err) { + return true + } + return true + } + if !info.IsDir() { + return true + } + return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...) +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + var expectedJSONAsInterface, actualJSONAsInterface interface{} + + if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) + } + + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) + } + + return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...) +} + +// YAMLEq asserts that two YAML strings are equivalent. +func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + var expectedYAMLAsInterface, actualYAMLAsInterface interface{} + + if err := yaml.Unmarshal([]byte(expected), &expectedYAMLAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) + } + + if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) + } + + return Equal(t, expectedYAMLAsInterface, actualYAMLAsInterface, msgAndArgs...) +} + +func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { + t := reflect.TypeOf(v) + k := t.Kind() + + if k == reflect.Ptr { + t = t.Elem() + k = t.Kind() + } + return t, k +} + +// diff returns a diff of both values as long as both are of the same type and +// are a struct, map, slice, array or string. Otherwise it returns an empty string. +func diff(expected interface{}, actual interface{}) string { + if expected == nil || actual == nil { + return "" + } + + et, ek := typeAndKind(expected) + at, _ := typeAndKind(actual) + + if et != at { + return "" + } + + if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String { + return "" + } + + var e, a string + + switch et { + case reflect.TypeOf(""): + e = reflect.ValueOf(expected).String() + a = reflect.ValueOf(actual).String() + case reflect.TypeOf(time.Time{}): + e = spewConfigStringerEnabled.Sdump(expected) + a = spewConfigStringerEnabled.Sdump(actual) + default: + e = spewConfig.Sdump(expected) + a = spewConfig.Sdump(actual) + } + + diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ + A: difflib.SplitLines(e), + B: difflib.SplitLines(a), + FromFile: "Expected", + FromDate: "", + ToFile: "Actual", + ToDate: "", + Context: 1, + }) + + return "\n\nDiff:\n" + diff +} + +func isFunction(arg interface{}) bool { + if arg == nil { + return false + } + return reflect.TypeOf(arg).Kind() == reflect.Func +} + +var spewConfig = spew.ConfigState{ + Indent: " ", + DisablePointerAddresses: true, + DisableCapacities: true, + SortKeys: true, + DisableMethods: true, + MaxDepth: 10, +} + +var spewConfigStringerEnabled = spew.ConfigState{ + Indent: " ", + DisablePointerAddresses: true, + DisableCapacities: true, + SortKeys: true, + MaxDepth: 10, +} + +type tHelper interface { + Helper() +} + +// Eventually asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond) +func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + ch := make(chan bool, 1) + + timer := time.NewTimer(waitFor) + defer timer.Stop() + + ticker := time.NewTicker(tick) + defer ticker.Stop() + + for tick := ticker.C; ; { + select { + case <-timer.C: + return Fail(t, "Condition never satisfied", msgAndArgs...) + case <-tick: + tick = nil + go func() { ch <- condition() }() + case v := <-ch: + if v { + return true + } + tick = ticker.C + } + } +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) +func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + ch := make(chan bool, 1) + + timer := time.NewTimer(waitFor) + defer timer.Stop() + + ticker := time.NewTicker(tick) + defer ticker.Stop() + + for tick := ticker.C; ; { + select { + case <-timer.C: + return true + case <-tick: + tick = nil + go func() { ch <- condition() }() + case v := <-ch: + if v { + return Fail(t, "Condition satisfied", msgAndArgs...) + } + tick = ticker.C + } + } +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if errors.Is(err, target) { + return true + } + + var expectedText string + if target != nil { + expectedText = target.Error() + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ + "expected: %q\n"+ + "in chain: %s", expectedText, chain, + ), msgAndArgs...) +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if !errors.Is(err, target) { + return true + } + + var expectedText string + if target != nil { + expectedText = target.Error() + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ + "found: %q\n"+ + "in chain: %s", expectedText, chain, + ), msgAndArgs...) +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if errors.As(err, target) { + return true + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ + "expected: %q\n"+ + "in chain: %s", target, chain, + ), msgAndArgs...) +} + +func buildErrorChainString(err error) string { + if err == nil { + return "" + } + + e := errors.Unwrap(err) + chain := fmt.Sprintf("%q", err.Error()) + for e != nil { + chain += fmt.Sprintf("\n\t%q", e.Error()) + e = errors.Unwrap(e) + } + return chain +} diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go new file mode 100644 index 0000000..c9dccc4 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -0,0 +1,45 @@ +// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. +// +// Example Usage +// +// The following is a complete example using assert in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// assert.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// if you assert many times, use the format below: +// +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// ) +// +// func TestSomething(t *testing.T) { +// assert := assert.New(t) +// +// var a string = "Hello" +// var b string = "Hello" +// +// assert.Equal(a, b, "The two words should be the same.") +// } +// +// Assertions +// +// Assertions allow you to easily write test code, and are global funcs in the `assert` package. +// All assertion functions take, as the first argument, the `*testing.T` object provided by the +// testing framework. This allows the assertion funcs to write the failings and other details to +// the correct place. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package assert diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go new file mode 100644 index 0000000..ac9dc9d --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/errors.go @@ -0,0 +1,10 @@ +package assert + +import ( + "errors" +) + +// AnError is an error instance useful for testing. If the code does not care +// about error specifics, and only needs to return the error for example, this +// error should be used to make the test code more readable. +var AnError = errors.New("assert.AnError general error for testing") diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go new file mode 100644 index 0000000..df189d2 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/forward_assertions.go @@ -0,0 +1,16 @@ +package assert + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go new file mode 100644 index 0000000..4ed341d --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -0,0 +1,162 @@ +package assert + +import ( + "fmt" + "net/http" + "net/http/httptest" + "net/url" + "strings" +) + +// httpCode is a helper that returns HTTP code of the response. It returns -1 and +// an error if building a new request fails. +func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { + w := httptest.NewRecorder() + req, err := http.NewRequest(method, url, nil) + if err != nil { + return -1, err + } + req.URL.RawQuery = values.Encode() + handler(w, req) + return w.Code, nil +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + code, err := httpCode(handler, method, url, values) + if err != nil { + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + } + + isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent + if !isSuccessCode { + Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code)) + } + + return isSuccessCode +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + code, err := httpCode(handler, method, url, values) + if err != nil { + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + } + + isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect + if !isRedirectCode { + Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code)) + } + + return isRedirectCode +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + code, err := httpCode(handler, method, url, values) + if err != nil { + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + } + + isErrorCode := code >= http.StatusBadRequest + if !isErrorCode { + Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code)) + } + + return isErrorCode +} + +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + code, err := httpCode(handler, method, url, values) + if err != nil { + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + } + + successful := code == statuscode + if !successful { + Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code)) + } + + return successful +} + +// HTTPBody is a helper that returns HTTP body of the response. It returns +// empty string if building a new request fails. +func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { + w := httptest.NewRecorder() + req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if err != nil { + return "" + } + handler(w, req) + return w.Body.String() +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + body := HTTPBody(handler, method, url, values) + + contains := strings.Contains(body, fmt.Sprint(str)) + if !contains { + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + } + + return contains +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + body := HTTPBody(handler, method, url, values) + + contains := strings.Contains(body, fmt.Sprint(str)) + if contains { + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + } + + return !contains +} diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go new file mode 100644 index 0000000..169de39 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/doc.go @@ -0,0 +1,28 @@ +// Package require implements the same assertions as the `assert` package but +// stops test execution when a test fails. +// +// Example Usage +// +// The following is a complete example using require in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/require" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// require.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// Assertions +// +// The `require` package have same global functions as in the `assert` package, +// but instead of returning a boolean result they call `t.FailNow()`. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package require diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go new file mode 100644 index 0000000..1dcb233 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/forward_requirements.go @@ -0,0 +1,16 @@ +package require + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go new file mode 100644 index 0000000..880853f --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -0,0 +1,1935 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND + */ + +package require + +import ( + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Condition(t, comp, msgAndArgs...) { + return + } + t.FailNow() +} + +// Conditionf uses a Comparison to assert a complex condition. +func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Conditionf(t, comp, msg, args...) { + return + } + t.FailNow() +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World") +// assert.Contains(t, ["Hello", "World"], "World") +// assert.Contains(t, {"Hello": "World"}, "Hello") +func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Contains(t, s, contains, msgAndArgs...) { + return + } + t.FailNow() +} + +// Containsf asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") +// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") +// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") +func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Containsf(t, s, contains, msg, args...) { + return + } + t.FailNow() +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func DirExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.DirExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func DirExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.DirExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) +func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ElementsMatch(t, listA, listB, msgAndArgs...) { + return + } + t.FailNow() +} + +// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") +func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ElementsMatchf(t, listA, listB, msg, args...) { + return + } + t.FailNow() +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Empty(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Emptyf(t, obj, "error message %s", "formatted") +func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Emptyf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Equal(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualError(t, err, expectedErrorString) +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualError(t, theError, errString, msgAndArgs...) { + return + } + t.FailNow() +} + +// EqualErrorf asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") +func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualErrorf(t, theError, errString, msg, args...) { + return + } + t.FailNow() +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123)) +func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualValues(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// EqualValuesf asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") +func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualValuesf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Equalf asserts that two objects are equal. +// +// assert.Equalf(t, 123, 123, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Equalf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err) { +// assert.Equal(t, expectedError, err) +// } +func Error(t TestingT, err error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Error(t, err, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorAs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorAsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// ErrorContains asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// assert.ErrorContains(t, err, expectedErrorSubString) +func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorContains(t, theError, contains, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") +func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorContainsf(t, theError, contains, msg, args...) { + return + } + t.FailNow() +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorIs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorIsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// Errorf asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Errorf(t, err, "error message %s", "formatted") { +// assert.Equal(t, expectedErrorf, err) +// } +func Errorf(t TestingT, err error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Errorf(t, err, msg, args...) { + return + } + t.FailNow() +} + +// Eventually asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond) +func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) { + return + } + t.FailNow() +} + +// Eventuallyf asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) { + return + } + t.FailNow() +} + +// Exactly asserts that two objects are equal in value and type. +// +// assert.Exactly(t, int32(123), int64(123)) +func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Exactly(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// Exactlyf asserts that two objects are equal in value and type. +// +// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") +func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Exactlyf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Fail(t, failureMessage, msgAndArgs...) { + return + } + t.FailNow() +} + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FailNow(t, failureMessage, msgAndArgs...) { + return + } + t.FailNow() +} + +// FailNowf fails test +func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FailNowf(t, failureMessage, msg, args...) { + return + } + t.FailNow() +} + +// Failf reports a failure through +func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Failf(t, failureMessage, msg, args...) { + return + } + t.FailNow() +} + +// False asserts that the specified value is false. +// +// assert.False(t, myBool) +func False(t TestingT, value bool, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.False(t, value, msgAndArgs...) { + return + } + t.FailNow() +} + +// Falsef asserts that the specified value is false. +// +// assert.Falsef(t, myBool, "error message %s", "formatted") +func Falsef(t TestingT, value bool, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Falsef(t, value, msg, args...) { + return + } + t.FailNow() +} + +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func FileExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FileExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func FileExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FileExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// Greater asserts that the first element is greater than the second +// +// assert.Greater(t, 2, 1) +// assert.Greater(t, float64(2), float64(1)) +// assert.Greater(t, "b", "a") +func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Greater(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqual(t, 2, 1) +// assert.GreaterOrEqual(t, 2, 2) +// assert.GreaterOrEqual(t, "b", "a") +// assert.GreaterOrEqual(t, "b", "b") +func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// GreaterOrEqualf asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") +// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") +// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") +// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") +func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.GreaterOrEqualf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// Greaterf asserts that the first element is greater than the second +// +// assert.Greaterf(t, 2, 1, "error message %s", "formatted") +// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") +// assert.Greaterf(t, "b", "a", "error message %s", "formatted") +func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Greaterf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPBodyContainsf asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) { + return + } + t.FailNow() +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPBodyNotContainsf asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) { + return + } + t.FailNow() +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPErrorf asserts that a specified handler returns an error status code. +// +// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) { + return + } + t.FailNow() +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPRedirectf asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) { + return + } + t.FailNow() +} + +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) { + return + } + t.FailNow() +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPSuccessf asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) { + return + } + t.FailNow() +} + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Implements(t, interfaceObject, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// Implementsf asserts that an object is implemented by the specified interface. +// +// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Implementsf(t, interfaceObject, object, msg, args...) { + return + } + t.FailNow() +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, 22/7.0, 0.01) +func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDelta(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// InDeltaSlicef is the same as InDelta, except it compares two slices. +func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// InDeltaf asserts that the two numerals are within delta of each other. +// +// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") +func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaf(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { + return + } + t.FailNow() +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) { + return + } + t.FailNow() +} + +// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) { + return + } + t.FailNow() +} + +// InEpsilonf asserts that expected and actual have a relative error less than epsilon +func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) { + return + } + t.FailNow() +} + +// IsDecreasing asserts that the collection is decreasing +// +// assert.IsDecreasing(t, []int{2, 1, 0}) +// assert.IsDecreasing(t, []float{2, 1}) +// assert.IsDecreasing(t, []string{"b", "a"}) +func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsDecreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsDecreasingf asserts that the collection is decreasing +// +// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsDecreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsIncreasing asserts that the collection is increasing +// +// assert.IsIncreasing(t, []int{1, 2, 3}) +// assert.IsIncreasing(t, []float{1, 2}) +// assert.IsIncreasing(t, []string{"a", "b"}) +func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsIncreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsIncreasingf asserts that the collection is increasing +// +// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsIncreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// assert.IsNonDecreasing(t, []int{1, 1, 2}) +// assert.IsNonDecreasing(t, []float{1, 2}) +// assert.IsNonDecreasing(t, []string{"a", "b"}) +func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonDecreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonDecreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// assert.IsNonIncreasing(t, []int{2, 1, 1}) +// assert.IsNonIncreasing(t, []float{2, 1}) +// assert.IsNonIncreasing(t, []string{"b", "a"}) +func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonIncreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonIncreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsType(t, expectedType, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsTypef asserts that the specified objects are of the same type. +func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsTypef(t, expectedType, object, msg, args...) { + return + } + t.FailNow() +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.JSONEq(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// JSONEqf asserts that two JSON strings are equivalent. +// +// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.JSONEqf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3) +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Len(t, object, length, msgAndArgs...) { + return + } + t.FailNow() +} + +// Lenf asserts that the specified object has specific length. +// Lenf also fails if the object has a type that len() not accept. +// +// assert.Lenf(t, mySlice, 3, "error message %s", "formatted") +func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Lenf(t, object, length, msg, args...) { + return + } + t.FailNow() +} + +// Less asserts that the first element is less than the second +// +// assert.Less(t, 1, 2) +// assert.Less(t, float64(1), float64(2)) +// assert.Less(t, "a", "b") +func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Less(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// assert.LessOrEqual(t, 1, 2) +// assert.LessOrEqual(t, 2, 2) +// assert.LessOrEqual(t, "a", "b") +// assert.LessOrEqual(t, "b", "b") +func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.LessOrEqual(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// LessOrEqualf asserts that the first element is less than or equal to the second +// +// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted") +// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted") +// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted") +// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted") +func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.LessOrEqualf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// Lessf asserts that the first element is less than the second +// +// assert.Lessf(t, 1, 2, "error message %s", "formatted") +// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted") +// assert.Lessf(t, "a", "b", "error message %s", "formatted") +func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Lessf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// Negative asserts that the specified element is negative +// +// assert.Negative(t, -1) +// assert.Negative(t, -1.23) +func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Negative(t, e, msgAndArgs...) { + return + } + t.FailNow() +} + +// Negativef asserts that the specified element is negative +// +// assert.Negativef(t, -1, "error message %s", "formatted") +// assert.Negativef(t, -1.23, "error message %s", "formatted") +func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Negativef(t, e, msg, args...) { + return + } + t.FailNow() +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) +func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Never(t, condition, waitFor, tick, msgAndArgs...) { + return + } + t.FailNow() +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Neverf(t, condition, waitFor, tick, msg, args...) { + return + } + t.FailNow() +} + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err) +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Nil(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// Nilf asserts that the specified object is nil. +// +// assert.Nilf(t, err, "error message %s", "formatted") +func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Nilf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoDirExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoDirExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, expectedObj, actualObj) +// } +func NoError(t TestingT, err error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoError(t, err, msgAndArgs...) { + return + } + t.FailNow() +} + +// NoErrorf asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoErrorf(t, err, "error message %s", "formatted") { +// assert.Equal(t, expectedObj, actualObj) +// } +func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoErrorf(t, err, msg, args...) { + return + } + t.FailNow() +} + +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoFileExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoFileExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth") +// assert.NotContains(t, ["Hello", "World"], "Earth") +// assert.NotContains(t, {"Hello": "World"}, "Earth") +func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotContains(t, s, contains, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") +// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") +// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") +func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotContainsf(t, s, contains, msg, args...) { + return + } + t.FailNow() +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEmpty(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmptyf(t, obj, "error message %s", "formatted") { +// assert.Equal(t, "two", obj[1]) +// } +func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEmptyf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqual(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValues(t, obj1, obj2) +func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqualValues(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") +func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqualValuesf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// NotEqualf asserts that the specified values are NOT equal. +// +// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqualf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotErrorIs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotErrorIsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err) +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotNil(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotNilf asserts that the specified object is not nil. +// +// assert.NotNilf(t, err, "error message %s", "formatted") +func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotNilf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ RemainCalm() }) +func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotPanics(t, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") +func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotPanicsf(t, f, msg, args...) { + return + } + t.FailNow() +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotRegexp(t, rx, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotRegexpf asserts that a specified regexp does not match a string. +// +// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") +func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotRegexpf(t, rx, str, msg, args...) { + return + } + t.FailNow() +} + +// NotSame asserts that two pointers do not reference the same object. +// +// assert.NotSame(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSame(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSamef(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// NotSubset asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSubset(t, list, subset, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotSubsetf asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSubsetf(t, list, subset, msg, args...) { + return + } + t.FailNow() +} + +// NotZero asserts that i is not the zero value for its type. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotZero(t, i, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotZerof asserts that i is not the zero value for its type. +func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotZerof(t, i, msg, args...) { + return + } + t.FailNow() +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ GoCrazy() }) +func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Panics(t, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithError(t, errString, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithErrorf(t, errString, f, msg, args...) { + return + } + t.FailNow() +} + +// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithValue(t, expected, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithValuef(t, expected, f, msg, args...) { + return + } + t.FailNow() +} + +// Panicsf asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") +func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Panicsf(t, f, msg, args...) { + return + } + t.FailNow() +} + +// Positive asserts that the specified element is positive +// +// assert.Positive(t, 1) +// assert.Positive(t, 1.23) +func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Positive(t, e, msgAndArgs...) { + return + } + t.FailNow() +} + +// Positivef asserts that the specified element is positive +// +// assert.Positivef(t, 1, "error message %s", "formatted") +// assert.Positivef(t, 1.23, "error message %s", "formatted") +func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Positivef(t, e, msg, args...) { + return + } + t.FailNow() +} + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Regexp(t, rx, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// Regexpf asserts that a specified regexp matches a string. +// +// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") +func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Regexpf(t, rx, str, msg, args...) { + return + } + t.FailNow() +} + +// Same asserts that two pointers reference the same object. +// +// assert.Same(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Same(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// Samef asserts that two pointers reference the same object. +// +// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Samef(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Subset asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Subset(t, list, subset, msgAndArgs...) { + return + } + t.FailNow() +} + +// Subsetf asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Subsetf(t, list, subset, msg, args...) { + return + } + t.FailNow() +} + +// True asserts that the specified value is true. +// +// assert.True(t, myBool) +func True(t TestingT, value bool, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.True(t, value, msgAndArgs...) { + return + } + t.FailNow() +} + +// Truef asserts that the specified value is true. +// +// assert.Truef(t, myBool, "error message %s", "formatted") +func Truef(t TestingT, value bool, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Truef(t, value, msg, args...) { + return + } + t.FailNow() +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) +func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// WithinDurationf asserts that the two times are within duration delta of each other. +// +// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") +func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.WithinDurationf(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// WithinRange asserts that a time is within a time range (inclusive). +// +// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) +func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.WithinRange(t, actual, start, end, msgAndArgs...) { + return + } + t.FailNow() +} + +// WithinRangef asserts that a time is within a time range (inclusive). +// +// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") +func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.WithinRangef(t, actual, start, end, msg, args...) { + return + } + t.FailNow() +} + +// YAMLEq asserts that two YAML strings are equivalent. +func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.YAMLEq(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.YAMLEqf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Zero asserts that i is the zero value for its type. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Zero(t, i, msgAndArgs...) { + return + } + t.FailNow() +} + +// Zerof asserts that i is the zero value for its type. +func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Zerof(t, i, msg, args...) { + return + } + t.FailNow() +} diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl new file mode 100644 index 0000000..55e42dd --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go.tmpl @@ -0,0 +1,6 @@ +{{.Comment}} +func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { + if h, ok := t.(tHelper); ok { h.Helper() } + if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return } + t.FailNow() +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go new file mode 100644 index 0000000..960bf6f --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -0,0 +1,1515 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND + */ + +package require + +import ( + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Condition(a.t, comp, msgAndArgs...) +} + +// Conditionf uses a Comparison to assert a complex condition. +func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Conditionf(a.t, comp, msg, args...) +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World") +// a.Contains(["Hello", "World"], "World") +// a.Contains({"Hello": "World"}, "Hello") +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Contains(a.t, s, contains, msgAndArgs...) +} + +// Containsf asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Containsf("Hello World", "World", "error message %s", "formatted") +// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") +// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") +func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Containsf(a.t, s, contains, msg, args...) +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + DirExists(a.t, path, msgAndArgs...) +} + +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + DirExistsf(a.t, path, msg, args...) +} + +// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) +func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ElementsMatch(a.t, listA, listB, msgAndArgs...) +} + +// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") +func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ElementsMatchf(a.t, listA, listB, msg, args...) +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Empty(a.t, object, msgAndArgs...) +} + +// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Emptyf(obj, "error message %s", "formatted") +func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Emptyf(a.t, object, msg, args...) +} + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Equal(a.t, expected, actual, msgAndArgs...) +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// a.EqualError(err, expectedErrorString) +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualError(a.t, theError, errString, msgAndArgs...) +} + +// EqualErrorf asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") +func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualErrorf(a.t, theError, errString, msg, args...) +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123)) +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualValues(a.t, expected, actual, msgAndArgs...) +} + +// EqualValuesf asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") +func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualValuesf(a.t, expected, actual, msg, args...) +} + +// Equalf asserts that two objects are equal. +// +// a.Equalf(123, 123, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Equalf(a.t, expected, actual, msg, args...) +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err) { +// assert.Equal(t, expectedError, err) +// } +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Error(a.t, err, msgAndArgs...) +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorAs(a.t, err, target, msgAndArgs...) +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorAsf(a.t, err, target, msg, args...) +} + +// ErrorContains asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// a.ErrorContains(err, expectedErrorSubString) +func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorContains(a.t, theError, contains, msgAndArgs...) +} + +// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) +// and that the error contains the specified substring. +// +// actualObj, err := SomeFunction() +// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted") +func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorContainsf(a.t, theError, contains, msg, args...) +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorIs(a.t, err, target, msgAndArgs...) +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorIsf(a.t, err, target, msg, args...) +} + +// Errorf asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Errorf(err, "error message %s", "formatted") { +// assert.Equal(t, expectedErrorf, err) +// } +func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Errorf(a.t, err, msg, args...) +} + +// Eventually asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Eventually(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Eventuallyf asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Eventuallyf(a.t, condition, waitFor, tick, msg, args...) +} + +// Exactly asserts that two objects are equal in value and type. +// +// a.Exactly(int32(123), int64(123)) +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Exactly(a.t, expected, actual, msgAndArgs...) +} + +// Exactlyf asserts that two objects are equal in value and type. +// +// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") +func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Exactlyf(a.t, expected, actual, msg, args...) +} + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Fail(a.t, failureMessage, msgAndArgs...) +} + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FailNow(a.t, failureMessage, msgAndArgs...) +} + +// FailNowf fails test +func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FailNowf(a.t, failureMessage, msg, args...) +} + +// Failf reports a failure through +func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Failf(a.t, failureMessage, msg, args...) +} + +// False asserts that the specified value is false. +// +// a.False(myBool) +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + False(a.t, value, msgAndArgs...) +} + +// Falsef asserts that the specified value is false. +// +// a.Falsef(myBool, "error message %s", "formatted") +func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Falsef(a.t, value, msg, args...) +} + +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FileExists(a.t, path, msgAndArgs...) +} + +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FileExistsf(a.t, path, msg, args...) +} + +// Greater asserts that the first element is greater than the second +// +// a.Greater(2, 1) +// a.Greater(float64(2), float64(1)) +// a.Greater("b", "a") +func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Greater(a.t, e1, e2, msgAndArgs...) +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// a.GreaterOrEqual(2, 1) +// a.GreaterOrEqual(2, 2) +// a.GreaterOrEqual("b", "a") +// a.GreaterOrEqual("b", "b") +func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + GreaterOrEqual(a.t, e1, e2, msgAndArgs...) +} + +// GreaterOrEqualf asserts that the first element is greater than or equal to the second +// +// a.GreaterOrEqualf(2, 1, "error message %s", "formatted") +// a.GreaterOrEqualf(2, 2, "error message %s", "formatted") +// a.GreaterOrEqualf("b", "a", "error message %s", "formatted") +// a.GreaterOrEqualf("b", "b", "error message %s", "formatted") +func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + GreaterOrEqualf(a.t, e1, e2, msg, args...) +} + +// Greaterf asserts that the first element is greater than the second +// +// a.Greaterf(2, 1, "error message %s", "formatted") +// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") +// a.Greaterf("b", "a", "error message %s", "formatted") +func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Greaterf(a.t, e1, e2, msg, args...) +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) +} + +// HTTPBodyContainsf asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) +} + +// HTTPBodyNotContainsf asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPError(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPErrorf asserts that a specified handler returns an error status code. +// +// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPErrorf(a.t, handler, method, url, values, msg, args...) +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPRedirectf asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPRedirectf(a.t, handler, method, url, values, msg, args...) +} + +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPSuccessf asserts that a specified handler returns a success status code. +// +// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPSuccessf(a.t, handler, method, url, values, msg, args...) +} + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject)) +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Implements(a.t, interfaceObject, object, msgAndArgs...) +} + +// Implementsf asserts that an object is implemented by the specified interface. +// +// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Implementsf(a.t, interfaceObject, object, msg, args...) +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, 22/7.0, 0.01) +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaSlicef is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaSlicef(a.t, expected, actual, delta, msg, args...) +} + +// InDeltaf asserts that the two numerals are within delta of each other. +// +// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") +func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaf(a.t, expected, actual, delta, msg, args...) +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) +} + +// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. +func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) +} + +// InEpsilonf asserts that expected and actual have a relative error less than epsilon +func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilonf(a.t, expected, actual, epsilon, msg, args...) +} + +// IsDecreasing asserts that the collection is decreasing +// +// a.IsDecreasing([]int{2, 1, 0}) +// a.IsDecreasing([]float{2, 1}) +// a.IsDecreasing([]string{"b", "a"}) +func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsDecreasing(a.t, object, msgAndArgs...) +} + +// IsDecreasingf asserts that the collection is decreasing +// +// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") +// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsDecreasingf(a.t, object, msg, args...) +} + +// IsIncreasing asserts that the collection is increasing +// +// a.IsIncreasing([]int{1, 2, 3}) +// a.IsIncreasing([]float{1, 2}) +// a.IsIncreasing([]string{"a", "b"}) +func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsIncreasing(a.t, object, msgAndArgs...) +} + +// IsIncreasingf asserts that the collection is increasing +// +// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") +// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsIncreasingf(a.t, object, msg, args...) +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// a.IsNonDecreasing([]int{1, 1, 2}) +// a.IsNonDecreasing([]float{1, 2}) +// a.IsNonDecreasing([]string{"a", "b"}) +func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonDecreasing(a.t, object, msgAndArgs...) +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonDecreasingf(a.t, object, msg, args...) +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// a.IsNonIncreasing([]int{2, 1, 1}) +// a.IsNonIncreasing([]float{2, 1}) +// a.IsNonIncreasing([]string{"b", "a"}) +func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonIncreasing(a.t, object, msgAndArgs...) +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonIncreasingf(a.t, object, msg, args...) +} + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsType(a.t, expectedType, object, msgAndArgs...) +} + +// IsTypef asserts that the specified objects are of the same type. +func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsTypef(a.t, expectedType, object, msg, args...) +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + JSONEq(a.t, expected, actual, msgAndArgs...) +} + +// JSONEqf asserts that two JSON strings are equivalent. +// +// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + JSONEqf(a.t, expected, actual, msg, args...) +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3) +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Len(a.t, object, length, msgAndArgs...) +} + +// Lenf asserts that the specified object has specific length. +// Lenf also fails if the object has a type that len() not accept. +// +// a.Lenf(mySlice, 3, "error message %s", "formatted") +func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Lenf(a.t, object, length, msg, args...) +} + +// Less asserts that the first element is less than the second +// +// a.Less(1, 2) +// a.Less(float64(1), float64(2)) +// a.Less("a", "b") +func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Less(a.t, e1, e2, msgAndArgs...) +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// a.LessOrEqual(1, 2) +// a.LessOrEqual(2, 2) +// a.LessOrEqual("a", "b") +// a.LessOrEqual("b", "b") +func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + LessOrEqual(a.t, e1, e2, msgAndArgs...) +} + +// LessOrEqualf asserts that the first element is less than or equal to the second +// +// a.LessOrEqualf(1, 2, "error message %s", "formatted") +// a.LessOrEqualf(2, 2, "error message %s", "formatted") +// a.LessOrEqualf("a", "b", "error message %s", "formatted") +// a.LessOrEqualf("b", "b", "error message %s", "formatted") +func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + LessOrEqualf(a.t, e1, e2, msg, args...) +} + +// Lessf asserts that the first element is less than the second +// +// a.Lessf(1, 2, "error message %s", "formatted") +// a.Lessf(float64(1), float64(2), "error message %s", "formatted") +// a.Lessf("a", "b", "error message %s", "formatted") +func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Lessf(a.t, e1, e2, msg, args...) +} + +// Negative asserts that the specified element is negative +// +// a.Negative(-1) +// a.Negative(-1.23) +func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Negative(a.t, e, msgAndArgs...) +} + +// Negativef asserts that the specified element is negative +// +// a.Negativef(-1, "error message %s", "formatted") +// a.Negativef(-1.23, "error message %s", "formatted") +func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Negativef(a.t, e, msg, args...) +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Never(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Neverf(a.t, condition, waitFor, tick, msg, args...) +} + +// Nil asserts that the specified object is nil. +// +// a.Nil(err) +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Nil(a.t, object, msgAndArgs...) +} + +// Nilf asserts that the specified object is nil. +// +// a.Nilf(err, "error message %s", "formatted") +func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Nilf(a.t, object, msg, args...) +} + +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoDirExists(a.t, path, msgAndArgs...) +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoDirExistsf(a.t, path, msg, args...) +} + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, expectedObj, actualObj) +// } +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoError(a.t, err, msgAndArgs...) +} + +// NoErrorf asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoErrorf(err, "error message %s", "formatted") { +// assert.Equal(t, expectedObj, actualObj) +// } +func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoErrorf(a.t, err, msg, args...) +} + +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoFileExists(a.t, path, msgAndArgs...) +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoFileExistsf(a.t, path, msg, args...) +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth") +// a.NotContains(["Hello", "World"], "Earth") +// a.NotContains({"Hello": "World"}, "Earth") +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotContains(a.t, s, contains, msgAndArgs...) +} + +// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") +// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") +// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") +func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotContainsf(a.t, s, contains, msg, args...) +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEmpty(a.t, object, msgAndArgs...) +} + +// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmptyf(obj, "error message %s", "formatted") { +// assert.Equal(t, "two", obj[1]) +// } +func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEmptyf(a.t, object, msg, args...) +} + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqual(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValues(obj1, obj2) +func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqualValues(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") +func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqualValuesf(a.t, expected, actual, msg, args...) +} + +// NotEqualf asserts that the specified values are NOT equal. +// +// a.NotEqualf(obj1, obj2, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqualf(a.t, expected, actual, msg, args...) +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotErrorIs(a.t, err, target, msgAndArgs...) +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotErrorIsf(a.t, err, target, msg, args...) +} + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err) +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotNil(a.t, object, msgAndArgs...) +} + +// NotNilf asserts that the specified object is not nil. +// +// a.NotNilf(err, "error message %s", "formatted") +func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotNilf(a.t, object, msg, args...) +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ RemainCalm() }) +func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotPanics(a.t, f, msgAndArgs...) +} + +// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") +func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotPanicsf(a.t, f, msg, args...) +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotRegexp(a.t, rx, str, msgAndArgs...) +} + +// NotRegexpf asserts that a specified regexp does not match a string. +// +// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") +func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotRegexpf(a.t, rx, str, msg, args...) +} + +// NotSame asserts that two pointers do not reference the same object. +// +// a.NotSame(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSame(a.t, expected, actual, msgAndArgs...) +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSamef(a.t, expected, actual, msg, args...) +} + +// NotSubset asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSubset(a.t, list, subset, msgAndArgs...) +} + +// NotSubsetf asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSubsetf(a.t, list, subset, msg, args...) +} + +// NotZero asserts that i is not the zero value for its type. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotZero(a.t, i, msgAndArgs...) +} + +// NotZerof asserts that i is not the zero value for its type. +func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotZerof(a.t, i, msg, args...) +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ GoCrazy() }) +func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Panics(a.t, f, msgAndArgs...) +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithError("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithError(a.t, errString, f, msgAndArgs...) +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithErrorf(a.t, errString, f, msg, args...) +} + +// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithValue(a.t, expected, f, msgAndArgs...) +} + +// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithValuef(a.t, expected, f, msg, args...) +} + +// Panicsf asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Panicsf(a.t, f, msg, args...) +} + +// Positive asserts that the specified element is positive +// +// a.Positive(1) +// a.Positive(1.23) +func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Positive(a.t, e, msgAndArgs...) +} + +// Positivef asserts that the specified element is positive +// +// a.Positivef(1, "error message %s", "formatted") +// a.Positivef(1.23, "error message %s", "formatted") +func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Positivef(a.t, e, msg, args...) +} + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Regexp(a.t, rx, str, msgAndArgs...) +} + +// Regexpf asserts that a specified regexp matches a string. +// +// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") +func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Regexpf(a.t, rx, str, msg, args...) +} + +// Same asserts that two pointers reference the same object. +// +// a.Same(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Same(a.t, expected, actual, msgAndArgs...) +} + +// Samef asserts that two pointers reference the same object. +// +// a.Samef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Samef(a.t, expected, actual, msg, args...) +} + +// Subset asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Subset(a.t, list, subset, msgAndArgs...) +} + +// Subsetf asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Subsetf(a.t, list, subset, msg, args...) +} + +// True asserts that the specified value is true. +// +// a.True(myBool) +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + True(a.t, value, msgAndArgs...) +} + +// Truef asserts that the specified value is true. +// +// a.Truef(myBool, "error message %s", "formatted") +func (a *Assertions) Truef(value bool, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Truef(a.t, value, msg, args...) +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + +// WithinDurationf asserts that the two times are within duration delta of each other. +// +// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") +func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + WithinDurationf(a.t, expected, actual, delta, msg, args...) +} + +// WithinRange asserts that a time is within a time range (inclusive). +// +// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) +func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + WithinRange(a.t, actual, start, end, msgAndArgs...) +} + +// WithinRangef asserts that a time is within a time range (inclusive). +// +// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") +func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + WithinRangef(a.t, actual, start, end, msg, args...) +} + +// YAMLEq asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + YAMLEq(a.t, expected, actual, msgAndArgs...) +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + YAMLEqf(a.t, expected, actual, msg, args...) +} + +// Zero asserts that i is the zero value for its type. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Zero(a.t, i, msgAndArgs...) +} + +// Zerof asserts that i is the zero value for its type. +func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Zerof(a.t, i, msg, args...) +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl new file mode 100644 index 0000000..54124df --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl @@ -0,0 +1,5 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { + if h, ok := a.t.(tHelper); ok { h.Helper() } + {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go new file mode 100644 index 0000000..91772df --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -0,0 +1,29 @@ +package require + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) + FailNow() +} + +type tHelper interface { + Helper() +} + +// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful +// for table driven tests. +type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) + +// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful +// for table driven tests. +type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) + +// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful +// for table driven tests. +type BoolAssertionFunc func(TestingT, bool, ...interface{}) + +// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful +// for table driven tests. +type ErrorAssertionFunc func(TestingT, error, ...interface{}) + +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/suite/doc.go b/vendor/github.com/stretchr/testify/suite/doc.go new file mode 100644 index 0000000..f91a245 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/doc.go @@ -0,0 +1,65 @@ +// Package suite contains logic for creating testing suite structs +// and running the methods on those structs as tests. The most useful +// piece of this package is that you can create setup/teardown methods +// on your testing suites, which will run before/after the whole suite +// or individual tests (depending on which interface(s) you +// implement). +// +// A testing suite is usually built by first extending the built-in +// suite functionality from suite.Suite in testify. Alternatively, +// you could reproduce that logic on your own if you wanted (you +// just need to implement the TestingSuite interface from +// suite/interfaces.go). +// +// After that, you can implement any of the interfaces in +// suite/interfaces.go to add setup/teardown functionality to your +// suite, and add any methods that start with "Test" to add tests. +// Methods that do not match any suite interfaces and do not begin +// with "Test" will not be run by testify, and can safely be used as +// helper methods. +// +// Once you've built your testing suite, you need to run the suite +// (using suite.Run from testify) inside any function that matches the +// identity that "go test" is already looking for (i.e. +// func(*testing.T)). +// +// Regular expression to select test suites specified command-line +// argument "-run". Regular expression to select the methods +// of test suites specified command-line argument "-m". +// Suite object has assertion methods. +// +// A crude example: +// // Basic imports +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// "github.com/stretchr/testify/suite" +// ) +// +// // Define the suite, and absorb the built-in basic suite +// // functionality from testify - including a T() method which +// // returns the current testing context +// type ExampleTestSuite struct { +// suite.Suite +// VariableThatShouldStartAtFive int +// } +// +// // Make sure that VariableThatShouldStartAtFive is set to five +// // before each test +// func (suite *ExampleTestSuite) SetupTest() { +// suite.VariableThatShouldStartAtFive = 5 +// } +// +// // All methods that begin with "Test" are run as tests within a +// // suite. +// func (suite *ExampleTestSuite) TestExample() { +// assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive) +// suite.Equal(5, suite.VariableThatShouldStartAtFive) +// } +// +// // In order for 'go test' to run this suite, we need to create +// // a normal test function and pass our suite to suite.Run +// func TestExampleTestSuite(t *testing.T) { +// suite.Run(t, new(ExampleTestSuite)) +// } +package suite diff --git a/vendor/github.com/stretchr/testify/suite/interfaces.go b/vendor/github.com/stretchr/testify/suite/interfaces.go new file mode 100644 index 0000000..fed037d --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/interfaces.go @@ -0,0 +1,66 @@ +package suite + +import "testing" + +// TestingSuite can store and return the current *testing.T context +// generated by 'go test'. +type TestingSuite interface { + T() *testing.T + SetT(*testing.T) + SetS(suite TestingSuite) +} + +// SetupAllSuite has a SetupSuite method, which will run before the +// tests in the suite are run. +type SetupAllSuite interface { + SetupSuite() +} + +// SetupTestSuite has a SetupTest method, which will run before each +// test in the suite. +type SetupTestSuite interface { + SetupTest() +} + +// TearDownAllSuite has a TearDownSuite method, which will run after +// all the tests in the suite have been run. +type TearDownAllSuite interface { + TearDownSuite() +} + +// TearDownTestSuite has a TearDownTest method, which will run after +// each test in the suite. +type TearDownTestSuite interface { + TearDownTest() +} + +// BeforeTest has a function to be executed right before the test +// starts and receives the suite and test names as input +type BeforeTest interface { + BeforeTest(suiteName, testName string) +} + +// AfterTest has a function to be executed right after the test +// finishes and receives the suite and test names as input +type AfterTest interface { + AfterTest(suiteName, testName string) +} + +// WithStats implements HandleStats, a function that will be executed +// when a test suite is finished. The stats contain information about +// the execution of that suite and its tests. +type WithStats interface { + HandleStats(suiteName string, stats *SuiteInformation) +} + +// SetupSubTest has a SetupSubTest method, which will run before each +// subtest in the suite. +type SetupSubTest interface { + SetupSubTest() +} + +// TearDownSubTest has a TearDownSubTest method, which will run after +// each subtest in the suite have been run. +type TearDownSubTest interface { + TearDownSubTest() +} diff --git a/vendor/github.com/stretchr/testify/suite/stats.go b/vendor/github.com/stretchr/testify/suite/stats.go new file mode 100644 index 0000000..261da37 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/stats.go @@ -0,0 +1,46 @@ +package suite + +import "time" + +// SuiteInformation stats stores stats for the whole suite execution. +type SuiteInformation struct { + Start, End time.Time + TestStats map[string]*TestInformation +} + +// TestInformation stores information about the execution of each test. +type TestInformation struct { + TestName string + Start, End time.Time + Passed bool +} + +func newSuiteInformation() *SuiteInformation { + testStats := make(map[string]*TestInformation) + + return &SuiteInformation{ + TestStats: testStats, + } +} + +func (s SuiteInformation) start(testName string) { + s.TestStats[testName] = &TestInformation{ + TestName: testName, + Start: time.Now(), + } +} + +func (s SuiteInformation) end(testName string, passed bool) { + s.TestStats[testName].End = time.Now() + s.TestStats[testName].Passed = passed +} + +func (s SuiteInformation) Passed() bool { + for _, stats := range s.TestStats { + if !stats.Passed { + return false + } + } + + return true +} diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go new file mode 100644 index 0000000..8b4202d --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -0,0 +1,248 @@ +package suite + +import ( + "flag" + "fmt" + "os" + "reflect" + "regexp" + "runtime/debug" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var allTestsFilter = func(_, _ string) (bool, error) { return true, nil } +var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run") + +// Suite is a basic testing suite with methods for storing and +// retrieving the current *testing.T context. +type Suite struct { + *assert.Assertions + + mu sync.RWMutex + require *require.Assertions + t *testing.T + + // Parent suite to have access to the implemented methods of parent struct + s TestingSuite +} + +// T retrieves the current *testing.T context. +func (suite *Suite) T() *testing.T { + suite.mu.RLock() + defer suite.mu.RUnlock() + return suite.t +} + +// SetT sets the current *testing.T context. +func (suite *Suite) SetT(t *testing.T) { + suite.mu.Lock() + defer suite.mu.Unlock() + suite.t = t + suite.Assertions = assert.New(t) + suite.require = require.New(t) +} + +// SetS needs to set the current test suite as parent +// to get access to the parent methods +func (suite *Suite) SetS(s TestingSuite) { + suite.s = s +} + +// Require returns a require context for suite. +func (suite *Suite) Require() *require.Assertions { + suite.mu.Lock() + defer suite.mu.Unlock() + if suite.require == nil { + suite.require = require.New(suite.T()) + } + return suite.require +} + +// Assert returns an assert context for suite. Normally, you can call +// `suite.NoError(expected, actual)`, but for situations where the embedded +// methods are overridden (for example, you might want to override +// assert.Assertions with require.Assertions), this method is provided so you +// can call `suite.Assert().NoError()`. +func (suite *Suite) Assert() *assert.Assertions { + suite.mu.Lock() + defer suite.mu.Unlock() + if suite.Assertions == nil { + suite.Assertions = assert.New(suite.T()) + } + return suite.Assertions +} + +func recoverAndFailOnPanic(t *testing.T) { + r := recover() + failOnPanic(t, r) +} + +func failOnPanic(t *testing.T, r interface{}) { + if r != nil { + t.Errorf("test panicked: %v\n%s", r, debug.Stack()) + t.FailNow() + } +} + +// Run provides suite functionality around golang subtests. It should be +// called in place of t.Run(name, func(t *testing.T)) in test suite code. +// The passed-in func will be executed as a subtest with a fresh instance of t. +// Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName. +func (suite *Suite) Run(name string, subtest func()) bool { + oldT := suite.T() + + if setupSubTest, ok := suite.s.(SetupSubTest); ok { + setupSubTest.SetupSubTest() + } + + defer func() { + suite.SetT(oldT) + if tearDownSubTest, ok := suite.s.(TearDownSubTest); ok { + tearDownSubTest.TearDownSubTest() + } + }() + + return oldT.Run(name, func(t *testing.T) { + suite.SetT(t) + subtest() + }) +} + +// Run takes a testing suite and runs all of the tests attached +// to it. +func Run(t *testing.T, suite TestingSuite) { + defer recoverAndFailOnPanic(t) + + suite.SetT(t) + suite.SetS(suite) + + var suiteSetupDone bool + + var stats *SuiteInformation + if _, ok := suite.(WithStats); ok { + stats = newSuiteInformation() + } + + tests := []testing.InternalTest{} + methodFinder := reflect.TypeOf(suite) + suiteName := methodFinder.Elem().Name() + + for i := 0; i < methodFinder.NumMethod(); i++ { + method := methodFinder.Method(i) + + ok, err := methodFilter(method.Name) + if err != nil { + fmt.Fprintf(os.Stderr, "testify: invalid regexp for -m: %s\n", err) + os.Exit(1) + } + + if !ok { + continue + } + + if !suiteSetupDone { + if stats != nil { + stats.Start = time.Now() + } + + if setupAllSuite, ok := suite.(SetupAllSuite); ok { + setupAllSuite.SetupSuite() + } + + suiteSetupDone = true + } + + test := testing.InternalTest{ + Name: method.Name, + F: func(t *testing.T) { + parentT := suite.T() + suite.SetT(t) + defer recoverAndFailOnPanic(t) + defer func() { + r := recover() + + if stats != nil { + passed := !t.Failed() && r == nil + stats.end(method.Name, passed) + } + + if afterTestSuite, ok := suite.(AfterTest); ok { + afterTestSuite.AfterTest(suiteName, method.Name) + } + + if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok { + tearDownTestSuite.TearDownTest() + } + + suite.SetT(parentT) + failOnPanic(t, r) + }() + + if setupTestSuite, ok := suite.(SetupTestSuite); ok { + setupTestSuite.SetupTest() + } + if beforeTestSuite, ok := suite.(BeforeTest); ok { + beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name) + } + + if stats != nil { + stats.start(method.Name) + } + + method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) + }, + } + tests = append(tests, test) + } + if suiteSetupDone { + defer func() { + if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok { + tearDownAllSuite.TearDownSuite() + } + + if suiteWithStats, measureStats := suite.(WithStats); measureStats { + stats.End = time.Now() + suiteWithStats.HandleStats(suiteName, stats) + } + }() + } + + runTests(t, tests) +} + +// Filtering method according to set regular expression +// specified command-line argument -m +func methodFilter(name string) (bool, error) { + if ok, _ := regexp.MatchString("^Test", name); !ok { + return false, nil + } + return regexp.MatchString(*matchMethod, name) +} + +func runTests(t testing.TB, tests []testing.InternalTest) { + if len(tests) == 0 { + t.Log("warning: no tests to run") + return + } + + r, ok := t.(runner) + if !ok { // backwards compatibility with Go 1.6 and below + if !testing.RunTests(allTestsFilter, tests) { + t.Fail() + } + return + } + + for _, test := range tests { + r.Run(test.Name, test.F) + } +} + +type runner interface { + Run(name string, f func(t *testing.T)) bool +} diff --git a/vendor/gopkg.in/yaml.v3/LICENSE b/vendor/gopkg.in/yaml.v3/LICENSE new file mode 100644 index 0000000..2683e4b --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/LICENSE @@ -0,0 +1,50 @@ + +This project is covered by two different licenses: MIT and Apache. + +#### MIT License #### + +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original MIT license, with the additional +copyright staring in 2011 when the project was ported over: + + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go + +Copyright (c) 2006-2010 Kirill Simonov +Copyright (c) 2006-2011 Kirill Simonov + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +### Apache License ### + +All the remaining project files are covered by the Apache license: + +Copyright (c) 2011-2019 Canonical Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/gopkg.in/yaml.v3/NOTICE b/vendor/gopkg.in/yaml.v3/NOTICE new file mode 100644 index 0000000..866d74a --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/NOTICE @@ -0,0 +1,13 @@ +Copyright 2011-2016 Canonical Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/gopkg.in/yaml.v3/README.md b/vendor/gopkg.in/yaml.v3/README.md new file mode 100644 index 0000000..08eb1ba --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/README.md @@ -0,0 +1,150 @@ +# YAML support for the Go language + +Introduction +------------ + +The yaml package enables Go programs to comfortably encode and decode YAML +values. It was developed within [Canonical](https://www.canonical.com) as +part of the [juju](https://juju.ubuntu.com) project, and is based on a +pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) +C library to parse and generate YAML data quickly and reliably. + +Compatibility +------------- + +The yaml package supports most of YAML 1.2, but preserves some behavior +from 1.1 for backwards compatibility. + +Specifically, as of v3 of the yaml package: + + - YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being + decoded into a typed bool value. Otherwise they behave as a string. Booleans + in YAML 1.2 are _true/false_ only. + - Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_ + as specified in YAML 1.2, because most parsers still use the old format. + Octals in the _0o777_ format are supported though, so new files work. + - Does not support base-60 floats. These are gone from YAML 1.2, and were + actually never supported by this package as it's clearly a poor choice. + +and offers backwards +compatibility with YAML 1.1 in some cases. +1.2, including support for +anchors, tags, map merging, etc. Multi-document unmarshalling is not yet +implemented, and base-60 floats from YAML 1.1 are purposefully not +supported since they're a poor design and are gone in YAML 1.2. + +Installation and usage +---------------------- + +The import path for the package is *gopkg.in/yaml.v3*. + +To install it, run: + + go get gopkg.in/yaml.v3 + +API documentation +----------------- + +If opened in a browser, the import path itself leads to the API documentation: + + - [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) + +API stability +------------- + +The package API for yaml v3 will remain stable as described in [gopkg.in](https://gopkg.in). + + +License +------- + +The yaml package is licensed under the MIT and Apache License 2.0 licenses. +Please see the LICENSE file for details. + + +Example +------- + +```Go +package main + +import ( + "fmt" + "log" + + "gopkg.in/yaml.v3" +) + +var data = ` +a: Easy! +b: + c: 2 + d: [3, 4] +` + +// Note: struct fields must be public in order for unmarshal to +// correctly populate the data. +type T struct { + A string + B struct { + RenamedC int `yaml:"c"` + D []int `yaml:",flow"` + } +} + +func main() { + t := T{} + + err := yaml.Unmarshal([]byte(data), &t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t:\n%v\n\n", t) + + d, err := yaml.Marshal(&t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t dump:\n%s\n\n", string(d)) + + m := make(map[interface{}]interface{}) + + err = yaml.Unmarshal([]byte(data), &m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m:\n%v\n\n", m) + + d, err = yaml.Marshal(&m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m dump:\n%s\n\n", string(d)) +} +``` + +This example will generate the following output: + +``` +--- t: +{Easy! {2 [3 4]}} + +--- t dump: +a: Easy! +b: + c: 2 + d: [3, 4] + + +--- m: +map[a:Easy! b:map[c:2 d:[3 4]]] + +--- m dump: +a: Easy! +b: + c: 2 + d: + - 3 + - 4 +``` + diff --git a/vendor/gopkg.in/yaml.v3/apic.go b/vendor/gopkg.in/yaml.v3/apic.go new file mode 100644 index 0000000..ae7d049 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/apic.go @@ -0,0 +1,747 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +import ( + "io" +) + +func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { + //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) + + // Check if we can move the queue at the beginning of the buffer. + if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { + if parser.tokens_head != len(parser.tokens) { + copy(parser.tokens, parser.tokens[parser.tokens_head:]) + } + parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] + parser.tokens_head = 0 + } + parser.tokens = append(parser.tokens, *token) + if pos < 0 { + return + } + copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) + parser.tokens[parser.tokens_head+pos] = *token +} + +// Create a new parser object. +func yaml_parser_initialize(parser *yaml_parser_t) bool { + *parser = yaml_parser_t{ + raw_buffer: make([]byte, 0, input_raw_buffer_size), + buffer: make([]byte, 0, input_buffer_size), + } + return true +} + +// Destroy a parser object. +func yaml_parser_delete(parser *yaml_parser_t) { + *parser = yaml_parser_t{} +} + +// String read handler. +func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + if parser.input_pos == len(parser.input) { + return 0, io.EOF + } + n = copy(buffer, parser.input[parser.input_pos:]) + parser.input_pos += n + return n, nil +} + +// Reader read handler. +func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + return parser.input_reader.Read(buffer) +} + +// Set a string input. +func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_string_read_handler + parser.input = input + parser.input_pos = 0 +} + +// Set a file input. +func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_reader_read_handler + parser.input_reader = r +} + +// Set the source encoding. +func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { + if parser.encoding != yaml_ANY_ENCODING { + panic("must set the encoding only once") + } + parser.encoding = encoding +} + +// Create a new emitter object. +func yaml_emitter_initialize(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{ + buffer: make([]byte, output_buffer_size), + raw_buffer: make([]byte, 0, output_raw_buffer_size), + states: make([]yaml_emitter_state_t, 0, initial_stack_size), + events: make([]yaml_event_t, 0, initial_queue_size), + best_width: -1, + } +} + +// Destroy an emitter object. +func yaml_emitter_delete(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{} +} + +// String write handler. +func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + *emitter.output_buffer = append(*emitter.output_buffer, buffer...) + return nil +} + +// yaml_writer_write_handler uses emitter.output_writer to write the +// emitted text. +func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + _, err := emitter.output_writer.Write(buffer) + return err +} + +// Set a string output. +func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_string_write_handler + emitter.output_buffer = output_buffer +} + +// Set a file output. +func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_writer_write_handler + emitter.output_writer = w +} + +// Set the output encoding. +func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { + if emitter.encoding != yaml_ANY_ENCODING { + panic("must set the output encoding only once") + } + emitter.encoding = encoding +} + +// Set the canonical output style. +func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { + emitter.canonical = canonical +} + +// Set the indentation increment. +func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { + if indent < 2 || indent > 9 { + indent = 2 + } + emitter.best_indent = indent +} + +// Set the preferred line width. +func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { + if width < 0 { + width = -1 + } + emitter.best_width = width +} + +// Set if unescaped non-ASCII characters are allowed. +func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { + emitter.unicode = unicode +} + +// Set the preferred line break character. +func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { + emitter.line_break = line_break +} + +///* +// * Destroy a token object. +// */ +// +//YAML_DECLARE(void) +//yaml_token_delete(yaml_token_t *token) +//{ +// assert(token); // Non-NULL token object expected. +// +// switch (token.type) +// { +// case YAML_TAG_DIRECTIVE_TOKEN: +// yaml_free(token.data.tag_directive.handle); +// yaml_free(token.data.tag_directive.prefix); +// break; +// +// case YAML_ALIAS_TOKEN: +// yaml_free(token.data.alias.value); +// break; +// +// case YAML_ANCHOR_TOKEN: +// yaml_free(token.data.anchor.value); +// break; +// +// case YAML_TAG_TOKEN: +// yaml_free(token.data.tag.handle); +// yaml_free(token.data.tag.suffix); +// break; +// +// case YAML_SCALAR_TOKEN: +// yaml_free(token.data.scalar.value); +// break; +// +// default: +// break; +// } +// +// memset(token, 0, sizeof(yaml_token_t)); +//} +// +///* +// * Check if a string is a valid UTF-8 sequence. +// * +// * Check 'reader.c' for more details on UTF-8 encoding. +// */ +// +//static int +//yaml_check_utf8(yaml_char_t *start, size_t length) +//{ +// yaml_char_t *end = start+length; +// yaml_char_t *pointer = start; +// +// while (pointer < end) { +// unsigned char octet; +// unsigned int width; +// unsigned int value; +// size_t k; +// +// octet = pointer[0]; +// width = (octet & 0x80) == 0x00 ? 1 : +// (octet & 0xE0) == 0xC0 ? 2 : +// (octet & 0xF0) == 0xE0 ? 3 : +// (octet & 0xF8) == 0xF0 ? 4 : 0; +// value = (octet & 0x80) == 0x00 ? octet & 0x7F : +// (octet & 0xE0) == 0xC0 ? octet & 0x1F : +// (octet & 0xF0) == 0xE0 ? octet & 0x0F : +// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; +// if (!width) return 0; +// if (pointer+width > end) return 0; +// for (k = 1; k < width; k ++) { +// octet = pointer[k]; +// if ((octet & 0xC0) != 0x80) return 0; +// value = (value << 6) + (octet & 0x3F); +// } +// if (!((width == 1) || +// (width == 2 && value >= 0x80) || +// (width == 3 && value >= 0x800) || +// (width == 4 && value >= 0x10000))) return 0; +// +// pointer += width; +// } +// +// return 1; +//} +// + +// Create STREAM-START. +func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + encoding: encoding, + } +} + +// Create STREAM-END. +func yaml_stream_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + } +} + +// Create DOCUMENT-START. +func yaml_document_start_event_initialize( + event *yaml_event_t, + version_directive *yaml_version_directive_t, + tag_directives []yaml_tag_directive_t, + implicit bool, +) { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: implicit, + } +} + +// Create DOCUMENT-END. +func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + implicit: implicit, + } +} + +// Create ALIAS. +func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) bool { + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + anchor: anchor, + } + return true +} + +// Create SCALAR. +func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + anchor: anchor, + tag: tag, + value: value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-START. +func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-END. +func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + } + return true +} + +// Create MAPPING-START. +func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } +} + +// Create MAPPING-END. +func yaml_mapping_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + } +} + +// Destroy an event object. +func yaml_event_delete(event *yaml_event_t) { + *event = yaml_event_t{} +} + +///* +// * Create a document object. +// */ +// +//YAML_DECLARE(int) +//yaml_document_initialize(document *yaml_document_t, +// version_directive *yaml_version_directive_t, +// tag_directives_start *yaml_tag_directive_t, +// tag_directives_end *yaml_tag_directive_t, +// start_implicit int, end_implicit int) +//{ +// struct { +// error yaml_error_type_t +// } context +// struct { +// start *yaml_node_t +// end *yaml_node_t +// top *yaml_node_t +// } nodes = { NULL, NULL, NULL } +// version_directive_copy *yaml_version_directive_t = NULL +// struct { +// start *yaml_tag_directive_t +// end *yaml_tag_directive_t +// top *yaml_tag_directive_t +// } tag_directives_copy = { NULL, NULL, NULL } +// value yaml_tag_directive_t = { NULL, NULL } +// mark yaml_mark_t = { 0, 0, 0 } +// +// assert(document) // Non-NULL document object is expected. +// assert((tag_directives_start && tag_directives_end) || +// (tag_directives_start == tag_directives_end)) +// // Valid tag directives are expected. +// +// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error +// +// if (version_directive) { +// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) +// if (!version_directive_copy) goto error +// version_directive_copy.major = version_directive.major +// version_directive_copy.minor = version_directive.minor +// } +// +// if (tag_directives_start != tag_directives_end) { +// tag_directive *yaml_tag_directive_t +// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) +// goto error +// for (tag_directive = tag_directives_start +// tag_directive != tag_directives_end; tag_directive ++) { +// assert(tag_directive.handle) +// assert(tag_directive.prefix) +// if (!yaml_check_utf8(tag_directive.handle, +// strlen((char *)tag_directive.handle))) +// goto error +// if (!yaml_check_utf8(tag_directive.prefix, +// strlen((char *)tag_directive.prefix))) +// goto error +// value.handle = yaml_strdup(tag_directive.handle) +// value.prefix = yaml_strdup(tag_directive.prefix) +// if (!value.handle || !value.prefix) goto error +// if (!PUSH(&context, tag_directives_copy, value)) +// goto error +// value.handle = NULL +// value.prefix = NULL +// } +// } +// +// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, +// tag_directives_copy.start, tag_directives_copy.top, +// start_implicit, end_implicit, mark, mark) +// +// return 1 +// +//error: +// STACK_DEL(&context, nodes) +// yaml_free(version_directive_copy) +// while (!STACK_EMPTY(&context, tag_directives_copy)) { +// value yaml_tag_directive_t = POP(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// } +// STACK_DEL(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// +// return 0 +//} +// +///* +// * Destroy a document object. +// */ +// +//YAML_DECLARE(void) +//yaml_document_delete(document *yaml_document_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// tag_directive *yaml_tag_directive_t +// +// context.error = YAML_NO_ERROR // Eliminate a compiler warning. +// +// assert(document) // Non-NULL document object is expected. +// +// while (!STACK_EMPTY(&context, document.nodes)) { +// node yaml_node_t = POP(&context, document.nodes) +// yaml_free(node.tag) +// switch (node.type) { +// case YAML_SCALAR_NODE: +// yaml_free(node.data.scalar.value) +// break +// case YAML_SEQUENCE_NODE: +// STACK_DEL(&context, node.data.sequence.items) +// break +// case YAML_MAPPING_NODE: +// STACK_DEL(&context, node.data.mapping.pairs) +// break +// default: +// assert(0) // Should not happen. +// } +// } +// STACK_DEL(&context, document.nodes) +// +// yaml_free(document.version_directive) +// for (tag_directive = document.tag_directives.start +// tag_directive != document.tag_directives.end +// tag_directive++) { +// yaml_free(tag_directive.handle) +// yaml_free(tag_directive.prefix) +// } +// yaml_free(document.tag_directives.start) +// +// memset(document, 0, sizeof(yaml_document_t)) +//} +// +///** +// * Get a document node. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_node(document *yaml_document_t, index int) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (index > 0 && document.nodes.start + index <= document.nodes.top) { +// return document.nodes.start + index - 1 +// } +// return NULL +//} +// +///** +// * Get the root object. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_root_node(document *yaml_document_t) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (document.nodes.top != document.nodes.start) { +// return document.nodes.start +// } +// return NULL +//} +// +///* +// * Add a scalar node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_scalar(document *yaml_document_t, +// tag *yaml_char_t, value *yaml_char_t, length int, +// style yaml_scalar_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// value_copy *yaml_char_t = NULL +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// assert(value) // Non-NULL value is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (length < 0) { +// length = strlen((char *)value) +// } +// +// if (!yaml_check_utf8(value, length)) goto error +// value_copy = yaml_malloc(length+1) +// if (!value_copy) goto error +// memcpy(value_copy, value, length) +// value_copy[length] = '\0' +// +// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// yaml_free(tag_copy) +// yaml_free(value_copy) +// +// return 0 +//} +// +///* +// * Add a sequence node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_sequence(document *yaml_document_t, +// tag *yaml_char_t, style yaml_sequence_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_item_t +// end *yaml_node_item_t +// top *yaml_node_item_t +// } items = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error +// +// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, items) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Add a mapping node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_mapping(document *yaml_document_t, +// tag *yaml_char_t, style yaml_mapping_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_pair_t +// end *yaml_node_pair_t +// top *yaml_node_pair_t +// } pairs = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error +// +// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, pairs) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Append an item to a sequence node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_sequence_item(document *yaml_document_t, +// sequence int, item int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// assert(document) // Non-NULL document is required. +// assert(sequence > 0 +// && document.nodes.start + sequence <= document.nodes.top) +// // Valid sequence id is required. +// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) +// // A sequence node is required. +// assert(item > 0 && document.nodes.start + item <= document.nodes.top) +// // Valid item id is required. +// +// if (!PUSH(&context, +// document.nodes.start[sequence-1].data.sequence.items, item)) +// return 0 +// +// return 1 +//} +// +///* +// * Append a pair of a key and a value to a mapping node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_mapping_pair(document *yaml_document_t, +// mapping int, key int, value int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// pair yaml_node_pair_t +// +// assert(document) // Non-NULL document is required. +// assert(mapping > 0 +// && document.nodes.start + mapping <= document.nodes.top) +// // Valid mapping id is required. +// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) +// // A mapping node is required. +// assert(key > 0 && document.nodes.start + key <= document.nodes.top) +// // Valid key id is required. +// assert(value > 0 && document.nodes.start + value <= document.nodes.top) +// // Valid value id is required. +// +// pair.key = key +// pair.value = value +// +// if (!PUSH(&context, +// document.nodes.start[mapping-1].data.mapping.pairs, pair)) +// return 0 +// +// return 1 +//} +// +// diff --git a/vendor/gopkg.in/yaml.v3/decode.go b/vendor/gopkg.in/yaml.v3/decode.go new file mode 100644 index 0000000..0173b69 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/decode.go @@ -0,0 +1,1000 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yaml + +import ( + "encoding" + "encoding/base64" + "fmt" + "io" + "math" + "reflect" + "strconv" + "time" +) + +// ---------------------------------------------------------------------------- +// Parser, produces a node tree out of a libyaml event stream. + +type parser struct { + parser yaml_parser_t + event yaml_event_t + doc *Node + anchors map[string]*Node + doneInit bool + textless bool +} + +func newParser(b []byte) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + if len(b) == 0 { + b = []byte{'\n'} + } + yaml_parser_set_input_string(&p.parser, b) + return &p +} + +func newParserFromReader(r io.Reader) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + yaml_parser_set_input_reader(&p.parser, r) + return &p +} + +func (p *parser) init() { + if p.doneInit { + return + } + p.anchors = make(map[string]*Node) + p.expect(yaml_STREAM_START_EVENT) + p.doneInit = true +} + +func (p *parser) destroy() { + if p.event.typ != yaml_NO_EVENT { + yaml_event_delete(&p.event) + } + yaml_parser_delete(&p.parser) +} + +// expect consumes an event from the event stream and +// checks that it's of the expected type. +func (p *parser) expect(e yaml_event_type_t) { + if p.event.typ == yaml_NO_EVENT { + if !yaml_parser_parse(&p.parser, &p.event) { + p.fail() + } + } + if p.event.typ == yaml_STREAM_END_EVENT { + failf("attempted to go past the end of stream; corrupted value?") + } + if p.event.typ != e { + p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) + p.fail() + } + yaml_event_delete(&p.event) + p.event.typ = yaml_NO_EVENT +} + +// peek peeks at the next event in the event stream, +// puts the results into p.event and returns the event type. +func (p *parser) peek() yaml_event_type_t { + if p.event.typ != yaml_NO_EVENT { + return p.event.typ + } + // It's curious choice from the underlying API to generally return a + // positive result on success, but on this case return true in an error + // scenario. This was the source of bugs in the past (issue #666). + if !yaml_parser_parse(&p.parser, &p.event) || p.parser.error != yaml_NO_ERROR { + p.fail() + } + return p.event.typ +} + +func (p *parser) fail() { + var where string + var line int + if p.parser.context_mark.line != 0 { + line = p.parser.context_mark.line + // Scanner errors don't iterate line before returning error + if p.parser.error == yaml_SCANNER_ERROR { + line++ + } + } else if p.parser.problem_mark.line != 0 { + line = p.parser.problem_mark.line + // Scanner errors don't iterate line before returning error + if p.parser.error == yaml_SCANNER_ERROR { + line++ + } + } + if line != 0 { + where = "line " + strconv.Itoa(line) + ": " + } + var msg string + if len(p.parser.problem) > 0 { + msg = p.parser.problem + } else { + msg = "unknown problem parsing YAML content" + } + failf("%s%s", where, msg) +} + +func (p *parser) anchor(n *Node, anchor []byte) { + if anchor != nil { + n.Anchor = string(anchor) + p.anchors[n.Anchor] = n + } +} + +func (p *parser) parse() *Node { + p.init() + switch p.peek() { + case yaml_SCALAR_EVENT: + return p.scalar() + case yaml_ALIAS_EVENT: + return p.alias() + case yaml_MAPPING_START_EVENT: + return p.mapping() + case yaml_SEQUENCE_START_EVENT: + return p.sequence() + case yaml_DOCUMENT_START_EVENT: + return p.document() + case yaml_STREAM_END_EVENT: + // Happens when attempting to decode an empty buffer. + return nil + case yaml_TAIL_COMMENT_EVENT: + panic("internal error: unexpected tail comment event (please report)") + default: + panic("internal error: attempted to parse unknown event (please report): " + p.event.typ.String()) + } +} + +func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node { + var style Style + if tag != "" && tag != "!" { + tag = shortTag(tag) + style = TaggedStyle + } else if defaultTag != "" { + tag = defaultTag + } else if kind == ScalarNode { + tag, _ = resolve("", value) + } + n := &Node{ + Kind: kind, + Tag: tag, + Value: value, + Style: style, + } + if !p.textless { + n.Line = p.event.start_mark.line + 1 + n.Column = p.event.start_mark.column + 1 + n.HeadComment = string(p.event.head_comment) + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + } + return n +} + +func (p *parser) parseChild(parent *Node) *Node { + child := p.parse() + parent.Content = append(parent.Content, child) + return child +} + +func (p *parser) document() *Node { + n := p.node(DocumentNode, "", "", "") + p.doc = n + p.expect(yaml_DOCUMENT_START_EVENT) + p.parseChild(n) + if p.peek() == yaml_DOCUMENT_END_EVENT { + n.FootComment = string(p.event.foot_comment) + } + p.expect(yaml_DOCUMENT_END_EVENT) + return n +} + +func (p *parser) alias() *Node { + n := p.node(AliasNode, "", "", string(p.event.anchor)) + n.Alias = p.anchors[n.Value] + if n.Alias == nil { + failf("unknown anchor '%s' referenced", n.Value) + } + p.expect(yaml_ALIAS_EVENT) + return n +} + +func (p *parser) scalar() *Node { + var parsedStyle = p.event.scalar_style() + var nodeStyle Style + switch { + case parsedStyle&yaml_DOUBLE_QUOTED_SCALAR_STYLE != 0: + nodeStyle = DoubleQuotedStyle + case parsedStyle&yaml_SINGLE_QUOTED_SCALAR_STYLE != 0: + nodeStyle = SingleQuotedStyle + case parsedStyle&yaml_LITERAL_SCALAR_STYLE != 0: + nodeStyle = LiteralStyle + case parsedStyle&yaml_FOLDED_SCALAR_STYLE != 0: + nodeStyle = FoldedStyle + } + var nodeValue = string(p.event.value) + var nodeTag = string(p.event.tag) + var defaultTag string + if nodeStyle == 0 { + if nodeValue == "<<" { + defaultTag = mergeTag + } + } else { + defaultTag = strTag + } + n := p.node(ScalarNode, defaultTag, nodeTag, nodeValue) + n.Style |= nodeStyle + p.anchor(n, p.event.anchor) + p.expect(yaml_SCALAR_EVENT) + return n +} + +func (p *parser) sequence() *Node { + n := p.node(SequenceNode, seqTag, string(p.event.tag), "") + if p.event.sequence_style()&yaml_FLOW_SEQUENCE_STYLE != 0 { + n.Style |= FlowStyle + } + p.anchor(n, p.event.anchor) + p.expect(yaml_SEQUENCE_START_EVENT) + for p.peek() != yaml_SEQUENCE_END_EVENT { + p.parseChild(n) + } + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + p.expect(yaml_SEQUENCE_END_EVENT) + return n +} + +func (p *parser) mapping() *Node { + n := p.node(MappingNode, mapTag, string(p.event.tag), "") + block := true + if p.event.mapping_style()&yaml_FLOW_MAPPING_STYLE != 0 { + block = false + n.Style |= FlowStyle + } + p.anchor(n, p.event.anchor) + p.expect(yaml_MAPPING_START_EVENT) + for p.peek() != yaml_MAPPING_END_EVENT { + k := p.parseChild(n) + if block && k.FootComment != "" { + // Must be a foot comment for the prior value when being dedented. + if len(n.Content) > 2 { + n.Content[len(n.Content)-3].FootComment = k.FootComment + k.FootComment = "" + } + } + v := p.parseChild(n) + if k.FootComment == "" && v.FootComment != "" { + k.FootComment = v.FootComment + v.FootComment = "" + } + if p.peek() == yaml_TAIL_COMMENT_EVENT { + if k.FootComment == "" { + k.FootComment = string(p.event.foot_comment) + } + p.expect(yaml_TAIL_COMMENT_EVENT) + } + } + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + if n.Style&FlowStyle == 0 && n.FootComment != "" && len(n.Content) > 1 { + n.Content[len(n.Content)-2].FootComment = n.FootComment + n.FootComment = "" + } + p.expect(yaml_MAPPING_END_EVENT) + return n +} + +// ---------------------------------------------------------------------------- +// Decoder, unmarshals a node into a provided value. + +type decoder struct { + doc *Node + aliases map[*Node]bool + terrors []string + + stringMapType reflect.Type + generalMapType reflect.Type + + knownFields bool + uniqueKeys bool + decodeCount int + aliasCount int + aliasDepth int + + mergedFields map[interface{}]bool +} + +var ( + nodeType = reflect.TypeOf(Node{}) + durationType = reflect.TypeOf(time.Duration(0)) + stringMapType = reflect.TypeOf(map[string]interface{}{}) + generalMapType = reflect.TypeOf(map[interface{}]interface{}{}) + ifaceType = generalMapType.Elem() + timeType = reflect.TypeOf(time.Time{}) + ptrTimeType = reflect.TypeOf(&time.Time{}) +) + +func newDecoder() *decoder { + d := &decoder{ + stringMapType: stringMapType, + generalMapType: generalMapType, + uniqueKeys: true, + } + d.aliases = make(map[*Node]bool) + return d +} + +func (d *decoder) terror(n *Node, tag string, out reflect.Value) { + if n.Tag != "" { + tag = n.Tag + } + value := n.Value + if tag != seqTag && tag != mapTag { + if len(value) > 10 { + value = " `" + value[:7] + "...`" + } else { + value = " `" + value + "`" + } + } + d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.Line, shortTag(tag), value, out.Type())) +} + +func (d *decoder) callUnmarshaler(n *Node, u Unmarshaler) (good bool) { + err := u.UnmarshalYAML(n) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +func (d *decoder) callObsoleteUnmarshaler(n *Node, u obsoleteUnmarshaler) (good bool) { + terrlen := len(d.terrors) + err := u.UnmarshalYAML(func(v interface{}) (err error) { + defer handleErr(&err) + d.unmarshal(n, reflect.ValueOf(v)) + if len(d.terrors) > terrlen { + issues := d.terrors[terrlen:] + d.terrors = d.terrors[:terrlen] + return &TypeError{issues} + } + return nil + }) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +// d.prepare initializes and dereferences pointers and calls UnmarshalYAML +// if a value is found to implement it. +// It returns the initialized and dereferenced out value, whether +// unmarshalling was already done by UnmarshalYAML, and if so whether +// its types unmarshalled appropriately. +// +// If n holds a null value, prepare returns before doing anything. +func (d *decoder) prepare(n *Node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { + if n.ShortTag() == nullTag { + return out, false, false + } + again := true + for again { + again = false + if out.Kind() == reflect.Ptr { + if out.IsNil() { + out.Set(reflect.New(out.Type().Elem())) + } + out = out.Elem() + again = true + } + if out.CanAddr() { + outi := out.Addr().Interface() + if u, ok := outi.(Unmarshaler); ok { + good = d.callUnmarshaler(n, u) + return out, true, good + } + if u, ok := outi.(obsoleteUnmarshaler); ok { + good = d.callObsoleteUnmarshaler(n, u) + return out, true, good + } + } + } + return out, false, false +} + +func (d *decoder) fieldByIndex(n *Node, v reflect.Value, index []int) (field reflect.Value) { + if n.ShortTag() == nullTag { + return reflect.Value{} + } + for _, num := range index { + for { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + continue + } + break + } + v = v.Field(num) + } + return v +} + +const ( + // 400,000 decode operations is ~500kb of dense object declarations, or + // ~5kb of dense object declarations with 10000% alias expansion + alias_ratio_range_low = 400000 + + // 4,000,000 decode operations is ~5MB of dense object declarations, or + // ~4.5MB of dense object declarations with 10% alias expansion + alias_ratio_range_high = 4000000 + + // alias_ratio_range is the range over which we scale allowed alias ratios + alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) +) + +func allowedAliasRatio(decodeCount int) float64 { + switch { + case decodeCount <= alias_ratio_range_low: + // allow 99% to come from alias expansion for small-to-medium documents + return 0.99 + case decodeCount >= alias_ratio_range_high: + // allow 10% to come from alias expansion for very large documents + return 0.10 + default: + // scale smoothly from 99% down to 10% over the range. + // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. + // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). + return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) + } +} + +func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) { + d.decodeCount++ + if d.aliasDepth > 0 { + d.aliasCount++ + } + if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { + failf("document contains excessive aliasing") + } + if out.Type() == nodeType { + out.Set(reflect.ValueOf(n).Elem()) + return true + } + switch n.Kind { + case DocumentNode: + return d.document(n, out) + case AliasNode: + return d.alias(n, out) + } + out, unmarshaled, good := d.prepare(n, out) + if unmarshaled { + return good + } + switch n.Kind { + case ScalarNode: + good = d.scalar(n, out) + case MappingNode: + good = d.mapping(n, out) + case SequenceNode: + good = d.sequence(n, out) + case 0: + if n.IsZero() { + return d.null(out) + } + fallthrough + default: + failf("cannot decode node with unknown kind %d", n.Kind) + } + return good +} + +func (d *decoder) document(n *Node, out reflect.Value) (good bool) { + if len(n.Content) == 1 { + d.doc = n + d.unmarshal(n.Content[0], out) + return true + } + return false +} + +func (d *decoder) alias(n *Node, out reflect.Value) (good bool) { + if d.aliases[n] { + // TODO this could actually be allowed in some circumstances. + failf("anchor '%s' value contains itself", n.Value) + } + d.aliases[n] = true + d.aliasDepth++ + good = d.unmarshal(n.Alias, out) + d.aliasDepth-- + delete(d.aliases, n) + return good +} + +var zeroValue reflect.Value + +func resetMap(out reflect.Value) { + for _, k := range out.MapKeys() { + out.SetMapIndex(k, zeroValue) + } +} + +func (d *decoder) null(out reflect.Value) bool { + if out.CanAddr() { + switch out.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + out.Set(reflect.Zero(out.Type())) + return true + } + } + return false +} + +func (d *decoder) scalar(n *Node, out reflect.Value) bool { + var tag string + var resolved interface{} + if n.indicatedString() { + tag = strTag + resolved = n.Value + } else { + tag, resolved = resolve(n.Tag, n.Value) + if tag == binaryTag { + data, err := base64.StdEncoding.DecodeString(resolved.(string)) + if err != nil { + failf("!!binary value contains invalid base64 data") + } + resolved = string(data) + } + } + if resolved == nil { + return d.null(out) + } + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + // We've resolved to exactly the type we want, so use that. + out.Set(resolvedv) + return true + } + // Perhaps we can use the value as a TextUnmarshaler to + // set its value. + if out.CanAddr() { + u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) + if ok { + var text []byte + if tag == binaryTag { + text = []byte(resolved.(string)) + } else { + // We let any value be unmarshaled into TextUnmarshaler. + // That might be more lax than we'd like, but the + // TextUnmarshaler itself should bowl out any dubious values. + text = []byte(n.Value) + } + err := u.UnmarshalText(text) + if err != nil { + fail(err) + } + return true + } + } + switch out.Kind() { + case reflect.String: + if tag == binaryTag { + out.SetString(resolved.(string)) + return true + } + out.SetString(n.Value) + return true + case reflect.Interface: + out.Set(reflect.ValueOf(resolved)) + return true + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + // This used to work in v2, but it's very unfriendly. + isDuration := out.Type() == durationType + + switch resolved := resolved.(type) { + case int: + if !isDuration && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case int64: + if !isDuration && !out.OverflowInt(resolved) { + out.SetInt(resolved) + return true + } + case uint64: + if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case float64: + if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case string: + if out.Type() == durationType { + d, err := time.ParseDuration(resolved) + if err == nil { + out.SetInt(int64(d)) + return true + } + } + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + switch resolved := resolved.(type) { + case int: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case int64: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case uint64: + if !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case float64: + if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + } + case reflect.Bool: + switch resolved := resolved.(type) { + case bool: + out.SetBool(resolved) + return true + case string: + // This offers some compatibility with the 1.1 spec (https://yaml.org/type/bool.html). + // It only works if explicitly attempting to unmarshal into a typed bool value. + switch resolved { + case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON": + out.SetBool(true) + return true + case "n", "N", "no", "No", "NO", "off", "Off", "OFF": + out.SetBool(false) + return true + } + } + case reflect.Float32, reflect.Float64: + switch resolved := resolved.(type) { + case int: + out.SetFloat(float64(resolved)) + return true + case int64: + out.SetFloat(float64(resolved)) + return true + case uint64: + out.SetFloat(float64(resolved)) + return true + case float64: + out.SetFloat(resolved) + return true + } + case reflect.Struct: + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + out.Set(resolvedv) + return true + } + case reflect.Ptr: + panic("yaml internal error: please report the issue") + } + d.terror(n, tag, out) + return false +} + +func settableValueOf(i interface{}) reflect.Value { + v := reflect.ValueOf(i) + sv := reflect.New(v.Type()).Elem() + sv.Set(v) + return sv +} + +func (d *decoder) sequence(n *Node, out reflect.Value) (good bool) { + l := len(n.Content) + + var iface reflect.Value + switch out.Kind() { + case reflect.Slice: + out.Set(reflect.MakeSlice(out.Type(), l, l)) + case reflect.Array: + if l != out.Len() { + failf("invalid array: want %d elements but got %d", out.Len(), l) + } + case reflect.Interface: + // No type hints. Will have to use a generic sequence. + iface = out + out = settableValueOf(make([]interface{}, l)) + default: + d.terror(n, seqTag, out) + return false + } + et := out.Type().Elem() + + j := 0 + for i := 0; i < l; i++ { + e := reflect.New(et).Elem() + if ok := d.unmarshal(n.Content[i], e); ok { + out.Index(j).Set(e) + j++ + } + } + if out.Kind() != reflect.Array { + out.Set(out.Slice(0, j)) + } + if iface.IsValid() { + iface.Set(out) + } + return true +} + +func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { + l := len(n.Content) + if d.uniqueKeys { + nerrs := len(d.terrors) + for i := 0; i < l; i += 2 { + ni := n.Content[i] + for j := i + 2; j < l; j += 2 { + nj := n.Content[j] + if ni.Kind == nj.Kind && ni.Value == nj.Value { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: mapping key %#v already defined at line %d", nj.Line, nj.Value, ni.Line)) + } + } + } + if len(d.terrors) > nerrs { + return false + } + } + switch out.Kind() { + case reflect.Struct: + return d.mappingStruct(n, out) + case reflect.Map: + // okay + case reflect.Interface: + iface := out + if isStringMap(n) { + out = reflect.MakeMap(d.stringMapType) + } else { + out = reflect.MakeMap(d.generalMapType) + } + iface.Set(out) + default: + d.terror(n, mapTag, out) + return false + } + + outt := out.Type() + kt := outt.Key() + et := outt.Elem() + + stringMapType := d.stringMapType + generalMapType := d.generalMapType + if outt.Elem() == ifaceType { + if outt.Key().Kind() == reflect.String { + d.stringMapType = outt + } else if outt.Key() == ifaceType { + d.generalMapType = outt + } + } + + mergedFields := d.mergedFields + d.mergedFields = nil + + var mergeNode *Node + + mapIsNew := false + if out.IsNil() { + out.Set(reflect.MakeMap(outt)) + mapIsNew = true + } + for i := 0; i < l; i += 2 { + if isMerge(n.Content[i]) { + mergeNode = n.Content[i+1] + continue + } + k := reflect.New(kt).Elem() + if d.unmarshal(n.Content[i], k) { + if mergedFields != nil { + ki := k.Interface() + if mergedFields[ki] { + continue + } + mergedFields[ki] = true + } + kkind := k.Kind() + if kkind == reflect.Interface { + kkind = k.Elem().Kind() + } + if kkind == reflect.Map || kkind == reflect.Slice { + failf("invalid map key: %#v", k.Interface()) + } + e := reflect.New(et).Elem() + if d.unmarshal(n.Content[i+1], e) || n.Content[i+1].ShortTag() == nullTag && (mapIsNew || !out.MapIndex(k).IsValid()) { + out.SetMapIndex(k, e) + } + } + } + + d.mergedFields = mergedFields + if mergeNode != nil { + d.merge(n, mergeNode, out) + } + + d.stringMapType = stringMapType + d.generalMapType = generalMapType + return true +} + +func isStringMap(n *Node) bool { + if n.Kind != MappingNode { + return false + } + l := len(n.Content) + for i := 0; i < l; i += 2 { + shortTag := n.Content[i].ShortTag() + if shortTag != strTag && shortTag != mergeTag { + return false + } + } + return true +} + +func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) { + sinfo, err := getStructInfo(out.Type()) + if err != nil { + panic(err) + } + + var inlineMap reflect.Value + var elemType reflect.Type + if sinfo.InlineMap != -1 { + inlineMap = out.Field(sinfo.InlineMap) + elemType = inlineMap.Type().Elem() + } + + for _, index := range sinfo.InlineUnmarshalers { + field := d.fieldByIndex(n, out, index) + d.prepare(n, field) + } + + mergedFields := d.mergedFields + d.mergedFields = nil + var mergeNode *Node + var doneFields []bool + if d.uniqueKeys { + doneFields = make([]bool, len(sinfo.FieldsList)) + } + name := settableValueOf("") + l := len(n.Content) + for i := 0; i < l; i += 2 { + ni := n.Content[i] + if isMerge(ni) { + mergeNode = n.Content[i+1] + continue + } + if !d.unmarshal(ni, name) { + continue + } + sname := name.String() + if mergedFields != nil { + if mergedFields[sname] { + continue + } + mergedFields[sname] = true + } + if info, ok := sinfo.FieldsMap[sname]; ok { + if d.uniqueKeys { + if doneFields[info.Id] { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.Line, name.String(), out.Type())) + continue + } + doneFields[info.Id] = true + } + var field reflect.Value + if info.Inline == nil { + field = out.Field(info.Num) + } else { + field = d.fieldByIndex(n, out, info.Inline) + } + d.unmarshal(n.Content[i+1], field) + } else if sinfo.InlineMap != -1 { + if inlineMap.IsNil() { + inlineMap.Set(reflect.MakeMap(inlineMap.Type())) + } + value := reflect.New(elemType).Elem() + d.unmarshal(n.Content[i+1], value) + inlineMap.SetMapIndex(name, value) + } else if d.knownFields { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.Line, name.String(), out.Type())) + } + } + + d.mergedFields = mergedFields + if mergeNode != nil { + d.merge(n, mergeNode, out) + } + return true +} + +func failWantMap() { + failf("map merge requires map or sequence of maps as the value") +} + +func (d *decoder) merge(parent *Node, merge *Node, out reflect.Value) { + mergedFields := d.mergedFields + if mergedFields == nil { + d.mergedFields = make(map[interface{}]bool) + for i := 0; i < len(parent.Content); i += 2 { + k := reflect.New(ifaceType).Elem() + if d.unmarshal(parent.Content[i], k) { + d.mergedFields[k.Interface()] = true + } + } + } + + switch merge.Kind { + case MappingNode: + d.unmarshal(merge, out) + case AliasNode: + if merge.Alias != nil && merge.Alias.Kind != MappingNode { + failWantMap() + } + d.unmarshal(merge, out) + case SequenceNode: + for i := 0; i < len(merge.Content); i++ { + ni := merge.Content[i] + if ni.Kind == AliasNode { + if ni.Alias != nil && ni.Alias.Kind != MappingNode { + failWantMap() + } + } else if ni.Kind != MappingNode { + failWantMap() + } + d.unmarshal(ni, out) + } + default: + failWantMap() + } + + d.mergedFields = mergedFields +} + +func isMerge(n *Node) bool { + return n.Kind == ScalarNode && n.Value == "<<" && (n.Tag == "" || n.Tag == "!" || shortTag(n.Tag) == mergeTag) +} diff --git a/vendor/gopkg.in/yaml.v3/emitterc.go b/vendor/gopkg.in/yaml.v3/emitterc.go new file mode 100644 index 0000000..0f47c9c --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/emitterc.go @@ -0,0 +1,2020 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +import ( + "bytes" + "fmt" +) + +// Flush the buffer if needed. +func flush(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) { + return yaml_emitter_flush(emitter) + } + return true +} + +// Put a character to the output buffer. +func put(emitter *yaml_emitter_t, value byte) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + emitter.buffer[emitter.buffer_pos] = value + emitter.buffer_pos++ + emitter.column++ + return true +} + +// Put a line break to the output buffer. +func put_break(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + switch emitter.line_break { + case yaml_CR_BREAK: + emitter.buffer[emitter.buffer_pos] = '\r' + emitter.buffer_pos += 1 + case yaml_LN_BREAK: + emitter.buffer[emitter.buffer_pos] = '\n' + emitter.buffer_pos += 1 + case yaml_CRLN_BREAK: + emitter.buffer[emitter.buffer_pos+0] = '\r' + emitter.buffer[emitter.buffer_pos+1] = '\n' + emitter.buffer_pos += 2 + default: + panic("unknown line break setting") + } + if emitter.column == 0 { + emitter.space_above = true + } + emitter.column = 0 + emitter.line++ + // [Go] Do this here and below and drop from everywhere else (see commented lines). + emitter.indention = true + return true +} + +// Copy a character from a string into buffer. +func write(emitter *yaml_emitter_t, s []byte, i *int) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + p := emitter.buffer_pos + w := width(s[*i]) + switch w { + case 4: + emitter.buffer[p+3] = s[*i+3] + fallthrough + case 3: + emitter.buffer[p+2] = s[*i+2] + fallthrough + case 2: + emitter.buffer[p+1] = s[*i+1] + fallthrough + case 1: + emitter.buffer[p+0] = s[*i+0] + default: + panic("unknown character width") + } + emitter.column++ + emitter.buffer_pos += w + *i += w + return true +} + +// Write a whole string into buffer. +func write_all(emitter *yaml_emitter_t, s []byte) bool { + for i := 0; i < len(s); { + if !write(emitter, s, &i) { + return false + } + } + return true +} + +// Copy a line break character from a string into buffer. +func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { + if s[*i] == '\n' { + if !put_break(emitter) { + return false + } + *i++ + } else { + if !write(emitter, s, i) { + return false + } + if emitter.column == 0 { + emitter.space_above = true + } + emitter.column = 0 + emitter.line++ + // [Go] Do this here and above and drop from everywhere else (see commented lines). + emitter.indention = true + } + return true +} + +// Set an emitter error and return false. +func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_EMITTER_ERROR + emitter.problem = problem + return false +} + +// Emit an event. +func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.events = append(emitter.events, *event) + for !yaml_emitter_need_more_events(emitter) { + event := &emitter.events[emitter.events_head] + if !yaml_emitter_analyze_event(emitter, event) { + return false + } + if !yaml_emitter_state_machine(emitter, event) { + return false + } + yaml_event_delete(event) + emitter.events_head++ + } + return true +} + +// Check if we need to accumulate more events before emitting. +// +// We accumulate extra +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START +// +func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { + if emitter.events_head == len(emitter.events) { + return true + } + var accumulate int + switch emitter.events[emitter.events_head].typ { + case yaml_DOCUMENT_START_EVENT: + accumulate = 1 + break + case yaml_SEQUENCE_START_EVENT: + accumulate = 2 + break + case yaml_MAPPING_START_EVENT: + accumulate = 3 + break + default: + return false + } + if len(emitter.events)-emitter.events_head > accumulate { + return false + } + var level int + for i := emitter.events_head; i < len(emitter.events); i++ { + switch emitter.events[i].typ { + case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: + level++ + case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: + level-- + } + if level == 0 { + return false + } + } + return true +} + +// Append a directive to the directives stack. +func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { + for i := 0; i < len(emitter.tag_directives); i++ { + if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") + } + } + + // [Go] Do we actually need to copy this given garbage collection + // and the lack of deallocating destructors? + tag_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(tag_copy.handle, value.handle) + copy(tag_copy.prefix, value.prefix) + emitter.tag_directives = append(emitter.tag_directives, tag_copy) + return true +} + +// Increase the indentation level. +func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { + emitter.indents = append(emitter.indents, emitter.indent) + if emitter.indent < 0 { + if flow { + emitter.indent = emitter.best_indent + } else { + emitter.indent = 0 + } + } else if !indentless { + // [Go] This was changed so that indentations are more regular. + if emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { + // The first indent inside a sequence will just skip the "- " indicator. + emitter.indent += 2 + } else { + // Everything else aligns to the chosen indentation. + emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) + } + } + return true +} + +// State dispatcher. +func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { + switch emitter.state { + default: + case yaml_EMIT_STREAM_START_STATE: + return yaml_emitter_emit_stream_start(emitter, event) + + case yaml_EMIT_FIRST_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, true) + + case yaml_EMIT_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, false) + + case yaml_EMIT_DOCUMENT_CONTENT_STATE: + return yaml_emitter_emit_document_content(emitter, event) + + case yaml_EMIT_DOCUMENT_END_STATE: + return yaml_emitter_emit_document_end(emitter, event) + + case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, true, false) + + case yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false, true) + + case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false, false) + + case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, true, false) + + case yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false, true) + + case yaml_EMIT_FLOW_MAPPING_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false, false) + + case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, false) + + case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, true) + + case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, false) + + case yaml_EMIT_END_STATE: + return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") + } + panic("invalid emitter state") +} + +// Expect STREAM-START. +func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_STREAM_START_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") + } + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = event.encoding + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = yaml_UTF8_ENCODING + } + } + if emitter.best_indent < 2 || emitter.best_indent > 9 { + emitter.best_indent = 2 + } + if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { + emitter.best_width = 80 + } + if emitter.best_width < 0 { + emitter.best_width = 1<<31 - 1 + } + if emitter.line_break == yaml_ANY_BREAK { + emitter.line_break = yaml_LN_BREAK + } + + emitter.indent = -1 + emitter.line = 0 + emitter.column = 0 + emitter.whitespace = true + emitter.indention = true + emitter.space_above = true + emitter.foot_indent = -1 + + if emitter.encoding != yaml_UTF8_ENCODING { + if !yaml_emitter_write_bom(emitter) { + return false + } + } + emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE + return true +} + +// Expect DOCUMENT-START or STREAM-END. +func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + + if event.typ == yaml_DOCUMENT_START_EVENT { + + if event.version_directive != nil { + if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { + return false + } + } + + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { + return false + } + if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { + return false + } + } + + for i := 0; i < len(default_tag_directives); i++ { + tag_directive := &default_tag_directives[i] + if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { + return false + } + } + + implicit := event.implicit + if !first || emitter.canonical { + implicit = false + } + + if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if event.version_directive != nil { + implicit = false + if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if len(event.tag_directives) > 0 { + implicit = false + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { + return false + } + if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if yaml_emitter_check_empty_document(emitter) { + implicit = false + } + if !implicit { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { + return false + } + if emitter.canonical || true { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if len(emitter.head_comment) > 0 { + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !put_break(emitter) { + return false + } + } + + emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE + return true + } + + if event.typ == yaml_STREAM_END_EVENT { + if emitter.open_ended { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_END_STATE + return true + } + + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") +} + +// Expect the root node. +func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !yaml_emitter_emit_node(emitter, event, true, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect DOCUMENT-END. +func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_DOCUMENT_END_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") + } + // [Go] Force document foot separation. + emitter.foot_indent = 0 + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.foot_indent = -1 + if !yaml_emitter_write_indent(emitter) { + return false + } + if !event.implicit { + // [Go] Allocate the slice elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_DOCUMENT_START_STATE + emitter.tag_directives = emitter.tag_directives[:0] + return true +} + +// Expect a flow item node. +func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_SEQUENCE_END_EVENT { + if emitter.canonical && !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.column == 0 || emitter.canonical && !first { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if emitter.column == 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE) + } else { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) + } + if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { + return false + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect a flow key node. +func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_MAPPING_END_EVENT { + if (emitter.canonical || len(emitter.head_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0) && !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + + if !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + + if emitter.column == 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a flow value node. +func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { + return false + } + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE) + } else { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) + } + if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { + return false + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect a block item node. +func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, false) { + return false + } + } + if event.typ == yaml_SEQUENCE_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) + if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect a block key node. +func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, false) { + return false + } + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if event.typ == yaml_MAPPING_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if len(emitter.line_comment) > 0 { + // [Go] A line comment was provided for the key. That's unusual as the + // scanner associates line comments with the value. Either way, + // save the line comment and render it appropriately later. + emitter.key_line_comment = emitter.line_comment + emitter.line_comment = nil + } + if yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a block value node. +func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { + return false + } + } + if len(emitter.key_line_comment) > 0 { + // [Go] Line comments are generally associated with the value, but when there's + // no value on the same line as a mapping key they end up attached to the + // key itself. + if event.typ == yaml_SCALAR_EVENT { + if len(emitter.line_comment) == 0 { + // A scalar is coming and it has no line comments by itself yet, + // so just let it handle the line comment as usual. If it has a + // line comment, we can't have both so the one from the key is lost. + emitter.line_comment = emitter.key_line_comment + emitter.key_line_comment = nil + } + } else if event.sequence_style() != yaml_FLOW_SEQUENCE_STYLE && (event.typ == yaml_MAPPING_START_EVENT || event.typ == yaml_SEQUENCE_START_EVENT) { + // An indented block follows, so write the comment right now. + emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment + if !yaml_emitter_process_line_comment(emitter) { + return false + } + emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment + } + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) + if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +func yaml_emitter_silent_nil_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + return event.typ == yaml_SCALAR_EVENT && event.implicit && !emitter.canonical && len(emitter.scalar_data.value) == 0 +} + +// Expect a node. +func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, + root bool, sequence bool, mapping bool, simple_key bool) bool { + + emitter.root_context = root + emitter.sequence_context = sequence + emitter.mapping_context = mapping + emitter.simple_key_context = simple_key + + switch event.typ { + case yaml_ALIAS_EVENT: + return yaml_emitter_emit_alias(emitter, event) + case yaml_SCALAR_EVENT: + return yaml_emitter_emit_scalar(emitter, event) + case yaml_SEQUENCE_START_EVENT: + return yaml_emitter_emit_sequence_start(emitter, event) + case yaml_MAPPING_START_EVENT: + return yaml_emitter_emit_mapping_start(emitter, event) + default: + return yaml_emitter_set_emitter_error(emitter, + fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) + } +} + +// Expect ALIAS. +func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SCALAR. +func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_select_scalar_style(emitter, event) { + return false + } + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + if !yaml_emitter_process_scalar(emitter) { + return false + } + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SEQUENCE-START. +func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || + yaml_emitter_check_empty_sequence(emitter) { + emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE + } + return true +} + +// Expect MAPPING-START. +func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || + yaml_emitter_check_empty_mapping(emitter) { + emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE + } + return true +} + +// Check if the document content is an empty scalar. +func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { + return false // [Go] Huh? +} + +// Check if the next events represent an empty sequence. +func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT +} + +// Check if the next events represent an empty mapping. +func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT +} + +// Check if the next node can be expressed as a simple key. +func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { + length := 0 + switch emitter.events[emitter.events_head].typ { + case yaml_ALIAS_EVENT: + length += len(emitter.anchor_data.anchor) + case yaml_SCALAR_EVENT: + if emitter.scalar_data.multiline { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + len(emitter.scalar_data.value) + case yaml_SEQUENCE_START_EVENT: + if !yaml_emitter_check_empty_sequence(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + case yaml_MAPPING_START_EVENT: + if !yaml_emitter_check_empty_mapping(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + default: + return false + } + return length <= 128 +} + +// Determine an acceptable scalar style. +func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 + if no_tag && !event.implicit && !event.quoted_implicit { + return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") + } + + style := event.scalar_style() + if style == yaml_ANY_SCALAR_STYLE { + style = yaml_PLAIN_SCALAR_STYLE + } + if emitter.canonical { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + if emitter.simple_key_context && emitter.scalar_data.multiline { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + if style == yaml_PLAIN_SCALAR_STYLE { + if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || + emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if no_tag && !event.implicit { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { + if !emitter.scalar_data.single_quoted_allowed { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { + if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + + if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { + emitter.tag_data.handle = []byte{'!'} + } + emitter.scalar_data.style = style + return true +} + +// Write an anchor. +func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { + if emitter.anchor_data.anchor == nil { + return true + } + c := []byte{'&'} + if emitter.anchor_data.alias { + c[0] = '*' + } + if !yaml_emitter_write_indicator(emitter, c, true, false, false) { + return false + } + return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) +} + +// Write a tag. +func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { + if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { + return true + } + if len(emitter.tag_data.handle) > 0 { + if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { + return false + } + if len(emitter.tag_data.suffix) > 0 { + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + } + } else { + // [Go] Allocate these slices elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { + return false + } + } + return true +} + +// Write a scalar. +func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { + switch emitter.scalar_data.style { + case yaml_PLAIN_SCALAR_STYLE: + return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_SINGLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_DOUBLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_LITERAL_SCALAR_STYLE: + return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) + + case yaml_FOLDED_SCALAR_STYLE: + return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) + } + panic("unknown scalar style") +} + +// Write a head comment. +func yaml_emitter_process_head_comment(emitter *yaml_emitter_t) bool { + if len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.tail_comment) { + return false + } + emitter.tail_comment = emitter.tail_comment[:0] + emitter.foot_indent = emitter.indent + if emitter.foot_indent < 0 { + emitter.foot_indent = 0 + } + } + + if len(emitter.head_comment) == 0 { + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.head_comment) { + return false + } + emitter.head_comment = emitter.head_comment[:0] + return true +} + +// Write an line comment. +func yaml_emitter_process_line_comment(emitter *yaml_emitter_t) bool { + if len(emitter.line_comment) == 0 { + return true + } + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !yaml_emitter_write_comment(emitter, emitter.line_comment) { + return false + } + emitter.line_comment = emitter.line_comment[:0] + return true +} + +// Write a foot comment. +func yaml_emitter_process_foot_comment(emitter *yaml_emitter_t) bool { + if len(emitter.foot_comment) == 0 { + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.foot_comment) { + return false + } + emitter.foot_comment = emitter.foot_comment[:0] + emitter.foot_indent = emitter.indent + if emitter.foot_indent < 0 { + emitter.foot_indent = 0 + } + return true +} + +// Check if a %YAML directive is valid. +func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { + if version_directive.major != 1 || version_directive.minor != 1 { + return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") + } + return true +} + +// Check if a %TAG directive is valid. +func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { + handle := tag_directive.handle + prefix := tag_directive.prefix + if len(handle) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") + } + if handle[0] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") + } + if handle[len(handle)-1] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") + } + for i := 1; i < len(handle)-1; i += width(handle[i]) { + if !is_alpha(handle, i) { + return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") + } + } + if len(prefix) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") + } + return true +} + +// Check if an anchor is valid. +func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { + if len(anchor) == 0 { + problem := "anchor value must not be empty" + if alias { + problem = "alias value must not be empty" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + for i := 0; i < len(anchor); i += width(anchor[i]) { + if !is_alpha(anchor, i) { + problem := "anchor value must contain alphanumerical characters only" + if alias { + problem = "alias value must contain alphanumerical characters only" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + } + emitter.anchor_data.anchor = anchor + emitter.anchor_data.alias = alias + return true +} + +// Check if a tag is valid. +func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { + if len(tag) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") + } + for i := 0; i < len(emitter.tag_directives); i++ { + tag_directive := &emitter.tag_directives[i] + if bytes.HasPrefix(tag, tag_directive.prefix) { + emitter.tag_data.handle = tag_directive.handle + emitter.tag_data.suffix = tag[len(tag_directive.prefix):] + return true + } + } + emitter.tag_data.suffix = tag + return true +} + +// Check if a scalar is valid. +func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { + var ( + block_indicators = false + flow_indicators = false + line_breaks = false + special_characters = false + tab_characters = false + + leading_space = false + leading_break = false + trailing_space = false + trailing_break = false + break_space = false + space_break = false + + preceded_by_whitespace = false + followed_by_whitespace = false + previous_space = false + previous_break = false + ) + + emitter.scalar_data.value = value + + if len(value) == 0 { + emitter.scalar_data.multiline = false + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = false + return true + } + + if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { + block_indicators = true + flow_indicators = true + } + + preceded_by_whitespace = true + for i, w := 0, 0; i < len(value); i += w { + w = width(value[i]) + followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) + + if i == 0 { + switch value[i] { + case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': + flow_indicators = true + block_indicators = true + case '?', ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '-': + if followed_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } else { + switch value[i] { + case ',', '?', '[', ']', '{', '}': + flow_indicators = true + case ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '#': + if preceded_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } + + if value[i] == '\t' { + tab_characters = true + } else if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { + special_characters = true + } + if is_space(value, i) { + if i == 0 { + leading_space = true + } + if i+width(value[i]) == len(value) { + trailing_space = true + } + if previous_break { + break_space = true + } + previous_space = true + previous_break = false + } else if is_break(value, i) { + line_breaks = true + if i == 0 { + leading_break = true + } + if i+width(value[i]) == len(value) { + trailing_break = true + } + if previous_space { + space_break = true + } + previous_space = false + previous_break = true + } else { + previous_space = false + previous_break = false + } + + // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. + preceded_by_whitespace = is_blankz(value, i) + } + + emitter.scalar_data.multiline = line_breaks + emitter.scalar_data.flow_plain_allowed = true + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = true + + if leading_space || leading_break || trailing_space || trailing_break { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if trailing_space { + emitter.scalar_data.block_allowed = false + } + if break_space { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + if space_break || tab_characters || special_characters { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + if space_break || special_characters { + emitter.scalar_data.block_allowed = false + } + if line_breaks { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if flow_indicators { + emitter.scalar_data.flow_plain_allowed = false + } + if block_indicators { + emitter.scalar_data.block_plain_allowed = false + } + return true +} + +// Check if the event data is valid. +func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + emitter.anchor_data.anchor = nil + emitter.tag_data.handle = nil + emitter.tag_data.suffix = nil + emitter.scalar_data.value = nil + + if len(event.head_comment) > 0 { + emitter.head_comment = event.head_comment + } + if len(event.line_comment) > 0 { + emitter.line_comment = event.line_comment + } + if len(event.foot_comment) > 0 { + emitter.foot_comment = event.foot_comment + } + if len(event.tail_comment) > 0 { + emitter.tail_comment = event.tail_comment + } + + switch event.typ { + case yaml_ALIAS_EVENT: + if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { + return false + } + + case yaml_SCALAR_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + if !yaml_emitter_analyze_scalar(emitter, event.value) { + return false + } + + case yaml_SEQUENCE_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + + case yaml_MAPPING_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + } + return true +} + +// Write the BOM character. +func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { + if !flush(emitter) { + return false + } + pos := emitter.buffer_pos + emitter.buffer[pos+0] = '\xEF' + emitter.buffer[pos+1] = '\xBB' + emitter.buffer[pos+2] = '\xBF' + emitter.buffer_pos += 3 + return true +} + +func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { + indent := emitter.indent + if indent < 0 { + indent = 0 + } + if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { + if !put_break(emitter) { + return false + } + } + if emitter.foot_indent == indent { + if !put_break(emitter) { + return false + } + } + for emitter.column < indent { + if !put(emitter, ' ') { + return false + } + } + emitter.whitespace = true + //emitter.indention = true + emitter.space_above = false + emitter.foot_indent = -1 + return true +} + +func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, indicator) { + return false + } + emitter.whitespace = is_whitespace + emitter.indention = (emitter.indention && is_indention) + emitter.open_ended = false + return true +} + +func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + for i := 0; i < len(value); { + var must_write bool + switch value[i] { + case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': + must_write = true + default: + must_write = is_alpha(value, i) + } + if must_write { + if !write(emitter, value, &i) { + return false + } + } else { + w := width(value[i]) + for k := 0; k < w; k++ { + octet := value[i] + i++ + if !put(emitter, '%') { + return false + } + + c := octet >> 4 + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + + c = octet & 0x0f + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + } + } + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + if len(value) > 0 && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + + if len(value) > 0 { + emitter.whitespace = false + } + emitter.indention = false + if emitter.root_context { + emitter.open_ended = true + } + + return true +} + +func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { + return false + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if value[i] == '\'' { + if !put(emitter, '\'') { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + spaces := false + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { + return false + } + + for i := 0; i < len(value); { + if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || + is_bom(value, i) || is_break(value, i) || + value[i] == '"' || value[i] == '\\' { + + octet := value[i] + + var w int + var v rune + switch { + case octet&0x80 == 0x00: + w, v = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, v = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, v = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, v = 4, rune(octet&0x07) + } + for k := 1; k < w; k++ { + octet = value[i+k] + v = (v << 6) + (rune(octet) & 0x3F) + } + i += w + + if !put(emitter, '\\') { + return false + } + + var ok bool + switch v { + case 0x00: + ok = put(emitter, '0') + case 0x07: + ok = put(emitter, 'a') + case 0x08: + ok = put(emitter, 'b') + case 0x09: + ok = put(emitter, 't') + case 0x0A: + ok = put(emitter, 'n') + case 0x0b: + ok = put(emitter, 'v') + case 0x0c: + ok = put(emitter, 'f') + case 0x0d: + ok = put(emitter, 'r') + case 0x1b: + ok = put(emitter, 'e') + case 0x22: + ok = put(emitter, '"') + case 0x5c: + ok = put(emitter, '\\') + case 0x85: + ok = put(emitter, 'N') + case 0xA0: + ok = put(emitter, '_') + case 0x2028: + ok = put(emitter, 'L') + case 0x2029: + ok = put(emitter, 'P') + default: + if v <= 0xFF { + ok = put(emitter, 'x') + w = 2 + } else if v <= 0xFFFF { + ok = put(emitter, 'u') + w = 4 + } else { + ok = put(emitter, 'U') + w = 8 + } + for k := (w - 1) * 4; ok && k >= 0; k -= 4 { + digit := byte((v >> uint(k)) & 0x0F) + if digit < 10 { + ok = put(emitter, digit+'0') + } else { + ok = put(emitter, digit+'A'-10) + } + } + } + if !ok { + return false + } + spaces = false + } else if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if is_space(value, i+1) { + if !put(emitter, '\\') { + return false + } + } + i += width(value[i]) + } else if !write(emitter, value, &i) { + return false + } + spaces = true + } else { + if !write(emitter, value, &i) { + return false + } + spaces = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { + if is_space(value, 0) || is_break(value, 0) { + indent_hint := []byte{'0' + byte(emitter.best_indent)} + if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { + return false + } + } + + emitter.open_ended = false + + var chomp_hint [1]byte + if len(value) == 0 { + chomp_hint[0] = '-' + } else { + i := len(value) - 1 + for value[i]&0xC0 == 0x80 { + i-- + } + if !is_break(value, i) { + chomp_hint[0] = '-' + } else if i == 0 { + chomp_hint[0] = '+' + emitter.open_ended = true + } else { + i-- + for value[i]&0xC0 == 0x80 { + i-- + } + if is_break(value, i) { + chomp_hint[0] = '+' + emitter.open_ended = true + } + } + } + if chomp_hint[0] != 0 { + if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { + return false + } + } + return true +} + +func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + //emitter.indention = true + emitter.whitespace = true + breaks := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + + return true +} + +func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + + //emitter.indention = true + emitter.whitespace = true + + breaks := true + leading_spaces := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !breaks && !leading_spaces && value[i] == '\n' { + k := 0 + for is_break(value, k) { + k += width(value[k]) + } + if !is_blankz(value, k) { + if !put_break(emitter) { + return false + } + } + } + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + leading_spaces = is_blank(value, i) + } + if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + emitter.indention = false + breaks = false + } + } + return true +} + +func yaml_emitter_write_comment(emitter *yaml_emitter_t, comment []byte) bool { + breaks := false + pound := false + for i := 0; i < len(comment); { + if is_break(comment, i) { + if !write_break(emitter, comment, &i) { + return false + } + //emitter.indention = true + breaks = true + pound = false + } else { + if breaks && !yaml_emitter_write_indent(emitter) { + return false + } + if !pound { + if comment[i] != '#' && (!put(emitter, '#') || !put(emitter, ' ')) { + return false + } + pound = true + } + if !write(emitter, comment, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + if !breaks && !put_break(emitter) { + return false + } + + emitter.whitespace = true + //emitter.indention = true + return true +} diff --git a/vendor/gopkg.in/yaml.v3/encode.go b/vendor/gopkg.in/yaml.v3/encode.go new file mode 100644 index 0000000..de9e72a --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/encode.go @@ -0,0 +1,577 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yaml + +import ( + "encoding" + "fmt" + "io" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +type encoder struct { + emitter yaml_emitter_t + event yaml_event_t + out []byte + flow bool + indent int + doneInit bool +} + +func newEncoder() *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_string(&e.emitter, &e.out) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func newEncoderWithWriter(w io.Writer) *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_writer(&e.emitter, w) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func (e *encoder) init() { + if e.doneInit { + return + } + if e.indent == 0 { + e.indent = 4 + } + e.emitter.best_indent = e.indent + yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) + e.emit() + e.doneInit = true +} + +func (e *encoder) finish() { + e.emitter.open_ended = false + yaml_stream_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) destroy() { + yaml_emitter_delete(&e.emitter) +} + +func (e *encoder) emit() { + // This will internally delete the e.event value. + e.must(yaml_emitter_emit(&e.emitter, &e.event)) +} + +func (e *encoder) must(ok bool) { + if !ok { + msg := e.emitter.problem + if msg == "" { + msg = "unknown problem generating YAML content" + } + failf("%s", msg) + } +} + +func (e *encoder) marshalDoc(tag string, in reflect.Value) { + e.init() + var node *Node + if in.IsValid() { + node, _ = in.Interface().(*Node) + } + if node != nil && node.Kind == DocumentNode { + e.nodev(in) + } else { + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.emit() + e.marshal(tag, in) + yaml_document_end_event_initialize(&e.event, true) + e.emit() + } +} + +func (e *encoder) marshal(tag string, in reflect.Value) { + tag = shortTag(tag) + if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { + e.nilv() + return + } + iface := in.Interface() + switch value := iface.(type) { + case *Node: + e.nodev(in) + return + case Node: + if !in.CanAddr() { + var n = reflect.New(in.Type()).Elem() + n.Set(in) + in = n + } + e.nodev(in.Addr()) + return + case time.Time: + e.timev(tag, in) + return + case *time.Time: + e.timev(tag, in.Elem()) + return + case time.Duration: + e.stringv(tag, reflect.ValueOf(value.String())) + return + case Marshaler: + v, err := value.MarshalYAML() + if err != nil { + fail(err) + } + if v == nil { + e.nilv() + return + } + e.marshal(tag, reflect.ValueOf(v)) + return + case encoding.TextMarshaler: + text, err := value.MarshalText() + if err != nil { + fail(err) + } + in = reflect.ValueOf(string(text)) + case nil: + e.nilv() + return + } + switch in.Kind() { + case reflect.Interface: + e.marshal(tag, in.Elem()) + case reflect.Map: + e.mapv(tag, in) + case reflect.Ptr: + e.marshal(tag, in.Elem()) + case reflect.Struct: + e.structv(tag, in) + case reflect.Slice, reflect.Array: + e.slicev(tag, in) + case reflect.String: + e.stringv(tag, in) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + e.intv(tag, in) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + e.uintv(tag, in) + case reflect.Float32, reflect.Float64: + e.floatv(tag, in) + case reflect.Bool: + e.boolv(tag, in) + default: + panic("cannot marshal type: " + in.Type().String()) + } +} + +func (e *encoder) mapv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + keys := keyList(in.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + e.marshal("", k) + e.marshal("", in.MapIndex(k)) + } + }) +} + +func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field reflect.Value) { + for _, num := range index { + for { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return reflect.Value{} + } + v = v.Elem() + continue + } + break + } + v = v.Field(num) + } + return v +} + +func (e *encoder) structv(tag string, in reflect.Value) { + sinfo, err := getStructInfo(in.Type()) + if err != nil { + panic(err) + } + e.mappingv(tag, func() { + for _, info := range sinfo.FieldsList { + var value reflect.Value + if info.Inline == nil { + value = in.Field(info.Num) + } else { + value = e.fieldByIndex(in, info.Inline) + if !value.IsValid() { + continue + } + } + if info.OmitEmpty && isZero(value) { + continue + } + e.marshal("", reflect.ValueOf(info.Key)) + e.flow = info.Flow + e.marshal("", value) + } + if sinfo.InlineMap >= 0 { + m := in.Field(sinfo.InlineMap) + if m.Len() > 0 { + e.flow = false + keys := keyList(m.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + if _, found := sinfo.FieldsMap[k.String()]; found { + panic(fmt.Sprintf("cannot have key %q in inlined map: conflicts with struct field", k.String())) + } + e.marshal("", k) + e.flow = false + e.marshal("", m.MapIndex(k)) + } + } + } + }) +} + +func (e *encoder) mappingv(tag string, f func()) { + implicit := tag == "" + style := yaml_BLOCK_MAPPING_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) + e.emit() + f() + yaml_mapping_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) slicev(tag string, in reflect.Value) { + implicit := tag == "" + style := yaml_BLOCK_SEQUENCE_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + e.emit() + n := in.Len() + for i := 0; i < n; i++ { + e.marshal("", in.Index(i)) + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.emit() +} + +// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. +// +// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported +// in YAML 1.2 and by this package, but these should be marshalled quoted for +// the time being for compatibility with other parsers. +func isBase60Float(s string) (result bool) { + // Fast path. + if s == "" { + return false + } + c := s[0] + if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { + return false + } + // Do the full match. + return base60float.MatchString(s) +} + +// From http://yaml.org/type/float.html, except the regular expression there +// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. +var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) + +// isOldBool returns whether s is bool notation as defined in YAML 1.1. +// +// We continue to force strings that YAML 1.1 would interpret as booleans to be +// rendered as quotes strings so that the marshalled output valid for YAML 1.1 +// parsing. +func isOldBool(s string) (result bool) { + switch s { + case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", + "n", "N", "no", "No", "NO", "off", "Off", "OFF": + return true + default: + return false + } +} + +func (e *encoder) stringv(tag string, in reflect.Value) { + var style yaml_scalar_style_t + s := in.String() + canUsePlain := true + switch { + case !utf8.ValidString(s): + if tag == binaryTag { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if tag != "" { + failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = binaryTag + s = encodeBase64(s) + case tag == "": + // Check to see if it would resolve to a specific + // tag when encoded unquoted. If it doesn't, + // there's no need to quote it. + rtag, _ := resolve("", s) + canUsePlain = rtag == strTag && !(isBase60Float(s) || isOldBool(s)) + } + // Note: it's possible for user code to emit invalid YAML + // if they explicitly specify a tag and a string containing + // text that's incompatible with that tag. + switch { + case strings.Contains(s, "\n"): + if e.flow { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } else { + style = yaml_LITERAL_SCALAR_STYLE + } + case canUsePlain: + style = yaml_PLAIN_SCALAR_STYLE + default: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + e.emitScalar(s, "", tag, style, nil, nil, nil, nil) +} + +func (e *encoder) boolv(tag string, in reflect.Value) { + var s string + if in.Bool() { + s = "true" + } else { + s = "false" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) intv(tag string, in reflect.Value) { + s := strconv.FormatInt(in.Int(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) uintv(tag string, in reflect.Value) { + s := strconv.FormatUint(in.Uint(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) timev(tag string, in reflect.Value) { + t := in.Interface().(time.Time) + s := t.Format(time.RFC3339Nano) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) floatv(tag string, in reflect.Value) { + // Issue #352: When formatting, use the precision of the underlying value + precision := 64 + if in.Kind() == reflect.Float32 { + precision = 32 + } + + s := strconv.FormatFloat(in.Float(), 'g', -1, precision) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) nilv() { + e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t, head, line, foot, tail []byte) { + // TODO Kill this function. Replace all initialize calls by their underlining Go literals. + implicit := tag == "" + if !implicit { + tag = longTag(tag) + } + e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) + e.event.head_comment = head + e.event.line_comment = line + e.event.foot_comment = foot + e.event.tail_comment = tail + e.emit() +} + +func (e *encoder) nodev(in reflect.Value) { + e.node(in.Interface().(*Node), "") +} + +func (e *encoder) node(node *Node, tail string) { + // Zero nodes behave as nil. + if node.Kind == 0 && node.IsZero() { + e.nilv() + return + } + + // If the tag was not explicitly requested, and dropping it won't change the + // implicit tag of the value, don't include it in the presentation. + var tag = node.Tag + var stag = shortTag(tag) + var forceQuoting bool + if tag != "" && node.Style&TaggedStyle == 0 { + if node.Kind == ScalarNode { + if stag == strTag && node.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0 { + tag = "" + } else { + rtag, _ := resolve("", node.Value) + if rtag == stag { + tag = "" + } else if stag == strTag { + tag = "" + forceQuoting = true + } + } + } else { + var rtag string + switch node.Kind { + case MappingNode: + rtag = mapTag + case SequenceNode: + rtag = seqTag + } + if rtag == stag { + tag = "" + } + } + } + + switch node.Kind { + case DocumentNode: + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + for _, node := range node.Content { + e.node(node, "") + } + yaml_document_end_event_initialize(&e.event, true) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case SequenceNode: + style := yaml_BLOCK_SEQUENCE_STYLE + if node.Style&FlowStyle != 0 { + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style)) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + for _, node := range node.Content { + e.node(node, "") + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case MappingNode: + style := yaml_BLOCK_MAPPING_STYLE + if node.Style&FlowStyle != 0 { + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style) + e.event.tail_comment = []byte(tail) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + + // The tail logic below moves the foot comment of prior keys to the following key, + // since the value for each key may be a nested structure and the foot needs to be + // processed only the entirety of the value is streamed. The last tail is processed + // with the mapping end event. + var tail string + for i := 0; i+1 < len(node.Content); i += 2 { + k := node.Content[i] + foot := k.FootComment + if foot != "" { + kopy := *k + kopy.FootComment = "" + k = &kopy + } + e.node(k, tail) + tail = foot + + v := node.Content[i+1] + e.node(v, "") + } + + yaml_mapping_end_event_initialize(&e.event) + e.event.tail_comment = []byte(tail) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case AliasNode: + yaml_alias_event_initialize(&e.event, []byte(node.Value)) + e.event.head_comment = []byte(node.HeadComment) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case ScalarNode: + value := node.Value + if !utf8.ValidString(value) { + if stag == binaryTag { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if stag != "" { + failf("cannot marshal invalid UTF-8 data as %s", stag) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = binaryTag + value = encodeBase64(value) + } + + style := yaml_PLAIN_SCALAR_STYLE + switch { + case node.Style&DoubleQuotedStyle != 0: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + case node.Style&SingleQuotedStyle != 0: + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + case node.Style&LiteralStyle != 0: + style = yaml_LITERAL_SCALAR_STYLE + case node.Style&FoldedStyle != 0: + style = yaml_FOLDED_SCALAR_STYLE + case strings.Contains(value, "\n"): + style = yaml_LITERAL_SCALAR_STYLE + case forceQuoting: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + e.emitScalar(value, node.Anchor, tag, style, []byte(node.HeadComment), []byte(node.LineComment), []byte(node.FootComment), []byte(tail)) + default: + failf("cannot encode node with unknown kind %d", node.Kind) + } +} diff --git a/vendor/gopkg.in/yaml.v3/parserc.go b/vendor/gopkg.in/yaml.v3/parserc.go new file mode 100644 index 0000000..268558a --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/parserc.go @@ -0,0 +1,1258 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +import ( + "bytes" +) + +// The parser implements the following grammar: +// +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// implicit_document ::= block_node DOCUMENT-END* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// block_node_or_indentless_sequence ::= +// ALIAS +// | properties (block_content | indentless_block_sequence)? +// | block_content +// | indentless_block_sequence +// block_node ::= ALIAS +// | properties block_content? +// | block_content +// flow_node ::= ALIAS +// | properties flow_content? +// | flow_content +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// block_content ::= block_collection | flow_collection | SCALAR +// flow_content ::= flow_collection | SCALAR +// block_collection ::= block_sequence | block_mapping +// flow_collection ::= flow_sequence | flow_mapping +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// block_mapping ::= BLOCK-MAPPING_START +// ((KEY block_node_or_indentless_sequence?)? +// (VALUE block_node_or_indentless_sequence?)?)* +// BLOCK-END +// flow_sequence ::= FLOW-SEQUENCE-START +// (flow_sequence_entry FLOW-ENTRY)* +// flow_sequence_entry? +// FLOW-SEQUENCE-END +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// flow_mapping ::= FLOW-MAPPING-START +// (flow_mapping_entry FLOW-ENTRY)* +// flow_mapping_entry? +// FLOW-MAPPING-END +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + +// Peek the next token in the token queue. +func peek_token(parser *yaml_parser_t) *yaml_token_t { + if parser.token_available || yaml_parser_fetch_more_tokens(parser) { + token := &parser.tokens[parser.tokens_head] + yaml_parser_unfold_comments(parser, token) + return token + } + return nil +} + +// yaml_parser_unfold_comments walks through the comments queue and joins all +// comments behind the position of the provided token into the respective +// top-level comment slices in the parser. +func yaml_parser_unfold_comments(parser *yaml_parser_t, token *yaml_token_t) { + for parser.comments_head < len(parser.comments) && token.start_mark.index >= parser.comments[parser.comments_head].token_mark.index { + comment := &parser.comments[parser.comments_head] + if len(comment.head) > 0 { + if token.typ == yaml_BLOCK_END_TOKEN { + // No heads on ends, so keep comment.head for a follow up token. + break + } + if len(parser.head_comment) > 0 { + parser.head_comment = append(parser.head_comment, '\n') + } + parser.head_comment = append(parser.head_comment, comment.head...) + } + if len(comment.foot) > 0 { + if len(parser.foot_comment) > 0 { + parser.foot_comment = append(parser.foot_comment, '\n') + } + parser.foot_comment = append(parser.foot_comment, comment.foot...) + } + if len(comment.line) > 0 { + if len(parser.line_comment) > 0 { + parser.line_comment = append(parser.line_comment, '\n') + } + parser.line_comment = append(parser.line_comment, comment.line...) + } + *comment = yaml_comment_t{} + parser.comments_head++ + } +} + +// Remove the next token from the queue (must be called after peek_token). +func skip_token(parser *yaml_parser_t) { + parser.token_available = false + parser.tokens_parsed++ + parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN + parser.tokens_head++ +} + +// Get the next event. +func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { + // Erase the event object. + *event = yaml_event_t{} + + // No events after the end of the stream or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { + return true + } + + // Generate the next event. + return yaml_parser_state_machine(parser, event) +} + +// Set parser error. +func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +// State dispatcher. +func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { + //trace("yaml_parser_state_machine", "state:", parser.state.String()) + + switch parser.state { + case yaml_PARSE_STREAM_START_STATE: + return yaml_parser_parse_stream_start(parser, event) + + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, true) + + case yaml_PARSE_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, false) + + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return yaml_parser_parse_document_content(parser, event) + + case yaml_PARSE_DOCUMENT_END_STATE: + return yaml_parser_parse_document_end(parser, event) + + case yaml_PARSE_BLOCK_NODE_STATE: + return yaml_parser_parse_node(parser, event, true, false) + + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return yaml_parser_parse_node(parser, event, true, true) + + case yaml_PARSE_FLOW_NODE_STATE: + return yaml_parser_parse_node(parser, event, false, false) + + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, true) + + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, false) + + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_indentless_sequence_entry(parser, event) + + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, true) + + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, false) + + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return yaml_parser_parse_block_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, true) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, false) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) + + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, true) + + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, true) + + default: + panic("invalid parser state") + } +} + +// Parse the production: +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// ************ +func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_STREAM_START_TOKEN { + return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) + } + parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + encoding: token.encoding, + } + skip_token(parser) + return true +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// * +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// ************************* +func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + // Parse extra document end indicators. + if !implicit { + for token.typ == yaml_DOCUMENT_END_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && + token.typ != yaml_TAG_DIRECTIVE_TOKEN && + token.typ != yaml_DOCUMENT_START_TOKEN && + token.typ != yaml_STREAM_END_TOKEN { + // Parse an implicit document. + if !yaml_parser_process_directives(parser, nil, nil) { + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_BLOCK_NODE_STATE + + var head_comment []byte + if len(parser.head_comment) > 0 { + // [Go] Scan the header comment backwards, and if an empty line is found, break + // the header so the part before the last empty line goes into the + // document header, while the bottom of it goes into a follow up event. + for i := len(parser.head_comment) - 1; i > 0; i-- { + if parser.head_comment[i] == '\n' { + if i == len(parser.head_comment)-1 { + head_comment = parser.head_comment[:i] + parser.head_comment = parser.head_comment[i+1:] + break + } else if parser.head_comment[i-1] == '\n' { + head_comment = parser.head_comment[:i-1] + parser.head_comment = parser.head_comment[i+1:] + break + } + } + } + } + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + + head_comment: head_comment, + } + + } else if token.typ != yaml_STREAM_END_TOKEN { + // Parse an explicit document. + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + start_mark := token.start_mark + if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { + return false + } + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_DOCUMENT_START_TOKEN { + yaml_parser_set_parser_error(parser, + "did not find expected ", token.start_mark) + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE + end_mark := token.end_mark + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: false, + } + skip_token(parser) + + } else { + // Parse the stream end. + parser.state = yaml_PARSE_END_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + } + + return true +} + +// Parse the productions: +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// *********** +// +func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || + token.typ == yaml_TAG_DIRECTIVE_TOKEN || + token.typ == yaml_DOCUMENT_START_TOKEN || + token.typ == yaml_DOCUMENT_END_TOKEN || + token.typ == yaml_STREAM_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } + return yaml_parser_parse_node(parser, event, true, false) +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// ************* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// +func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + start_mark := token.start_mark + end_mark := token.start_mark + + implicit := true + if token.typ == yaml_DOCUMENT_END_TOKEN { + end_mark = token.end_mark + skip_token(parser) + implicit = false + } + + parser.tag_directives = parser.tag_directives[:0] + + parser.state = yaml_PARSE_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + start_mark: start_mark, + end_mark: end_mark, + implicit: implicit, + } + yaml_parser_set_event_comments(parser, event) + if len(event.head_comment) > 0 && len(event.foot_comment) == 0 { + event.foot_comment = event.head_comment + event.head_comment = nil + } + return true +} + +func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) { + event.head_comment = parser.head_comment + event.line_comment = parser.line_comment + event.foot_comment = parser.foot_comment + parser.head_comment = nil + parser.line_comment = nil + parser.foot_comment = nil + parser.tail_comment = nil + parser.stem_comment = nil +} + +// Parse the productions: +// block_node_or_indentless_sequence ::= +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// block_node ::= ALIAS +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// flow_node ::= ALIAS +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// ************************* +// block_content ::= block_collection | flow_collection | SCALAR +// ****** +// flow_content ::= flow_collection | SCALAR +// ****** +func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { + //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_ALIAS_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + anchor: token.value, + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true + } + + start_mark := token.start_mark + end_mark := token.start_mark + + var tag_token bool + var tag_handle, tag_suffix, anchor []byte + var tag_mark yaml_mark_t + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + start_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } else if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + start_mark = token.start_mark + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + var tag []byte + if tag_token { + if len(tag_handle) == 0 { + tag = tag_suffix + tag_suffix = nil + } else { + for i := range parser.tag_directives { + if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { + tag = append([]byte(nil), parser.tag_directives[i].prefix...) + tag = append(tag, tag_suffix...) + break + } + } + if len(tag) == 0 { + yaml_parser_set_parser_error_context(parser, + "while parsing a node", start_mark, + "found undefined tag handle", tag_mark) + return false + } + } + } + + implicit := len(tag) == 0 + if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + return true + } + if token.typ == yaml_SCALAR_TOKEN { + var plain_implicit, quoted_implicit bool + end_mark = token.end_mark + if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { + plain_implicit = true + } else if len(tag) == 0 { + quoted_implicit = true + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + value: token.value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(token.style), + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true + } + if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { + // [Go] Some of the events below can be merged as they differ only on style. + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), + } + yaml_parser_set_event_comments(parser, event) + return true + } + if token.typ == yaml_FLOW_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + yaml_parser_set_event_comments(parser, event) + return true + } + if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + if parser.stem_comment != nil { + event.head_comment = parser.stem_comment + parser.stem_comment = nil + } + return true + } + if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), + } + if parser.stem_comment != nil { + event.head_comment = parser.stem_comment + parser.stem_comment = nil + } + return true + } + if len(anchor) > 0 || len(tag) > 0 { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + quoted_implicit: false, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true + } + + context := "while parsing a flow node" + if block { + context = "while parsing a block node" + } + yaml_parser_set_parser_error_context(parser, context, start_mark, + "did not find expected node content", token.start_mark) + return false +} + +// Parse the productions: +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// ******************** *********** * ********* +// +func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + if token == nil { + return false + } + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + prior_head_len := len(parser.head_comment) + skip_token(parser) + yaml_parser_split_stem_comment(parser, prior_head_len) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } else { + parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } + if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block collection", context_mark, + "did not find expected '-' indicator", token.start_mark) +} + +// Parse the productions: +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// *********** * +func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + prior_head_len := len(parser.head_comment) + skip_token(parser) + yaml_parser_split_stem_comment(parser, prior_head_len) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && + token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? + } + return true +} + +// Split stem comment from head comment. +// +// When a sequence or map is found under a sequence entry, the former head comment +// is assigned to the underlying sequence or map as a whole, not the individual +// sequence or map entry as would be expected otherwise. To handle this case the +// previous head comment is moved aside as the stem comment. +func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { + if stem_len == 0 { + return + } + + token := peek_token(parser) + if token == nil || token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN { + return + } + + parser.stem_comment = parser.head_comment[:stem_len] + if len(parser.head_comment) == stem_len { + parser.head_comment = nil + } else { + // Copy suffix to prevent very strange bugs if someone ever appends + // further bytes to the prefix in the stem_comment slice above. + parser.head_comment = append([]byte(nil), parser.head_comment[stem_len+1:]...) + } +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* +// +// BLOCK-END +// ********* +// +func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + if token == nil { + return false + } + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + // [Go] A tail comment was left from the prior mapping value processed. Emit an event + // as it needs to be processed with that value and not the following key. + if len(parser.tail_comment) > 0 { + *event = yaml_event_t{ + typ: yaml_TAIL_COMMENT_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + foot_comment: parser.tail_comment, + } + parser.tail_comment = nil + return true + } + + if token.typ == yaml_KEY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block mapping", context_mark, + "did not find expected key", token.start_mark) +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// +// ((KEY block_node_or_indentless_sequence?)? +// +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END +// +// +func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence ::= FLOW-SEQUENCE-START +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * +// +func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + if token == nil { + return false + } + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow sequence", context_mark, + "did not find expected ',' or ']'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + implicit: true, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + skip_token(parser) + return true + } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + yaml_parser_set_event_comments(parser, event) + + skip_token(parser) + return true +} + +// +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// *** * +// +func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + mark := token.end_mark + skip_token(parser) + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// ***** * +// +func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * +// +func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? + } + return true +} + +// Parse the productions: +// flow_mapping ::= FLOW-MAPPING-START +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * *** * +// +func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow mapping", context_mark, + "did not find expected ',' or '}'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } else { + parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true +} + +// Parse the productions: +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * ***** * +// +func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { + token := peek_token(parser) + if token == nil { + return false + } + if empty { + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Generate an empty scalar event. +func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: mark, + end_mark: mark, + value: nil, // Empty + implicit: true, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true +} + +var default_tag_directives = []yaml_tag_directive_t{ + {[]byte("!"), []byte("!")}, + {[]byte("!!"), []byte("tag:yaml.org,2002:")}, +} + +// Parse directives. +func yaml_parser_process_directives(parser *yaml_parser_t, + version_directive_ref **yaml_version_directive_t, + tag_directives_ref *[]yaml_tag_directive_t) bool { + + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + + token := peek_token(parser) + if token == nil { + return false + } + + for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { + if version_directive != nil { + yaml_parser_set_parser_error(parser, + "found duplicate %YAML directive", token.start_mark) + return false + } + if token.major != 1 || token.minor != 1 { + yaml_parser_set_parser_error(parser, + "found incompatible YAML document", token.start_mark) + return false + } + version_directive = &yaml_version_directive_t{ + major: token.major, + minor: token.minor, + } + } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { + value := yaml_tag_directive_t{ + handle: token.value, + prefix: token.prefix, + } + if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { + return false + } + tag_directives = append(tag_directives, value) + } + + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + + for i := range default_tag_directives { + if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { + return false + } + } + + if version_directive_ref != nil { + *version_directive_ref = version_directive + } + if tag_directives_ref != nil { + *tag_directives_ref = tag_directives + } + return true +} + +// Append a tag directive to the directives stack. +func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { + for i := range parser.tag_directives { + if bytes.Equal(value.handle, parser.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) + } + } + + // [Go] I suspect the copy is unnecessary. This was likely done + // because there was no way to track ownership of the data. + value_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(value_copy.handle, value.handle) + copy(value_copy.prefix, value.prefix) + parser.tag_directives = append(parser.tag_directives, value_copy) + return true +} diff --git a/vendor/gopkg.in/yaml.v3/readerc.go b/vendor/gopkg.in/yaml.v3/readerc.go new file mode 100644 index 0000000..b7de0a8 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/readerc.go @@ -0,0 +1,434 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +import ( + "io" +) + +// Set the reader error and return 0. +func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { + parser.error = yaml_READER_ERROR + parser.problem = problem + parser.problem_offset = offset + parser.problem_value = value + return false +} + +// Byte order marks. +const ( + bom_UTF8 = "\xef\xbb\xbf" + bom_UTF16LE = "\xff\xfe" + bom_UTF16BE = "\xfe\xff" +) + +// Determine the input stream encoding by checking the BOM symbol. If no BOM is +// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. +func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { + // Ensure that we had enough bytes in the raw buffer. + for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { + if !yaml_parser_update_raw_buffer(parser) { + return false + } + } + + // Determine the encoding. + buf := parser.raw_buffer + pos := parser.raw_buffer_pos + avail := len(buf) - pos + if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { + parser.encoding = yaml_UTF16LE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { + parser.encoding = yaml_UTF16BE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { + parser.encoding = yaml_UTF8_ENCODING + parser.raw_buffer_pos += 3 + parser.offset += 3 + } else { + parser.encoding = yaml_UTF8_ENCODING + } + return true +} + +// Update the raw buffer. +func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { + size_read := 0 + + // Return if the raw buffer is full. + if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { + return true + } + + // Return on EOF. + if parser.eof { + return true + } + + // Move the remaining bytes in the raw buffer to the beginning. + if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { + copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) + } + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] + parser.raw_buffer_pos = 0 + + // Call the read handler to fill the buffer. + size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] + if err == io.EOF { + parser.eof = true + } else if err != nil { + return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) + } + return true +} + +// Ensure that the buffer contains at least `length` characters. +// Return true on success, false on failure. +// +// The length is supposed to be significantly less that the buffer size. +func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { + if parser.read_handler == nil { + panic("read handler must be set") + } + + // [Go] This function was changed to guarantee the requested length size at EOF. + // The fact we need to do this is pretty awful, but the description above implies + // for that to be the case, and there are tests + + // If the EOF flag is set and the raw buffer is empty, do nothing. + if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { + // [Go] ACTUALLY! Read the documentation of this function above. + // This is just broken. To return true, we need to have the + // given length in the buffer. Not doing that means every single + // check that calls this function to make sure the buffer has a + // given length is Go) panicking; or C) accessing invalid memory. + //return true + } + + // Return if the buffer contains enough characters. + if parser.unread >= length { + return true + } + + // Determine the input encoding if it is not known yet. + if parser.encoding == yaml_ANY_ENCODING { + if !yaml_parser_determine_encoding(parser) { + return false + } + } + + // Move the unread characters to the beginning of the buffer. + buffer_len := len(parser.buffer) + if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { + copy(parser.buffer, parser.buffer[parser.buffer_pos:]) + buffer_len -= parser.buffer_pos + parser.buffer_pos = 0 + } else if parser.buffer_pos == buffer_len { + buffer_len = 0 + parser.buffer_pos = 0 + } + + // Open the whole buffer for writing, and cut it before returning. + parser.buffer = parser.buffer[:cap(parser.buffer)] + + // Fill the buffer until it has enough characters. + first := true + for parser.unread < length { + + // Fill the raw buffer if necessary. + if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { + if !yaml_parser_update_raw_buffer(parser) { + parser.buffer = parser.buffer[:buffer_len] + return false + } + } + first = false + + // Decode the raw buffer. + inner: + for parser.raw_buffer_pos != len(parser.raw_buffer) { + var value rune + var width int + + raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos + + // Decode the next character. + switch parser.encoding { + case yaml_UTF8_ENCODING: + // Decode a UTF-8 character. Check RFC 3629 + // (http://www.ietf.org/rfc/rfc3629.txt) for more details. + // + // The following table (taken from the RFC) is used for + // decoding. + // + // Char. number range | UTF-8 octet sequence + // (hexadecimal) | (binary) + // --------------------+------------------------------------ + // 0000 0000-0000 007F | 0xxxxxxx + // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + // + // Additionally, the characters in the range 0xD800-0xDFFF + // are prohibited as they are reserved for use with UTF-16 + // surrogate pairs. + + // Determine the length of the UTF-8 sequence. + octet := parser.raw_buffer[parser.raw_buffer_pos] + switch { + case octet&0x80 == 0x00: + width = 1 + case octet&0xE0 == 0xC0: + width = 2 + case octet&0xF0 == 0xE0: + width = 3 + case octet&0xF8 == 0xF0: + width = 4 + default: + // The leading octet is invalid. + return yaml_parser_set_reader_error(parser, + "invalid leading UTF-8 octet", + parser.offset, int(octet)) + } + + // Check if the raw buffer contains an incomplete character. + if width > raw_unread { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-8 octet sequence", + parser.offset, -1) + } + break inner + } + + // Decode the leading octet. + switch { + case octet&0x80 == 0x00: + value = rune(octet & 0x7F) + case octet&0xE0 == 0xC0: + value = rune(octet & 0x1F) + case octet&0xF0 == 0xE0: + value = rune(octet & 0x0F) + case octet&0xF8 == 0xF0: + value = rune(octet & 0x07) + default: + value = 0 + } + + // Check and decode the trailing octets. + for k := 1; k < width; k++ { + octet = parser.raw_buffer[parser.raw_buffer_pos+k] + + // Check if the octet is valid. + if (octet & 0xC0) != 0x80 { + return yaml_parser_set_reader_error(parser, + "invalid trailing UTF-8 octet", + parser.offset+k, int(octet)) + } + + // Decode the octet. + value = (value << 6) + rune(octet&0x3F) + } + + // Check the length of the sequence against the value. + switch { + case width == 1: + case width == 2 && value >= 0x80: + case width == 3 && value >= 0x800: + case width == 4 && value >= 0x10000: + default: + return yaml_parser_set_reader_error(parser, + "invalid length of a UTF-8 sequence", + parser.offset, -1) + } + + // Check the range of the value. + if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { + return yaml_parser_set_reader_error(parser, + "invalid Unicode character", + parser.offset, int(value)) + } + + case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: + var low, high int + if parser.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + low, high = 1, 0 + } + + // The UTF-16 encoding is not as simple as one might + // naively think. Check RFC 2781 + // (http://www.ietf.org/rfc/rfc2781.txt). + // + // Normally, two subsequent bytes describe a Unicode + // character. However a special technique (called a + // surrogate pair) is used for specifying character + // values larger than 0xFFFF. + // + // A surrogate pair consists of two pseudo-characters: + // high surrogate area (0xD800-0xDBFF) + // low surrogate area (0xDC00-0xDFFF) + // + // The following formulas are used for decoding + // and encoding characters using surrogate pairs: + // + // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) + // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) + // W1 = 110110yyyyyyyyyy + // W2 = 110111xxxxxxxxxx + // + // where U is the character value, W1 is the high surrogate + // area, W2 is the low surrogate area. + + // Check for incomplete UTF-16 character. + if raw_unread < 2 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 character", + parser.offset, -1) + } + break inner + } + + // Get the character. + value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) + + // Check for unexpected low surrogate area. + if value&0xFC00 == 0xDC00 { + return yaml_parser_set_reader_error(parser, + "unexpected low surrogate area", + parser.offset, int(value)) + } + + // Check for a high surrogate area. + if value&0xFC00 == 0xD800 { + width = 4 + + // Check for incomplete surrogate pair. + if raw_unread < 4 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 surrogate pair", + parser.offset, -1) + } + break inner + } + + // Get the next character. + value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) + + // Check for a low surrogate area. + if value2&0xFC00 != 0xDC00 { + return yaml_parser_set_reader_error(parser, + "expected low surrogate area", + parser.offset+2, int(value2)) + } + + // Generate the value of the surrogate pair. + value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) + } else { + width = 2 + } + + default: + panic("impossible") + } + + // Check if the character is in the allowed range: + // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) + // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) + // | [#x10000-#x10FFFF] (32 bit) + switch { + case value == 0x09: + case value == 0x0A: + case value == 0x0D: + case value >= 0x20 && value <= 0x7E: + case value == 0x85: + case value >= 0xA0 && value <= 0xD7FF: + case value >= 0xE000 && value <= 0xFFFD: + case value >= 0x10000 && value <= 0x10FFFF: + default: + return yaml_parser_set_reader_error(parser, + "control characters are not allowed", + parser.offset, int(value)) + } + + // Move the raw pointers. + parser.raw_buffer_pos += width + parser.offset += width + + // Finally put the character into the buffer. + if value <= 0x7F { + // 0000 0000-0000 007F . 0xxxxxxx + parser.buffer[buffer_len+0] = byte(value) + buffer_len += 1 + } else if value <= 0x7FF { + // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) + parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) + buffer_len += 2 + } else if value <= 0xFFFF { + // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) + buffer_len += 3 + } else { + // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) + buffer_len += 4 + } + + parser.unread++ + } + + // On EOF, put NUL into the buffer and return. + if parser.eof { + parser.buffer[buffer_len] = 0 + buffer_len++ + parser.unread++ + break + } + } + // [Go] Read the documentation of this function above. To return true, + // we need to have the given length in the buffer. Not doing that means + // every single check that calls this function to make sure the buffer + // has a given length is Go) panicking; or C) accessing invalid memory. + // This happens here due to the EOF above breaking early. + for buffer_len < length { + parser.buffer[buffer_len] = 0 + buffer_len++ + } + parser.buffer = parser.buffer[:buffer_len] + return true +} diff --git a/vendor/gopkg.in/yaml.v3/resolve.go b/vendor/gopkg.in/yaml.v3/resolve.go new file mode 100644 index 0000000..64ae888 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/resolve.go @@ -0,0 +1,326 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yaml + +import ( + "encoding/base64" + "math" + "regexp" + "strconv" + "strings" + "time" +) + +type resolveMapItem struct { + value interface{} + tag string +} + +var resolveTable = make([]byte, 256) +var resolveMap = make(map[string]resolveMapItem) + +func init() { + t := resolveTable + t[int('+')] = 'S' // Sign + t[int('-')] = 'S' + for _, c := range "0123456789" { + t[int(c)] = 'D' // Digit + } + for _, c := range "yYnNtTfFoO~" { + t[int(c)] = 'M' // In map + } + t[int('.')] = '.' // Float (potentially in map) + + var resolveMapList = []struct { + v interface{} + tag string + l []string + }{ + {true, boolTag, []string{"true", "True", "TRUE"}}, + {false, boolTag, []string{"false", "False", "FALSE"}}, + {nil, nullTag, []string{"", "~", "null", "Null", "NULL"}}, + {math.NaN(), floatTag, []string{".nan", ".NaN", ".NAN"}}, + {math.Inf(+1), floatTag, []string{".inf", ".Inf", ".INF"}}, + {math.Inf(+1), floatTag, []string{"+.inf", "+.Inf", "+.INF"}}, + {math.Inf(-1), floatTag, []string{"-.inf", "-.Inf", "-.INF"}}, + {"<<", mergeTag, []string{"<<"}}, + } + + m := resolveMap + for _, item := range resolveMapList { + for _, s := range item.l { + m[s] = resolveMapItem{item.v, item.tag} + } + } +} + +const ( + nullTag = "!!null" + boolTag = "!!bool" + strTag = "!!str" + intTag = "!!int" + floatTag = "!!float" + timestampTag = "!!timestamp" + seqTag = "!!seq" + mapTag = "!!map" + binaryTag = "!!binary" + mergeTag = "!!merge" +) + +var longTags = make(map[string]string) +var shortTags = make(map[string]string) + +func init() { + for _, stag := range []string{nullTag, boolTag, strTag, intTag, floatTag, timestampTag, seqTag, mapTag, binaryTag, mergeTag} { + ltag := longTag(stag) + longTags[stag] = ltag + shortTags[ltag] = stag + } +} + +const longTagPrefix = "tag:yaml.org,2002:" + +func shortTag(tag string) string { + if strings.HasPrefix(tag, longTagPrefix) { + if stag, ok := shortTags[tag]; ok { + return stag + } + return "!!" + tag[len(longTagPrefix):] + } + return tag +} + +func longTag(tag string) string { + if strings.HasPrefix(tag, "!!") { + if ltag, ok := longTags[tag]; ok { + return ltag + } + return longTagPrefix + tag[2:] + } + return tag +} + +func resolvableTag(tag string) bool { + switch tag { + case "", strTag, boolTag, intTag, floatTag, nullTag, timestampTag: + return true + } + return false +} + +var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) + +func resolve(tag string, in string) (rtag string, out interface{}) { + tag = shortTag(tag) + if !resolvableTag(tag) { + return tag, in + } + + defer func() { + switch tag { + case "", rtag, strTag, binaryTag: + return + case floatTag: + if rtag == intTag { + switch v := out.(type) { + case int64: + rtag = floatTag + out = float64(v) + return + case int: + rtag = floatTag + out = float64(v) + return + } + } + } + failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) + }() + + // Any data is accepted as a !!str or !!binary. + // Otherwise, the prefix is enough of a hint about what it might be. + hint := byte('N') + if in != "" { + hint = resolveTable[in[0]] + } + if hint != 0 && tag != strTag && tag != binaryTag { + // Handle things we can lookup in a map. + if item, ok := resolveMap[in]; ok { + return item.tag, item.value + } + + // Base 60 floats are a bad idea, were dropped in YAML 1.2, and + // are purposefully unsupported here. They're still quoted on + // the way out for compatibility with other parser, though. + + switch hint { + case 'M': + // We've already checked the map above. + + case '.': + // Not in the map, so maybe a normal float. + floatv, err := strconv.ParseFloat(in, 64) + if err == nil { + return floatTag, floatv + } + + case 'D', 'S': + // Int, float, or timestamp. + // Only try values as a timestamp if the value is unquoted or there's an explicit + // !!timestamp tag. + if tag == "" || tag == timestampTag { + t, ok := parseTimestamp(in) + if ok { + return timestampTag, t + } + } + + plain := strings.Replace(in, "_", "", -1) + intv, err := strconv.ParseInt(plain, 0, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain, 0, 64) + if err == nil { + return intTag, uintv + } + if yamlStyleFloat.MatchString(plain) { + floatv, err := strconv.ParseFloat(plain, 64) + if err == nil { + return floatTag, floatv + } + } + if strings.HasPrefix(plain, "0b") { + intv, err := strconv.ParseInt(plain[2:], 2, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 2, 64) + if err == nil { + return intTag, uintv + } + } else if strings.HasPrefix(plain, "-0b") { + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) + if err == nil { + if true || intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + } + // Octals as introduced in version 1.2 of the spec. + // Octals from the 1.1 spec, spelled as 0777, are still + // decoded by default in v3 as well for compatibility. + // May be dropped in v4 depending on how usage evolves. + if strings.HasPrefix(plain, "0o") { + intv, err := strconv.ParseInt(plain[2:], 8, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 8, 64) + if err == nil { + return intTag, uintv + } + } else if strings.HasPrefix(plain, "-0o") { + intv, err := strconv.ParseInt("-"+plain[3:], 8, 64) + if err == nil { + if true || intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + } + default: + panic("internal error: missing handler for resolver table: " + string(rune(hint)) + " (with " + in + ")") + } + } + return strTag, in +} + +// encodeBase64 encodes s as base64 that is broken up into multiple lines +// as appropriate for the resulting length. +func encodeBase64(s string) string { + const lineLen = 70 + encLen := base64.StdEncoding.EncodedLen(len(s)) + lines := encLen/lineLen + 1 + buf := make([]byte, encLen*2+lines) + in := buf[0:encLen] + out := buf[encLen:] + base64.StdEncoding.Encode(in, []byte(s)) + k := 0 + for i := 0; i < len(in); i += lineLen { + j := i + lineLen + if j > len(in) { + j = len(in) + } + k += copy(out[k:], in[i:j]) + if lines > 1 { + out[k] = '\n' + k++ + } + } + return string(out[:k]) +} + +// This is a subset of the formats allowed by the regular expression +// defined at http://yaml.org/type/timestamp.html. +var allowedTimestampFormats = []string{ + "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields. + "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t". + "2006-1-2 15:4:5.999999999", // space separated with no time zone + "2006-1-2", // date only + // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" + // from the set of examples. +} + +// parseTimestamp parses s as a timestamp string and +// returns the timestamp and reports whether it succeeded. +// Timestamp formats are defined at http://yaml.org/type/timestamp.html +func parseTimestamp(s string) (time.Time, bool) { + // TODO write code to check all the formats supported by + // http://yaml.org/type/timestamp.html instead of using time.Parse. + + // Quick check: all date formats start with YYYY-. + i := 0 + for ; i < len(s); i++ { + if c := s[i]; c < '0' || c > '9' { + break + } + } + if i != 4 || i == len(s) || s[i] != '-' { + return time.Time{}, false + } + for _, format := range allowedTimestampFormats { + if t, err := time.Parse(format, s); err == nil { + return t, true + } + } + return time.Time{}, false +} diff --git a/vendor/gopkg.in/yaml.v3/scannerc.go b/vendor/gopkg.in/yaml.v3/scannerc.go new file mode 100644 index 0000000..ca00701 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/scannerc.go @@ -0,0 +1,3038 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +import ( + "bytes" + "fmt" +) + +// Introduction +// ************ +// +// The following notes assume that you are familiar with the YAML specification +// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in +// some cases we are less restrictive that it requires. +// +// The process of transforming a YAML stream into a sequence of events is +// divided on two steps: Scanning and Parsing. +// +// The Scanner transforms the input stream into a sequence of tokens, while the +// parser transform the sequence of tokens produced by the Scanner into a +// sequence of parsing events. +// +// The Scanner is rather clever and complicated. The Parser, on the contrary, +// is a straightforward implementation of a recursive-descendant parser (or, +// LL(1) parser, as it is usually called). +// +// Actually there are two issues of Scanning that might be called "clever", the +// rest is quite straightforward. The issues are "block collection start" and +// "simple keys". Both issues are explained below in details. +// +// Here the Scanning step is explained and implemented. We start with the list +// of all the tokens produced by the Scanner together with short descriptions. +// +// Now, tokens: +// +// STREAM-START(encoding) # The stream start. +// STREAM-END # The stream end. +// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. +// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. +// DOCUMENT-START # '---' +// DOCUMENT-END # '...' +// BLOCK-SEQUENCE-START # Indentation increase denoting a block +// BLOCK-MAPPING-START # sequence or a block mapping. +// BLOCK-END # Indentation decrease. +// FLOW-SEQUENCE-START # '[' +// FLOW-SEQUENCE-END # ']' +// BLOCK-SEQUENCE-START # '{' +// BLOCK-SEQUENCE-END # '}' +// BLOCK-ENTRY # '-' +// FLOW-ENTRY # ',' +// KEY # '?' or nothing (simple keys). +// VALUE # ':' +// ALIAS(anchor) # '*anchor' +// ANCHOR(anchor) # '&anchor' +// TAG(handle,suffix) # '!handle!suffix' +// SCALAR(value,style) # A scalar. +// +// The following two tokens are "virtual" tokens denoting the beginning and the +// end of the stream: +// +// STREAM-START(encoding) +// STREAM-END +// +// We pass the information about the input stream encoding with the +// STREAM-START token. +// +// The next two tokens are responsible for tags: +// +// VERSION-DIRECTIVE(major,minor) +// TAG-DIRECTIVE(handle,prefix) +// +// Example: +// +// %YAML 1.1 +// %TAG ! !foo +// %TAG !yaml! tag:yaml.org,2002: +// --- +// +// The correspoding sequence of tokens: +// +// STREAM-START(utf-8) +// VERSION-DIRECTIVE(1,1) +// TAG-DIRECTIVE("!","!foo") +// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") +// DOCUMENT-START +// STREAM-END +// +// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole +// line. +// +// The document start and end indicators are represented by: +// +// DOCUMENT-START +// DOCUMENT-END +// +// Note that if a YAML stream contains an implicit document (without '---' +// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be +// produced. +// +// In the following examples, we present whole documents together with the +// produced tokens. +// +// 1. An implicit document: +// +// 'a scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// STREAM-END +// +// 2. An explicit document: +// +// --- +// 'a scalar' +// ... +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// SCALAR("a scalar",single-quoted) +// DOCUMENT-END +// STREAM-END +// +// 3. Several documents in a stream: +// +// 'a scalar' +// --- +// 'another scalar' +// --- +// 'yet another scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// DOCUMENT-START +// SCALAR("another scalar",single-quoted) +// DOCUMENT-START +// SCALAR("yet another scalar",single-quoted) +// STREAM-END +// +// We have already introduced the SCALAR token above. The following tokens are +// used to describe aliases, anchors, tag, and scalars: +// +// ALIAS(anchor) +// ANCHOR(anchor) +// TAG(handle,suffix) +// SCALAR(value,style) +// +// The following series of examples illustrate the usage of these tokens: +// +// 1. A recursive sequence: +// +// &A [ *A ] +// +// Tokens: +// +// STREAM-START(utf-8) +// ANCHOR("A") +// FLOW-SEQUENCE-START +// ALIAS("A") +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A tagged scalar: +// +// !!float "3.14" # A good approximation. +// +// Tokens: +// +// STREAM-START(utf-8) +// TAG("!!","float") +// SCALAR("3.14",double-quoted) +// STREAM-END +// +// 3. Various scalar styles: +// +// --- # Implicit empty plain scalars do not produce tokens. +// --- a plain scalar +// --- 'a single-quoted scalar' +// --- "a double-quoted scalar" +// --- |- +// a literal scalar +// --- >- +// a folded +// scalar +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// DOCUMENT-START +// SCALAR("a plain scalar",plain) +// DOCUMENT-START +// SCALAR("a single-quoted scalar",single-quoted) +// DOCUMENT-START +// SCALAR("a double-quoted scalar",double-quoted) +// DOCUMENT-START +// SCALAR("a literal scalar",literal) +// DOCUMENT-START +// SCALAR("a folded scalar",folded) +// STREAM-END +// +// Now it's time to review collection-related tokens. We will start with +// flow collections: +// +// FLOW-SEQUENCE-START +// FLOW-SEQUENCE-END +// FLOW-MAPPING-START +// FLOW-MAPPING-END +// FLOW-ENTRY +// KEY +// VALUE +// +// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and +// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' +// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the +// indicators '?' and ':', which are used for denoting mapping keys and values, +// are represented by the KEY and VALUE tokens. +// +// The following examples show flow collections: +// +// 1. A flow sequence: +// +// [item 1, item 2, item 3] +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-SEQUENCE-START +// SCALAR("item 1",plain) +// FLOW-ENTRY +// SCALAR("item 2",plain) +// FLOW-ENTRY +// SCALAR("item 3",plain) +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A flow mapping: +// +// { +// a simple key: a value, # Note that the KEY token is produced. +// ? a complex key: another value, +// } +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// FLOW-ENTRY +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// FLOW-ENTRY +// FLOW-MAPPING-END +// STREAM-END +// +// A simple key is a key which is not denoted by the '?' indicator. Note that +// the Scanner still produce the KEY token whenever it encounters a simple key. +// +// For scanning block collections, the following tokens are used (note that we +// repeat KEY and VALUE here): +// +// BLOCK-SEQUENCE-START +// BLOCK-MAPPING-START +// BLOCK-END +// BLOCK-ENTRY +// KEY +// VALUE +// +// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation +// increase that precedes a block collection (cf. the INDENT token in Python). +// The token BLOCK-END denote indentation decrease that ends a block collection +// (cf. the DEDENT token in Python). However YAML has some syntax pecularities +// that makes detections of these tokens more complex. +// +// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators +// '-', '?', and ':' correspondingly. +// +// The following examples show how the tokens BLOCK-SEQUENCE-START, +// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: +// +// 1. Block sequences: +// +// - item 1 +// - item 2 +// - +// - item 3.1 +// - item 3.2 +// - +// key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 3.1",plain) +// BLOCK-ENTRY +// SCALAR("item 3.2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Block mappings: +// +// a simple key: a value # The KEY token is produced here. +// ? a complex key +// : another value +// a mapping: +// key 1: value 1 +// key 2: value 2 +// a sequence: +// - item 1 +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// KEY +// SCALAR("a mapping",plain) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML does not always require to start a new block collection from a new +// line. If the current line contains only '-', '?', and ':' indicators, a new +// block collection may start at the current line. The following examples +// illustrate this case: +// +// 1. Collections in a sequence: +// +// - - item 1 +// - item 2 +// - key 1: value 1 +// key 2: value 2 +// - ? complex key +// : complex value +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("complex key") +// VALUE +// SCALAR("complex value") +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Collections in a mapping: +// +// ? a sequence +// : - item 1 +// - item 2 +// ? a mapping +// : key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// KEY +// SCALAR("a mapping",plain) +// VALUE +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML also permits non-indented sequences if they are included into a block +// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: +// +// key: +// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key",plain) +// VALUE +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// + +// Ensure that the buffer contains the required number of characters. +// Return true on success, false on failure (reader error or memory error). +func cache(parser *yaml_parser_t, length int) bool { + // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) + return parser.unread >= length || yaml_parser_update_buffer(parser, length) +} + +// Advance the buffer pointer. +func skip(parser *yaml_parser_t) { + if !is_blank(parser.buffer, parser.buffer_pos) { + parser.newlines = 0 + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) +} + +func skip_line(parser *yaml_parser_t) { + if is_crlf(parser.buffer, parser.buffer_pos) { + parser.mark.index += 2 + parser.mark.column = 0 + parser.mark.line++ + parser.unread -= 2 + parser.buffer_pos += 2 + parser.newlines++ + } else if is_break(parser.buffer, parser.buffer_pos) { + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + parser.newlines++ + } +} + +// Copy a character to a string buffer and advance pointers. +func read(parser *yaml_parser_t, s []byte) []byte { + if !is_blank(parser.buffer, parser.buffer_pos) { + parser.newlines = 0 + } + w := width(parser.buffer[parser.buffer_pos]) + if w == 0 { + panic("invalid character sequence") + } + if len(s) == 0 { + s = make([]byte, 0, 32) + } + if w == 1 && len(s)+w <= cap(s) { + s = s[:len(s)+1] + s[len(s)-1] = parser.buffer[parser.buffer_pos] + parser.buffer_pos++ + } else { + s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) + parser.buffer_pos += w + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + return s +} + +// Copy a line break character to a string buffer and advance pointers. +func read_line(parser *yaml_parser_t, s []byte) []byte { + buf := parser.buffer + pos := parser.buffer_pos + switch { + case buf[pos] == '\r' && buf[pos+1] == '\n': + // CR LF . LF + s = append(s, '\n') + parser.buffer_pos += 2 + parser.mark.index++ + parser.unread-- + case buf[pos] == '\r' || buf[pos] == '\n': + // CR|LF . LF + s = append(s, '\n') + parser.buffer_pos += 1 + case buf[pos] == '\xC2' && buf[pos+1] == '\x85': + // NEL . LF + s = append(s, '\n') + parser.buffer_pos += 2 + case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): + // LS|PS . LS|PS + s = append(s, buf[parser.buffer_pos:pos+3]...) + parser.buffer_pos += 3 + default: + return s + } + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.newlines++ + return s +} + +// Get the next token. +func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { + // Erase the token object. + *token = yaml_token_t{} // [Go] Is this necessary? + + // No tokens after STREAM-END or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR { + return true + } + + // Ensure that the tokens queue contains enough tokens. + if !parser.token_available { + if !yaml_parser_fetch_more_tokens(parser) { + return false + } + } + + // Fetch the next token from the queue. + *token = parser.tokens[parser.tokens_head] + parser.tokens_head++ + parser.tokens_parsed++ + parser.token_available = false + + if token.typ == yaml_STREAM_END_TOKEN { + parser.stream_end_produced = true + } + return true +} + +// Set the scanner error and return false. +func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { + parser.error = yaml_SCANNER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = parser.mark + return false +} + +func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { + context := "while parsing a tag" + if directive { + context = "while parsing a %TAG directive" + } + return yaml_parser_set_scanner_error(parser, context, context_mark, problem) +} + +func trace(args ...interface{}) func() { + pargs := append([]interface{}{"+++"}, args...) + fmt.Println(pargs...) + pargs = append([]interface{}{"---"}, args...) + return func() { fmt.Println(pargs...) } +} + +// Ensure that the tokens queue contains at least one token which can be +// returned to the Parser. +func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { + // While we need more tokens to fetch, do it. + for { + // [Go] The comment parsing logic requires a lookahead of two tokens + // so that foot comments may be parsed in time of associating them + // with the tokens that are parsed before them, and also for line + // comments to be transformed into head comments in some edge cases. + if parser.tokens_head < len(parser.tokens)-2 { + // If a potential simple key is at the head position, we need to fetch + // the next token to disambiguate it. + head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] + if !ok { + break + } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { + return false + } else if !valid { + break + } + } + // Fetch the next token. + if !yaml_parser_fetch_next_token(parser) { + return false + } + } + + parser.token_available = true + return true +} + +// The dispatcher for token fetchers. +func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) { + // Ensure that the buffer is initialized. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we just started scanning. Fetch STREAM-START then. + if !parser.stream_start_produced { + return yaml_parser_fetch_stream_start(parser) + } + + scan_mark := parser.mark + + // Eat whitespaces and comments until we reach the next token. + if !yaml_parser_scan_to_next_token(parser) { + return false + } + + // [Go] While unrolling indents, transform the head comments of prior + // indentation levels observed after scan_start into foot comments at + // the respective indexes. + + // Check the indentation level against the current column. + if !yaml_parser_unroll_indent(parser, parser.mark.column, scan_mark) { + return false + } + + // Ensure that the buffer contains at least 4 characters. 4 is the length + // of the longest indicators ('--- ' and '... '). + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + // Is it the end of the stream? + if is_z(parser.buffer, parser.buffer_pos) { + return yaml_parser_fetch_stream_end(parser) + } + + // Is it a directive? + if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { + return yaml_parser_fetch_directive(parser) + } + + buf := parser.buffer + pos := parser.buffer_pos + + // Is it the document start indicator? + if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) + } + + // Is it the document end indicator? + if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) + } + + comment_mark := parser.mark + if len(parser.tokens) > 0 && (parser.flow_level == 0 && buf[pos] == ':' || parser.flow_level > 0 && buf[pos] == ',') { + // Associate any following comments with the prior token. + comment_mark = parser.tokens[len(parser.tokens)-1].start_mark + } + defer func() { + if !ok { + return + } + if len(parser.tokens) > 0 && parser.tokens[len(parser.tokens)-1].typ == yaml_BLOCK_ENTRY_TOKEN { + // Sequence indicators alone have no line comments. It becomes + // a head comment for whatever follows. + return + } + if !yaml_parser_scan_line_comment(parser, comment_mark) { + ok = false + return + } + }() + + // Is it the flow sequence start indicator? + if buf[pos] == '[' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) + } + + // Is it the flow mapping start indicator? + if parser.buffer[parser.buffer_pos] == '{' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) + } + + // Is it the flow sequence end indicator? + if parser.buffer[parser.buffer_pos] == ']' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_SEQUENCE_END_TOKEN) + } + + // Is it the flow mapping end indicator? + if parser.buffer[parser.buffer_pos] == '}' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_MAPPING_END_TOKEN) + } + + // Is it the flow entry indicator? + if parser.buffer[parser.buffer_pos] == ',' { + return yaml_parser_fetch_flow_entry(parser) + } + + // Is it the block entry indicator? + if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { + return yaml_parser_fetch_block_entry(parser) + } + + // Is it the key indicator? + if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_key(parser) + } + + // Is it the value indicator? + if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_value(parser) + } + + // Is it an alias? + if parser.buffer[parser.buffer_pos] == '*' { + return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) + } + + // Is it an anchor? + if parser.buffer[parser.buffer_pos] == '&' { + return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) + } + + // Is it a tag? + if parser.buffer[parser.buffer_pos] == '!' { + return yaml_parser_fetch_tag(parser) + } + + // Is it a literal scalar? + if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, true) + } + + // Is it a folded scalar? + if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, false) + } + + // Is it a single-quoted scalar? + if parser.buffer[parser.buffer_pos] == '\'' { + return yaml_parser_fetch_flow_scalar(parser, true) + } + + // Is it a double-quoted scalar? + if parser.buffer[parser.buffer_pos] == '"' { + return yaml_parser_fetch_flow_scalar(parser, false) + } + + // Is it a plain scalar? + // + // A plain scalar may start with any non-blank characters except + // + // '-', '?', ':', ',', '[', ']', '{', '}', + // '#', '&', '*', '!', '|', '>', '\'', '\"', + // '%', '@', '`'. + // + // In the block context (and, for the '-' indicator, in the flow context + // too), it may also start with the characters + // + // '-', '?', ':' + // + // if it is followed by a non-space character. + // + // The last rule is more restrictive than the specification requires. + // [Go] TODO Make this logic more reasonable. + //switch parser.buffer[parser.buffer_pos] { + //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': + //} + if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || + parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || + parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || + (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level == 0 && + (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && + !is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_plain_scalar(parser) + } + + // If we don't determine the token type so far, it is an error. + return yaml_parser_set_scanner_error(parser, + "while scanning for the next token", parser.mark, + "found character that cannot start any token") +} + +func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { + if !simple_key.possible { + return false, true + } + + // The 1.2 specification says: + // + // "If the ? indicator is omitted, parsing needs to see past the + // implicit key to recognize it as such. To limit the amount of + // lookahead required, the “:” indicator must appear at most 1024 + // Unicode characters beyond the start of the key. In addition, the key + // is restricted to a single line." + // + if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { + // Check if the potential simple key to be removed is required. + if simple_key.required { + return false, yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") + } + simple_key.possible = false + return false, true + } + return true, true +} + +// Check if a simple key may start at the current position and add it if +// needed. +func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { + // A simple key is required at the current position if the scanner is in + // the block context and the current column coincides with the indentation + // level. + + required := parser.flow_level == 0 && parser.indent == parser.mark.column + + // + // If the current position may start a simple key, save it. + // + if parser.simple_key_allowed { + simple_key := yaml_simple_key_t{ + possible: true, + required: required, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + } + + if !yaml_parser_remove_simple_key(parser) { + return false + } + parser.simple_keys[len(parser.simple_keys)-1] = simple_key + parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 + } + return true +} + +// Remove a potential simple key at the current flow level. +func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { + i := len(parser.simple_keys) - 1 + if parser.simple_keys[i].possible { + // If the key is required, it is an error. + if parser.simple_keys[i].required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", parser.simple_keys[i].mark, + "could not find expected ':'") + } + // Remove the key from the stack. + parser.simple_keys[i].possible = false + delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) + } + return true +} + +// max_flow_level limits the flow_level +const max_flow_level = 10000 + +// Increase the flow level and resize the simple key list if needed. +func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { + // Reset the simple key on the next level. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ + possible: false, + required: false, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + }) + + // Increase the flow level. + parser.flow_level++ + if parser.flow_level > max_flow_level { + return yaml_parser_set_scanner_error(parser, + "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_flow_level)) + } + return true +} + +// Decrease the flow level. +func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { + if parser.flow_level > 0 { + parser.flow_level-- + last := len(parser.simple_keys) - 1 + delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) + parser.simple_keys = parser.simple_keys[:last] + } + return true +} + +// max_indents limits the indents stack size +const max_indents = 10000 + +// Push the current indentation level to the stack and set the new level +// the current column is greater than the indentation level. In this case, +// append or insert the specified token into the token queue. +func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + if parser.indent < column { + // Push the current indentation level to the stack and set the new + // indentation level. + parser.indents = append(parser.indents, parser.indent) + parser.indent = column + if len(parser.indents) > max_indents { + return yaml_parser_set_scanner_error(parser, + "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_indents)) + } + + // Create a token and insert it into the queue. + token := yaml_token_t{ + typ: typ, + start_mark: mark, + end_mark: mark, + } + if number > -1 { + number -= parser.tokens_parsed + } + yaml_insert_token(parser, number, &token) + } + return true +} + +// Pop indentation levels from the indents stack until the current level +// becomes less or equal to the column. For each indentation level, append +// the BLOCK-END token. +func yaml_parser_unroll_indent(parser *yaml_parser_t, column int, scan_mark yaml_mark_t) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + block_mark := scan_mark + block_mark.index-- + + // Loop through the indentation levels in the stack. + for parser.indent > column { + + // [Go] Reposition the end token before potential following + // foot comments of parent blocks. For that, search + // backwards for recent comments that were at the same + // indent as the block that is ending now. + stop_index := block_mark.index + for i := len(parser.comments) - 1; i >= 0; i-- { + comment := &parser.comments[i] + + if comment.end_mark.index < stop_index { + // Don't go back beyond the start of the comment/whitespace scan, unless column < 0. + // If requested indent column is < 0, then the document is over and everything else + // is a foot anyway. + break + } + if comment.start_mark.column == parser.indent+1 { + // This is a good match. But maybe there's a former comment + // at that same indent level, so keep searching. + block_mark = comment.start_mark + } + + // While the end of the former comment matches with + // the start of the following one, we know there's + // nothing in between and scanning is still safe. + stop_index = comment.scan_mark.index + } + + // Create a token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_END_TOKEN, + start_mark: block_mark, + end_mark: block_mark, + } + yaml_insert_token(parser, -1, &token) + + // Pop the indentation level. + parser.indent = parser.indents[len(parser.indents)-1] + parser.indents = parser.indents[:len(parser.indents)-1] + } + return true +} + +// Initialize the scanner and produce the STREAM-START token. +func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { + + // Set the initial indentation. + parser.indent = -1 + + // Initialize the simple key stack. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + parser.simple_keys_by_tok = make(map[int]int) + + // A simple key is allowed at the beginning of the stream. + parser.simple_key_allowed = true + + // We have started. + parser.stream_start_produced = true + + // Create the STREAM-START token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_START_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + encoding: parser.encoding, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the STREAM-END token and shut down the scanner. +func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { + + // Force new line. + if parser.mark.column != 0 { + parser.mark.column = 0 + parser.mark.line++ + } + + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the STREAM-END token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. +func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. + token := yaml_token_t{} + if !yaml_parser_scan_directive(parser, &token) { + return false + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the DOCUMENT-START or DOCUMENT-END token. +func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Consume the token. + start_mark := parser.mark + + skip(parser) + skip(parser) + skip(parser) + + end_mark := parser.mark + + // Create the DOCUMENT-START or DOCUMENT-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. +func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { + + // The indicators '[' and '{' may start a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // Increase the flow level. + if !yaml_parser_increase_flow_level(parser) { + return false + } + + // A simple key may follow the indicators '[' and '{'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. +func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset any potential simple key on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Decrease the flow level. + if !yaml_parser_decrease_flow_level(parser) { + return false + } + + // No simple keys after the indicators ']' and '}'. + parser.simple_key_allowed = false + + // Consume the token. + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-ENTRY token. +func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after ','. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_FLOW_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the BLOCK-ENTRY token. +func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { + // Check if the scanner is in the block context. + if parser.flow_level == 0 { + // Check if we are allowed to start a new entry. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "block sequence entries are not allowed in this context") + } + // Add the BLOCK-SEQUENCE-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { + return false + } + } else { + // It is an error for the '-' indicator to occur in the flow context, + // but we let the Parser detect and report about it because the Parser + // is able to point to the context. + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '-'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the BLOCK-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the KEY token. +func yaml_parser_fetch_key(parser *yaml_parser_t) bool { + + // In the block context, additional checks are required. + if parser.flow_level == 0 { + // Check if we are allowed to start a new key (not nessesary simple). + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping keys are not allowed in this context") + } + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '?' in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the KEY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the VALUE token. +func yaml_parser_fetch_value(parser *yaml_parser_t) bool { + + simple_key := &parser.simple_keys[len(parser.simple_keys)-1] + + // Have we found a simple key? + if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok { + return false + + } else if valid { + + // Create the KEY token and insert it into the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: simple_key.mark, + end_mark: simple_key.mark, + } + yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) + + // In the block context, we may need to add the BLOCK-MAPPING-START token. + if !yaml_parser_roll_indent(parser, simple_key.mark.column, + simple_key.token_number, + yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { + return false + } + + // Remove the simple key. + simple_key.possible = false + delete(parser.simple_keys_by_tok, simple_key.token_number) + + // A simple key cannot follow another simple key. + parser.simple_key_allowed = false + + } else { + // The ':' indicator follows a complex key. + + // In the block context, extra checks are required. + if parser.flow_level == 0 { + + // Check if we are allowed to start a complex value. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping values are not allowed in this context") + } + + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Simple keys after ':' are allowed in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + } + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the VALUE token and append it to the queue. + token := yaml_token_t{ + typ: yaml_VALUE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the ALIAS or ANCHOR token. +func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // An anchor or an alias could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow an anchor or an alias. + parser.simple_key_allowed = false + + // Create the ALIAS or ANCHOR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_anchor(parser, &token, typ) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the TAG token. +func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { + // A tag could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a tag. + parser.simple_key_allowed = false + + // Create the TAG token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_tag(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. +func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { + // Remove any potential simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // A simple key may follow a block scalar. + parser.simple_key_allowed = true + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_block_scalar(parser, &token, literal) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. +func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_flow_scalar(parser, &token, single) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,plain) token. +func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_plain_scalar(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Eat whitespaces and comments until the next token is found. +func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { + + scan_mark := parser.mark + + // Until the next token is not found. + for { + // Allow the BOM mark to start a line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { + skip(parser) + } + + // Eat whitespaces. + // Tabs are allowed: + // - in the flow context + // - in the block context, but not at the beginning of the line or + // after '-', '?', or ':' (complex value). + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if we just had a line comment under a sequence entry that + // looks more like a header to the following content. Similar to this: + // + // - # The comment + // - Some data + // + // If so, transform the line comment to a head comment and reposition. + if len(parser.comments) > 0 && len(parser.tokens) > 1 { + tokenA := parser.tokens[len(parser.tokens)-2] + tokenB := parser.tokens[len(parser.tokens)-1] + comment := &parser.comments[len(parser.comments)-1] + if tokenA.typ == yaml_BLOCK_SEQUENCE_START_TOKEN && tokenB.typ == yaml_BLOCK_ENTRY_TOKEN && len(comment.line) > 0 && !is_break(parser.buffer, parser.buffer_pos) { + // If it was in the prior line, reposition so it becomes a + // header of the follow up token. Otherwise, keep it in place + // so it becomes a header of the former. + comment.head = comment.line + comment.line = nil + if comment.start_mark.line == parser.mark.line-1 { + comment.token_mark = parser.mark + } + } + } + + // Eat a comment until a line break. + if parser.buffer[parser.buffer_pos] == '#' { + if !yaml_parser_scan_comments(parser, scan_mark) { + return false + } + } + + // If it is a line break, eat it. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + + // In the block context, a new line may start a simple key. + if parser.flow_level == 0 { + parser.simple_key_allowed = true + } + } else { + break // We have found a token. + } + } + + return true +} + +// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// +func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { + // Eat '%'. + start_mark := parser.mark + skip(parser) + + // Scan the directive name. + var name []byte + if !yaml_parser_scan_directive_name(parser, start_mark, &name) { + return false + } + + // Is it a YAML directive? + if bytes.Equal(name, []byte("YAML")) { + // Scan the VERSION directive value. + var major, minor int8 + if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { + return false + } + end_mark := parser.mark + + // Create a VERSION-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_VERSION_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + major: major, + minor: minor, + } + + // Is it a TAG directive? + } else if bytes.Equal(name, []byte("TAG")) { + // Scan the TAG directive value. + var handle, prefix []byte + if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { + return false + } + end_mark := parser.mark + + // Create a TAG-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_TAG_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + prefix: prefix, + } + + // Unknown directive. + } else { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unknown directive name") + return false + } + + // Eat the rest of the line including any comments. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + if parser.buffer[parser.buffer_pos] == '#' { + // [Go] Discard this inline comment for the time being. + //if !yaml_parser_scan_line_comment(parser, start_mark) { + // return false + //} + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + return true +} + +// Scan the directive name. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ +// +func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { + // Consume the directive name. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + var s []byte + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the name is empty. + if len(s) == 0 { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "could not find expected directive name") + return false + } + + // Check for an blank character after the name. + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unexpected non-alphabetical character") + return false + } + *name = s + return true +} + +// Scan the value of VERSION-DIRECTIVE. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^^^ +func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the major version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { + return false + } + + // Eat '.'. + if parser.buffer[parser.buffer_pos] != '.' { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected digit or '.' character") + } + + skip(parser) + + // Consume the minor version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { + return false + } + return true +} + +const max_number_length = 2 + +// Scan the version number of VERSION-DIRECTIVE. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ +func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { + + // Repeat while the next character is digit. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var value, length int8 + for is_digit(parser.buffer, parser.buffer_pos) { + // Check if the number is too long. + length++ + if length > max_number_length { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "found extremely long version number") + } + value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the number was present. + if length == 0 { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected version number") + } + *number = value + return true +} + +// Scan the value of a TAG-DIRECTIVE token. +// +// Scope: +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// +func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { + var handle_value, prefix_value []byte + + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a handle. + if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { + return false + } + + // Expect a whitespace. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blank(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace") + return false + } + + // Eat whitespaces. + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a prefix. + if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { + return false + } + + // Expect a whitespace or line break. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace or line break") + return false + } + + *handle = handle_value + *prefix = prefix_value + return true +} + +func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { + var s []byte + + // Eat the indicator character. + start_mark := parser.mark + skip(parser) + + // Consume the value. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + end_mark := parser.mark + + /* + * Check if length of the anchor is greater than 0 and it is followed by + * a whitespace character or one of the indicators: + * + * '?', ':', ',', ']', '}', '%', '@', '`'. + */ + + if len(s) == 0 || + !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || + parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '`') { + context := "while scanning an alias" + if typ == yaml_ANCHOR_TOKEN { + context = "while scanning an anchor" + } + yaml_parser_set_scanner_error(parser, context, start_mark, + "did not find expected alphabetic or numeric character") + return false + } + + // Create a token. + *token = yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + value: s, + } + + return true +} + +/* + * Scan a TAG token. + */ + +func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { + var handle, suffix []byte + + start_mark := parser.mark + + // Check if the tag is in the canonical form. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + if parser.buffer[parser.buffer_pos+1] == '<' { + // Keep the handle as '' + + // Eat '!<' + skip(parser) + skip(parser) + + // Consume the tag value. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + + // Check for '>' and eat it. + if parser.buffer[parser.buffer_pos] != '>' { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find the expected '>'") + return false + } + + skip(parser) + } else { + // The tag has either the '!suffix' or the '!handle!suffix' form. + + // First, try to scan a handle. + if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { + return false + } + + // Check if it is, indeed, handle. + if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { + // Scan the suffix now. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + } else { + // It wasn't a handle after all. Scan the rest of the tag. + if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { + return false + } + + // Set the handle to '!'. + handle = []byte{'!'} + + // A special case: the '!' tag. Set the handle to '' and the + // suffix to '!'. + if len(suffix) == 0 { + handle, suffix = suffix, handle + } + } + } + + // Check the character which ends the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find expected whitespace or line break") + return false + } + + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_TAG_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + suffix: suffix, + } + return true +} + +// Scan a tag handle. +func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { + // Check the initial '!' character. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] != '!' { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + + var s []byte + + // Copy the '!' character. + s = read(parser, s) + + // Copy all subsequent alphabetical and numerical characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the trailing character is '!' and copy it. + if parser.buffer[parser.buffer_pos] == '!' { + s = read(parser, s) + } else { + // It's either the '!' tag or not really a tag handle. If it's a %TAG + // directive, it's an error. If it's a tag token, it must be a part of URI. + if directive && string(s) != "!" { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + } + + *handle = s + return true +} + +// Scan a tag. +func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { + //size_t length = head ? strlen((char *)head) : 0 + var s []byte + hasTag := len(head) > 0 + + // Copy the head if needed. + // + // Note that we don't copy the leading '!' character. + if len(head) > 1 { + s = append(s, head[1:]...) + } + + // Scan the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // The set of characters that may appear in URI is as follows: + // + // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', + // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', + // '%'. + // [Go] TODO Convert this into more reasonable logic. + for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || + parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || + parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || + parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || + parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || + parser.buffer[parser.buffer_pos] == '%' { + // Check if it is a URI-escape sequence. + if parser.buffer[parser.buffer_pos] == '%' { + if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { + return false + } + } else { + s = read(parser, s) + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + hasTag = true + } + + if !hasTag { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected tag URI") + return false + } + *uri = s + return true +} + +// Decode an URI-escape sequence corresponding to a single UTF-8 character. +func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { + + // Decode the required number of characters. + w := 1024 + for w > 0 { + // Check for a URI-escaped octet. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + + if !(parser.buffer[parser.buffer_pos] == '%' && + is_hex(parser.buffer, parser.buffer_pos+1) && + is_hex(parser.buffer, parser.buffer_pos+2)) { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find URI escaped octet") + } + + // Get the octet. + octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) + + // If it is the leading octet, determine the length of the UTF-8 sequence. + if w == 1024 { + w = width(octet) + if w == 0 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect leading UTF-8 octet") + } + } else { + // Check if the trailing octet is correct. + if octet&0xC0 != 0x80 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect trailing UTF-8 octet") + } + } + + // Copy the octet and move the pointers. + *s = append(*s, octet) + skip(parser) + skip(parser) + skip(parser) + w-- + } + return true +} + +// Scan a block scalar. +func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { + // Eat the indicator '|' or '>'. + start_mark := parser.mark + skip(parser) + + // Scan the additional block scalar indicators. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check for a chomping indicator. + var chomping, increment int + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + // Set the chomping method and eat the indicator. + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + + // Check for an indentation indicator. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_digit(parser.buffer, parser.buffer_pos) { + // Check that the indentation is greater than 0. + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + + // Get the indentation level and eat the indicator. + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + } + + } else if is_digit(parser.buffer, parser.buffer_pos) { + // Do the same as above, but in the opposite order. + + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + } + } + + // Eat whitespaces and comments to the end of the line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.buffer[parser.buffer_pos] == '#' { + if !yaml_parser_scan_line_comment(parser, start_mark) { + return false + } + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + end_mark := parser.mark + + // Set the indentation level if it was specified. + var indent int + if increment > 0 { + if parser.indent >= 0 { + indent = parser.indent + increment + } else { + indent = increment + } + } + + // Scan the leading line breaks and determine the indentation level if needed. + var s, leading_break, trailing_breaks []byte + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + + // Scan the block scalar content. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var leading_blank, trailing_blank bool + for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { + // We are at the beginning of a non-empty line. + + // Is it a trailing whitespace? + trailing_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Check if we need to fold the leading line break. + if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { + // Do we need to join the lines by space? + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } + } else { + s = append(s, leading_break...) + } + leading_break = leading_break[:0] + + // Append the remaining line breaks. + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + + // Is it a leading whitespace? + leading_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Consume the current line. + for !is_breakz(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + leading_break = read_line(parser, leading_break) + + // Eat the following indentation spaces and line breaks. + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + } + + // Chomp the tail. + if chomping != -1 { + s = append(s, leading_break...) + } + if chomping == 1 { + s = append(s, trailing_breaks...) + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_LITERAL_SCALAR_STYLE, + } + if !literal { + token.style = yaml_FOLDED_SCALAR_STYLE + } + return true +} + +// Scan indentation spaces and line breaks for a block scalar. Determine the +// indentation level if needed. +func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { + *end_mark = parser.mark + + // Eat the indentation spaces and line breaks. + max_indent := 0 + for { + // Eat the indentation spaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.mark.column > max_indent { + max_indent = parser.mark.column + } + + // Check for a tab character messing the indentation. + if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { + return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found a tab character where an indentation space is expected") + } + + // Have we found a non-empty line? + if !is_break(parser.buffer, parser.buffer_pos) { + break + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + // [Go] Should really be returning breaks instead. + *breaks = read_line(parser, *breaks) + *end_mark = parser.mark + } + + // Determine the indentation level if needed. + if *indent == 0 { + *indent = max_indent + if *indent < parser.indent+1 { + *indent = parser.indent + 1 + } + if *indent < 1 { + *indent = 1 + } + } + return true +} + +// Scan a quoted scalar. +func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { + // Eat the left quote. + start_mark := parser.mark + skip(parser) + + // Consume the content of the quoted scalar. + var s, leading_break, trailing_breaks, whitespaces []byte + for { + // Check that there are no document indicators at the beginning of the line. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected document indicator") + return false + } + + // Check for EOF. + if is_z(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected end of stream") + return false + } + + // Consume non-blank characters. + leading_blanks := false + for !is_blankz(parser.buffer, parser.buffer_pos) { + if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { + // Is is an escaped single quote. + s = append(s, '\'') + skip(parser) + skip(parser) + + } else if single && parser.buffer[parser.buffer_pos] == '\'' { + // It is a right single quote. + break + } else if !single && parser.buffer[parser.buffer_pos] == '"' { + // It is a right double quote. + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { + // It is an escaped line break. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + skip(parser) + skip_line(parser) + leading_blanks = true + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' { + // It is an escape sequence. + code_length := 0 + + // Check the escape character. + switch parser.buffer[parser.buffer_pos+1] { + case '0': + s = append(s, 0) + case 'a': + s = append(s, '\x07') + case 'b': + s = append(s, '\x08') + case 't', '\t': + s = append(s, '\x09') + case 'n': + s = append(s, '\x0A') + case 'v': + s = append(s, '\x0B') + case 'f': + s = append(s, '\x0C') + case 'r': + s = append(s, '\x0D') + case 'e': + s = append(s, '\x1B') + case ' ': + s = append(s, '\x20') + case '"': + s = append(s, '"') + case '\'': + s = append(s, '\'') + case '\\': + s = append(s, '\\') + case 'N': // NEL (#x85) + s = append(s, '\xC2') + s = append(s, '\x85') + case '_': // #xA0 + s = append(s, '\xC2') + s = append(s, '\xA0') + case 'L': // LS (#x2028) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA8') + case 'P': // PS (#x2029) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA9') + case 'x': + code_length = 2 + case 'u': + code_length = 4 + case 'U': + code_length = 8 + default: + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found unknown escape character") + return false + } + + skip(parser) + skip(parser) + + // Consume an arbitrary escape code. + if code_length > 0 { + var value int + + // Scan the character value. + if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { + return false + } + for k := 0; k < code_length; k++ { + if !is_hex(parser.buffer, parser.buffer_pos+k) { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "did not find expected hexdecimal number") + return false + } + value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) + } + + // Check the value and write the character. + if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found invalid Unicode character escape code") + return false + } + if value <= 0x7F { + s = append(s, byte(value)) + } else if value <= 0x7FF { + s = append(s, byte(0xC0+(value>>6))) + s = append(s, byte(0x80+(value&0x3F))) + } else if value <= 0xFFFF { + s = append(s, byte(0xE0+(value>>12))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } else { + s = append(s, byte(0xF0+(value>>18))) + s = append(s, byte(0x80+((value>>12)&0x3F))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } + + // Advance the pointer. + for k := 0; k < code_length; k++ { + skip(parser) + } + } + } else { + // It is a non-escaped non-blank character. + s = read(parser, s) + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we are at the end of the scalar. + if single { + if parser.buffer[parser.buffer_pos] == '\'' { + break + } + } else { + if parser.buffer[parser.buffer_pos] == '"' { + break + } + } + + // Consume blank characters. + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Join the whitespaces or fold line breaks. + if leading_blanks { + // Do we need to fold line breaks? + if len(leading_break) > 0 && leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Eat the right quote. + skip(parser) + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_SINGLE_QUOTED_SCALAR_STYLE, + } + if !single { + token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + return true +} + +// Scan a plain scalar. +func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { + + var s, leading_break, trailing_breaks, whitespaces []byte + var leading_blanks bool + var indent = parser.indent + 1 + + start_mark := parser.mark + end_mark := parser.mark + + // Consume the content of the plain scalar. + for { + // Check for a document indicator. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + break + } + + // Check for a comment. + if parser.buffer[parser.buffer_pos] == '#' { + break + } + + // Consume non-blank characters. + for !is_blankz(parser.buffer, parser.buffer_pos) { + + // Check for indicators that may end a plain scalar. + if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level > 0 && + (parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}')) { + break + } + + // Check if we need to join whitespaces and breaks. + if leading_blanks || len(whitespaces) > 0 { + if leading_blanks { + // Do we need to fold line breaks? + if leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + leading_blanks = false + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Copy the character. + s = read(parser, s) + + end_mark = parser.mark + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + // Is it the end? + if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { + break + } + + // Consume blank characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + + // Check for tab characters that abuse indentation. + if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found a tab character that violates indentation") + return false + } + + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check indentation level. + if parser.flow_level == 0 && parser.mark.column < indent { + break + } + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_PLAIN_SCALAR_STYLE, + } + + // Note that we change the 'simple_key_allowed' flag. + if leading_blanks { + parser.simple_key_allowed = true + } + return true +} + +func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t) bool { + if parser.newlines > 0 { + return true + } + + var start_mark yaml_mark_t + var text []byte + + for peek := 0; peek < 512; peek++ { + if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { + break + } + if is_blank(parser.buffer, parser.buffer_pos+peek) { + continue + } + if parser.buffer[parser.buffer_pos+peek] == '#' { + seen := parser.mark.index+peek + for { + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_breakz(parser.buffer, parser.buffer_pos) { + if parser.mark.index >= seen { + break + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } else if parser.mark.index >= seen { + if len(text) == 0 { + start_mark = parser.mark + } + text = read(parser, text) + } else { + skip(parser) + } + } + } + break + } + if len(text) > 0 { + parser.comments = append(parser.comments, yaml_comment_t{ + token_mark: token_mark, + start_mark: start_mark, + line: text, + }) + } + return true +} + +func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) bool { + token := parser.tokens[len(parser.tokens)-1] + + if token.typ == yaml_FLOW_ENTRY_TOKEN && len(parser.tokens) > 1 { + token = parser.tokens[len(parser.tokens)-2] + } + + var token_mark = token.start_mark + var start_mark yaml_mark_t + var next_indent = parser.indent + if next_indent < 0 { + next_indent = 0 + } + + var recent_empty = false + var first_empty = parser.newlines <= 1 + + var line = parser.mark.line + var column = parser.mark.column + + var text []byte + + // The foot line is the place where a comment must start to + // still be considered as a foot of the prior content. + // If there's some content in the currently parsed line, then + // the foot is the line below it. + var foot_line = -1 + if scan_mark.line > 0 { + foot_line = parser.mark.line-parser.newlines+1 + if parser.newlines == 0 && parser.mark.column > 1 { + foot_line++ + } + } + + var peek = 0 + for ; peek < 512; peek++ { + if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { + break + } + column++ + if is_blank(parser.buffer, parser.buffer_pos+peek) { + continue + } + c := parser.buffer[parser.buffer_pos+peek] + var close_flow = parser.flow_level > 0 && (c == ']' || c == '}') + if close_flow || is_breakz(parser.buffer, parser.buffer_pos+peek) { + // Got line break or terminator. + if close_flow || !recent_empty { + if close_flow || first_empty && (start_mark.line == foot_line && token.typ != yaml_VALUE_TOKEN || start_mark.column-1 < next_indent) { + // This is the first empty line and there were no empty lines before, + // so this initial part of the comment is a foot of the prior token + // instead of being a head for the following one. Split it up. + // Alternatively, this might also be the last comment inside a flow + // scope, so it must be a footer. + if len(text) > 0 { + if start_mark.column-1 < next_indent { + // If dedented it's unrelated to the prior token. + token_mark = start_mark + } + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: token_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, + foot: text, + }) + scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} + token_mark = scan_mark + text = nil + } + } else { + if len(text) > 0 && parser.buffer[parser.buffer_pos+peek] != 0 { + text = append(text, '\n') + } + } + } + if !is_break(parser.buffer, parser.buffer_pos+peek) { + break + } + first_empty = false + recent_empty = true + column = 0 + line++ + continue + } + + if len(text) > 0 && (close_flow || column-1 < next_indent && column != start_mark.column) { + // The comment at the different indentation is a foot of the + // preceding data rather than a head of the upcoming one. + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: token_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, + foot: text, + }) + scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} + token_mark = scan_mark + text = nil + } + + if parser.buffer[parser.buffer_pos+peek] != '#' { + break + } + + if len(text) == 0 { + start_mark = yaml_mark_t{parser.mark.index + peek, line, column} + } else { + text = append(text, '\n') + } + + recent_empty = false + + // Consume until after the consumed comment line. + seen := parser.mark.index+peek + for { + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_breakz(parser.buffer, parser.buffer_pos) { + if parser.mark.index >= seen { + break + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } else if parser.mark.index >= seen { + text = read(parser, text) + } else { + skip(parser) + } + } + + peek = 0 + column = 0 + line = parser.mark.line + next_indent = parser.indent + if next_indent < 0 { + next_indent = 0 + } + } + + if len(text) > 0 { + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: start_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek - 1, line, column}, + head: text, + }) + } + return true +} diff --git a/vendor/gopkg.in/yaml.v3/sorter.go b/vendor/gopkg.in/yaml.v3/sorter.go new file mode 100644 index 0000000..9210ece --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/sorter.go @@ -0,0 +1,134 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yaml + +import ( + "reflect" + "unicode" +) + +type keyList []reflect.Value + +func (l keyList) Len() int { return len(l) } +func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l keyList) Less(i, j int) bool { + a := l[i] + b := l[j] + ak := a.Kind() + bk := b.Kind() + for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { + a = a.Elem() + ak = a.Kind() + } + for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { + b = b.Elem() + bk = b.Kind() + } + af, aok := keyFloat(a) + bf, bok := keyFloat(b) + if aok && bok { + if af != bf { + return af < bf + } + if ak != bk { + return ak < bk + } + return numLess(a, b) + } + if ak != reflect.String || bk != reflect.String { + return ak < bk + } + ar, br := []rune(a.String()), []rune(b.String()) + digits := false + for i := 0; i < len(ar) && i < len(br); i++ { + if ar[i] == br[i] { + digits = unicode.IsDigit(ar[i]) + continue + } + al := unicode.IsLetter(ar[i]) + bl := unicode.IsLetter(br[i]) + if al && bl { + return ar[i] < br[i] + } + if al || bl { + if digits { + return al + } else { + return bl + } + } + var ai, bi int + var an, bn int64 + if ar[i] == '0' || br[i] == '0' { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + if ar[j] != '0' { + an = 1 + bn = 1 + break + } + } + } + for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { + an = an*10 + int64(ar[ai]-'0') + } + for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { + bn = bn*10 + int64(br[bi]-'0') + } + if an != bn { + return an < bn + } + if ai != bi { + return ai < bi + } + return ar[i] < br[i] + } + return len(ar) < len(br) +} + +// keyFloat returns a float value for v if it is a number/bool +// and whether it is a number/bool or not. +func keyFloat(v reflect.Value) (f float64, ok bool) { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return float64(v.Int()), true + case reflect.Float32, reflect.Float64: + return v.Float(), true + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return float64(v.Uint()), true + case reflect.Bool: + if v.Bool() { + return 1, true + } + return 0, true + } + return 0, false +} + +// numLess returns whether a < b. +// a and b must necessarily have the same kind. +func numLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return a.Int() < b.Int() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Bool: + return !a.Bool() && b.Bool() + } + panic("not a number") +} diff --git a/vendor/gopkg.in/yaml.v3/writerc.go b/vendor/gopkg.in/yaml.v3/writerc.go new file mode 100644 index 0000000..b8a116b --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/writerc.go @@ -0,0 +1,48 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +// Set the writer error and return false. +func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_WRITER_ERROR + emitter.problem = problem + return false +} + +// Flush the output buffer. +func yaml_emitter_flush(emitter *yaml_emitter_t) bool { + if emitter.write_handler == nil { + panic("write handler not set") + } + + // Check if the buffer is empty. + if emitter.buffer_pos == 0 { + return true + } + + if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + return true +} diff --git a/vendor/gopkg.in/yaml.v3/yaml.go b/vendor/gopkg.in/yaml.v3/yaml.go new file mode 100644 index 0000000..8cec6da --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/yaml.go @@ -0,0 +1,698 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package yaml implements YAML support for the Go language. +// +// Source code and other details for the project are available at GitHub: +// +// https://github.com/go-yaml/yaml +// +package yaml + +import ( + "errors" + "fmt" + "io" + "reflect" + "strings" + "sync" + "unicode/utf8" +) + +// The Unmarshaler interface may be implemented by types to customize their +// behavior when being unmarshaled from a YAML document. +type Unmarshaler interface { + UnmarshalYAML(value *Node) error +} + +type obsoleteUnmarshaler interface { + UnmarshalYAML(unmarshal func(interface{}) error) error +} + +// The Marshaler interface may be implemented by types to customize their +// behavior when being marshaled into a YAML document. The returned value +// is marshaled in place of the original value implementing Marshaler. +// +// If an error is returned by MarshalYAML, the marshaling procedure stops +// and returns with the provided error. +type Marshaler interface { + MarshalYAML() (interface{}, error) +} + +// Unmarshal decodes the first document found within the in byte slice +// and assigns decoded values into the out value. +// +// Maps and pointers (to a struct, string, int, etc) are accepted as out +// values. If an internal pointer within a struct is not initialized, +// the yaml package will initialize it if necessary for unmarshalling +// the provided data. The out parameter must not be nil. +// +// The type of the decoded values should be compatible with the respective +// values in out. If one or more values cannot be decoded due to a type +// mismatches, decoding continues partially until the end of the YAML +// content, and a *yaml.TypeError is returned with details for all +// missed values. +// +// Struct fields are only unmarshalled if they are exported (have an +// upper case first letter), and are unmarshalled using the field name +// lowercased as the default key. Custom keys may be defined via the +// "yaml" name in the field tag: the content preceding the first comma +// is used as the key, and the following comma-separated options are +// used to tweak the marshalling process (see Marshal). +// Conflicting names result in a runtime error. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// +// See the documentation of Marshal for the format of tags and a list of +// supported tag options. +// +func Unmarshal(in []byte, out interface{}) (err error) { + return unmarshal(in, out, false) +} + +// A Decoder reads and decodes YAML values from an input stream. +type Decoder struct { + parser *parser + knownFields bool +} + +// NewDecoder returns a new decoder that reads from r. +// +// The decoder introduces its own buffering and may read +// data from r beyond the YAML values requested. +func NewDecoder(r io.Reader) *Decoder { + return &Decoder{ + parser: newParserFromReader(r), + } +} + +// KnownFields ensures that the keys in decoded mappings to +// exist as fields in the struct being decoded into. +func (dec *Decoder) KnownFields(enable bool) { + dec.knownFields = enable +} + +// Decode reads the next YAML-encoded value from its input +// and stores it in the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (dec *Decoder) Decode(v interface{}) (err error) { + d := newDecoder() + d.knownFields = dec.knownFields + defer handleErr(&err) + node := dec.parser.parse() + if node == nil { + return io.EOF + } + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(node, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +// Decode decodes the node and stores its data into the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (n *Node) Decode(v interface{}) (err error) { + d := newDecoder() + defer handleErr(&err) + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(n, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +func unmarshal(in []byte, out interface{}, strict bool) (err error) { + defer handleErr(&err) + d := newDecoder() + p := newParser(in) + defer p.destroy() + node := p.parse() + if node != nil { + v := reflect.ValueOf(out) + if v.Kind() == reflect.Ptr && !v.IsNil() { + v = v.Elem() + } + d.unmarshal(node, v) + } + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +// Marshal serializes the value provided into a YAML document. The structure +// of the generated document will reflect the structure of the value itself. +// Maps and pointers (to struct, string, int, etc) are accepted as the in value. +// +// Struct fields are only marshalled if they are exported (have an upper case +// first letter), and are marshalled using the field name lowercased as the +// default key. Custom keys may be defined via the "yaml" name in the field +// tag: the content preceding the first comma is used as the key, and the +// following comma-separated options are used to tweak the marshalling process. +// Conflicting names result in a runtime error. +// +// The field tag format accepted is: +// +// `(...) yaml:"[][,[,]]" (...)` +// +// The following flags are currently supported: +// +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. +// +// flow Marshal using a flow style (useful for structs, +// sequences and maps). +// +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. +// +// In addition, if the key is "-", the field is ignored. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" +// +func Marshal(in interface{}) (out []byte, err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshalDoc("", reflect.ValueOf(in)) + e.finish() + out = e.out + return +} + +// An Encoder writes YAML values to an output stream. +type Encoder struct { + encoder *encoder +} + +// NewEncoder returns a new encoder that writes to w. +// The Encoder should be closed after use to flush all data +// to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{ + encoder: newEncoderWithWriter(w), + } +} + +// Encode writes the YAML encoding of v to the stream. +// If multiple items are encoded to the stream, the +// second and subsequent document will be preceded +// with a "---" document separator, but the first will not. +// +// See the documentation for Marshal for details about the conversion of Go +// values to YAML. +func (e *Encoder) Encode(v interface{}) (err error) { + defer handleErr(&err) + e.encoder.marshalDoc("", reflect.ValueOf(v)) + return nil +} + +// Encode encodes value v and stores its representation in n. +// +// See the documentation for Marshal for details about the +// conversion of Go values into YAML. +func (n *Node) Encode(v interface{}) (err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshalDoc("", reflect.ValueOf(v)) + e.finish() + p := newParser(e.out) + p.textless = true + defer p.destroy() + doc := p.parse() + *n = *doc.Content[0] + return nil +} + +// SetIndent changes the used indentation used when encoding. +func (e *Encoder) SetIndent(spaces int) { + if spaces < 0 { + panic("yaml: cannot indent to a negative number of spaces") + } + e.encoder.indent = spaces +} + +// Close closes the encoder by writing any remaining data. +// It does not write a stream terminating string "...". +func (e *Encoder) Close() (err error) { + defer handleErr(&err) + e.encoder.finish() + return nil +} + +func handleErr(err *error) { + if v := recover(); v != nil { + if e, ok := v.(yamlError); ok { + *err = e.err + } else { + panic(v) + } + } +} + +type yamlError struct { + err error +} + +func fail(err error) { + panic(yamlError{err}) +} + +func failf(format string, args ...interface{}) { + panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) +} + +// A TypeError is returned by Unmarshal when one or more fields in +// the YAML document cannot be properly decoded into the requested +// types. When this error is returned, the value is still +// unmarshaled partially. +type TypeError struct { + Errors []string +} + +func (e *TypeError) Error() string { + return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) +} + +type Kind uint32 + +const ( + DocumentNode Kind = 1 << iota + SequenceNode + MappingNode + ScalarNode + AliasNode +) + +type Style uint32 + +const ( + TaggedStyle Style = 1 << iota + DoubleQuotedStyle + SingleQuotedStyle + LiteralStyle + FoldedStyle + FlowStyle +) + +// Node represents an element in the YAML document hierarchy. While documents +// are typically encoded and decoded into higher level types, such as structs +// and maps, Node is an intermediate representation that allows detailed +// control over the content being decoded or encoded. +// +// It's worth noting that although Node offers access into details such as +// line numbers, colums, and comments, the content when re-encoded will not +// have its original textual representation preserved. An effort is made to +// render the data plesantly, and to preserve comments near the data they +// describe, though. +// +// Values that make use of the Node type interact with the yaml package in the +// same way any other type would do, by encoding and decoding yaml data +// directly or indirectly into them. +// +// For example: +// +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) +// +// Or by itself: +// +// var person Node +// err := yaml.Unmarshal(data, &person) +// +type Node struct { + // Kind defines whether the node is a document, a mapping, a sequence, + // a scalar value, or an alias to another node. The specific data type of + // scalar nodes may be obtained via the ShortTag and LongTag methods. + Kind Kind + + // Style allows customizing the apperance of the node in the tree. + Style Style + + // Tag holds the YAML tag defining the data type for the value. + // When decoding, this field will always be set to the resolved tag, + // even when it wasn't explicitly provided in the YAML content. + // When encoding, if this field is unset the value type will be + // implied from the node properties, and if it is set, it will only + // be serialized into the representation if TaggedStyle is used or + // the implicit tag diverges from the provided one. + Tag string + + // Value holds the unescaped and unquoted represenation of the value. + Value string + + // Anchor holds the anchor name for this node, which allows aliases to point to it. + Anchor string + + // Alias holds the node that this alias points to. Only valid when Kind is AliasNode. + Alias *Node + + // Content holds contained nodes for documents, mappings, and sequences. + Content []*Node + + // HeadComment holds any comments in the lines preceding the node and + // not separated by an empty line. + HeadComment string + + // LineComment holds any comments at the end of the line where the node is in. + LineComment string + + // FootComment holds any comments following the node and before empty lines. + FootComment string + + // Line and Column hold the node position in the decoded YAML text. + // These fields are not respected when encoding the node. + Line int + Column int +} + +// IsZero returns whether the node has all of its fields unset. +func (n *Node) IsZero() bool { + return n.Kind == 0 && n.Style == 0 && n.Tag == "" && n.Value == "" && n.Anchor == "" && n.Alias == nil && n.Content == nil && + n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 +} + + +// LongTag returns the long form of the tag that indicates the data type for +// the node. If the Tag field isn't explicitly defined, one will be computed +// based on the node properties. +func (n *Node) LongTag() string { + return longTag(n.ShortTag()) +} + +// ShortTag returns the short form of the YAML tag that indicates data type for +// the node. If the Tag field isn't explicitly defined, one will be computed +// based on the node properties. +func (n *Node) ShortTag() string { + if n.indicatedString() { + return strTag + } + if n.Tag == "" || n.Tag == "!" { + switch n.Kind { + case MappingNode: + return mapTag + case SequenceNode: + return seqTag + case AliasNode: + if n.Alias != nil { + return n.Alias.ShortTag() + } + case ScalarNode: + tag, _ := resolve("", n.Value) + return tag + case 0: + // Special case to make the zero value convenient. + if n.IsZero() { + return nullTag + } + } + return "" + } + return shortTag(n.Tag) +} + +func (n *Node) indicatedString() bool { + return n.Kind == ScalarNode && + (shortTag(n.Tag) == strTag || + (n.Tag == "" || n.Tag == "!") && n.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0) +} + +// SetString is a convenience function that sets the node to a string value +// and defines its style in a pleasant way depending on its content. +func (n *Node) SetString(s string) { + n.Kind = ScalarNode + if utf8.ValidString(s) { + n.Value = s + n.Tag = strTag + } else { + n.Value = encodeBase64(s) + n.Tag = binaryTag + } + if strings.Contains(n.Value, "\n") { + n.Style = LiteralStyle + } +} + +// -------------------------------------------------------------------------- +// Maintain a mapping of keys to structure field indexes + +// The code in this section was copied from mgo/bson. + +// structInfo holds details for the serialization of fields of +// a given struct. +type structInfo struct { + FieldsMap map[string]fieldInfo + FieldsList []fieldInfo + + // InlineMap is the number of the field in the struct that + // contains an ,inline map, or -1 if there's none. + InlineMap int + + // InlineUnmarshalers holds indexes to inlined fields that + // contain unmarshaler values. + InlineUnmarshalers [][]int +} + +type fieldInfo struct { + Key string + Num int + OmitEmpty bool + Flow bool + // Id holds the unique field identifier, so we can cheaply + // check for field duplicates without maintaining an extra map. + Id int + + // Inline holds the field index if the field is part of an inlined struct. + Inline []int +} + +var structMap = make(map[reflect.Type]*structInfo) +var fieldMapMutex sync.RWMutex +var unmarshalerType reflect.Type + +func init() { + var v Unmarshaler + unmarshalerType = reflect.ValueOf(&v).Elem().Type() +} + +func getStructInfo(st reflect.Type) (*structInfo, error) { + fieldMapMutex.RLock() + sinfo, found := structMap[st] + fieldMapMutex.RUnlock() + if found { + return sinfo, nil + } + + n := st.NumField() + fieldsMap := make(map[string]fieldInfo) + fieldsList := make([]fieldInfo, 0, n) + inlineMap := -1 + inlineUnmarshalers := [][]int(nil) + for i := 0; i != n; i++ { + field := st.Field(i) + if field.PkgPath != "" && !field.Anonymous { + continue // Private field + } + + info := fieldInfo{Num: i} + + tag := field.Tag.Get("yaml") + if tag == "" && strings.Index(string(field.Tag), ":") < 0 { + tag = string(field.Tag) + } + if tag == "-" { + continue + } + + inline := false + fields := strings.Split(tag, ",") + if len(fields) > 1 { + for _, flag := range fields[1:] { + switch flag { + case "omitempty": + info.OmitEmpty = true + case "flow": + info.Flow = true + case "inline": + inline = true + default: + return nil, errors.New(fmt.Sprintf("unsupported flag %q in tag %q of type %s", flag, tag, st)) + } + } + tag = fields[0] + } + + if inline { + switch field.Type.Kind() { + case reflect.Map: + if inlineMap >= 0 { + return nil, errors.New("multiple ,inline maps in struct " + st.String()) + } + if field.Type.Key() != reflect.TypeOf("") { + return nil, errors.New("option ,inline needs a map with string keys in struct " + st.String()) + } + inlineMap = info.Num + case reflect.Struct, reflect.Ptr: + ftype := field.Type + for ftype.Kind() == reflect.Ptr { + ftype = ftype.Elem() + } + if ftype.Kind() != reflect.Struct { + return nil, errors.New("option ,inline may only be used on a struct or map field") + } + if reflect.PtrTo(ftype).Implements(unmarshalerType) { + inlineUnmarshalers = append(inlineUnmarshalers, []int{i}) + } else { + sinfo, err := getStructInfo(ftype) + if err != nil { + return nil, err + } + for _, index := range sinfo.InlineUnmarshalers { + inlineUnmarshalers = append(inlineUnmarshalers, append([]int{i}, index...)) + } + for _, finfo := range sinfo.FieldsList { + if _, found := fieldsMap[finfo.Key]; found { + msg := "duplicated key '" + finfo.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + if finfo.Inline == nil { + finfo.Inline = []int{i, finfo.Num} + } else { + finfo.Inline = append([]int{i}, finfo.Inline...) + } + finfo.Id = len(fieldsList) + fieldsMap[finfo.Key] = finfo + fieldsList = append(fieldsList, finfo) + } + } + default: + return nil, errors.New("option ,inline may only be used on a struct or map field") + } + continue + } + + if tag != "" { + info.Key = tag + } else { + info.Key = strings.ToLower(field.Name) + } + + if _, found = fieldsMap[info.Key]; found { + msg := "duplicated key '" + info.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + + info.Id = len(fieldsList) + fieldsList = append(fieldsList, info) + fieldsMap[info.Key] = info + } + + sinfo = &structInfo{ + FieldsMap: fieldsMap, + FieldsList: fieldsList, + InlineMap: inlineMap, + InlineUnmarshalers: inlineUnmarshalers, + } + + fieldMapMutex.Lock() + structMap[st] = sinfo + fieldMapMutex.Unlock() + return sinfo, nil +} + +// IsZeroer is used to check whether an object is zero to +// determine whether it should be omitted when marshaling +// with the omitempty flag. One notable implementation +// is time.Time. +type IsZeroer interface { + IsZero() bool +} + +func isZero(v reflect.Value) bool { + kind := v.Kind() + if z, ok := v.Interface().(IsZeroer); ok { + if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { + return true + } + return z.IsZero() + } + switch kind { + case reflect.String: + return len(v.String()) == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Slice: + return v.Len() == 0 + case reflect.Map: + return v.Len() == 0 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Struct: + vt := v.Type() + for i := v.NumField() - 1; i >= 0; i-- { + if vt.Field(i).PkgPath != "" { + continue // Private field + } + if !isZero(v.Field(i)) { + return false + } + } + return true + } + return false +} diff --git a/vendor/gopkg.in/yaml.v3/yamlh.go b/vendor/gopkg.in/yaml.v3/yamlh.go new file mode 100644 index 0000000..7c6d007 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/yamlh.go @@ -0,0 +1,807 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +import ( + "fmt" + "io" +) + +// The version directive data. +type yaml_version_directive_t struct { + major int8 // The major version number. + minor int8 // The minor version number. +} + +// The tag directive data. +type yaml_tag_directive_t struct { + handle []byte // The tag handle. + prefix []byte // The tag prefix. +} + +type yaml_encoding_t int + +// The stream encoding. +const ( + // Let the parser choose the encoding. + yaml_ANY_ENCODING yaml_encoding_t = iota + + yaml_UTF8_ENCODING // The default UTF-8 encoding. + yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. + yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. +) + +type yaml_break_t int + +// Line break types. +const ( + // Let the parser choose the break type. + yaml_ANY_BREAK yaml_break_t = iota + + yaml_CR_BREAK // Use CR for line breaks (Mac style). + yaml_LN_BREAK // Use LN for line breaks (Unix style). + yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). +) + +type yaml_error_type_t int + +// Many bad things could happen with the parser and emitter. +const ( + // No error is produced. + yaml_NO_ERROR yaml_error_type_t = iota + + yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. + yaml_READER_ERROR // Cannot read or decode the input stream. + yaml_SCANNER_ERROR // Cannot scan the input stream. + yaml_PARSER_ERROR // Cannot parse the input stream. + yaml_COMPOSER_ERROR // Cannot compose a YAML document. + yaml_WRITER_ERROR // Cannot write to the output stream. + yaml_EMITTER_ERROR // Cannot emit a YAML stream. +) + +// The pointer position. +type yaml_mark_t struct { + index int // The position index. + line int // The position line. + column int // The position column. +} + +// Node Styles + +type yaml_style_t int8 + +type yaml_scalar_style_t yaml_style_t + +// Scalar styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = 0 + + yaml_PLAIN_SCALAR_STYLE yaml_scalar_style_t = 1 << iota // The plain scalar style. + yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. + yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. + yaml_LITERAL_SCALAR_STYLE // The literal scalar style. + yaml_FOLDED_SCALAR_STYLE // The folded scalar style. +) + +type yaml_sequence_style_t yaml_style_t + +// Sequence styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota + + yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. + yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. +) + +type yaml_mapping_style_t yaml_style_t + +// Mapping styles. +const ( + // Let the emitter choose the style. + yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota + + yaml_BLOCK_MAPPING_STYLE // The block mapping style. + yaml_FLOW_MAPPING_STYLE // The flow mapping style. +) + +// Tokens + +type yaml_token_type_t int + +// Token types. +const ( + // An empty token. + yaml_NO_TOKEN yaml_token_type_t = iota + + yaml_STREAM_START_TOKEN // A STREAM-START token. + yaml_STREAM_END_TOKEN // A STREAM-END token. + + yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. + yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. + yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. + yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. + + yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. + yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. + yaml_BLOCK_END_TOKEN // A BLOCK-END token. + + yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. + yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. + yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. + yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. + + yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. + yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. + yaml_KEY_TOKEN // A KEY token. + yaml_VALUE_TOKEN // A VALUE token. + + yaml_ALIAS_TOKEN // An ALIAS token. + yaml_ANCHOR_TOKEN // An ANCHOR token. + yaml_TAG_TOKEN // A TAG token. + yaml_SCALAR_TOKEN // A SCALAR token. +) + +func (tt yaml_token_type_t) String() string { + switch tt { + case yaml_NO_TOKEN: + return "yaml_NO_TOKEN" + case yaml_STREAM_START_TOKEN: + return "yaml_STREAM_START_TOKEN" + case yaml_STREAM_END_TOKEN: + return "yaml_STREAM_END_TOKEN" + case yaml_VERSION_DIRECTIVE_TOKEN: + return "yaml_VERSION_DIRECTIVE_TOKEN" + case yaml_TAG_DIRECTIVE_TOKEN: + return "yaml_TAG_DIRECTIVE_TOKEN" + case yaml_DOCUMENT_START_TOKEN: + return "yaml_DOCUMENT_START_TOKEN" + case yaml_DOCUMENT_END_TOKEN: + return "yaml_DOCUMENT_END_TOKEN" + case yaml_BLOCK_SEQUENCE_START_TOKEN: + return "yaml_BLOCK_SEQUENCE_START_TOKEN" + case yaml_BLOCK_MAPPING_START_TOKEN: + return "yaml_BLOCK_MAPPING_START_TOKEN" + case yaml_BLOCK_END_TOKEN: + return "yaml_BLOCK_END_TOKEN" + case yaml_FLOW_SEQUENCE_START_TOKEN: + return "yaml_FLOW_SEQUENCE_START_TOKEN" + case yaml_FLOW_SEQUENCE_END_TOKEN: + return "yaml_FLOW_SEQUENCE_END_TOKEN" + case yaml_FLOW_MAPPING_START_TOKEN: + return "yaml_FLOW_MAPPING_START_TOKEN" + case yaml_FLOW_MAPPING_END_TOKEN: + return "yaml_FLOW_MAPPING_END_TOKEN" + case yaml_BLOCK_ENTRY_TOKEN: + return "yaml_BLOCK_ENTRY_TOKEN" + case yaml_FLOW_ENTRY_TOKEN: + return "yaml_FLOW_ENTRY_TOKEN" + case yaml_KEY_TOKEN: + return "yaml_KEY_TOKEN" + case yaml_VALUE_TOKEN: + return "yaml_VALUE_TOKEN" + case yaml_ALIAS_TOKEN: + return "yaml_ALIAS_TOKEN" + case yaml_ANCHOR_TOKEN: + return "yaml_ANCHOR_TOKEN" + case yaml_TAG_TOKEN: + return "yaml_TAG_TOKEN" + case yaml_SCALAR_TOKEN: + return "yaml_SCALAR_TOKEN" + } + return "" +} + +// The token structure. +type yaml_token_t struct { + // The token type. + typ yaml_token_type_t + + // The start/end of the token. + start_mark, end_mark yaml_mark_t + + // The stream encoding (for yaml_STREAM_START_TOKEN). + encoding yaml_encoding_t + + // The alias/anchor/scalar value or tag/tag directive handle + // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). + value []byte + + // The tag suffix (for yaml_TAG_TOKEN). + suffix []byte + + // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). + prefix []byte + + // The scalar style (for yaml_SCALAR_TOKEN). + style yaml_scalar_style_t + + // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). + major, minor int8 +} + +// Events + +type yaml_event_type_t int8 + +// Event types. +const ( + // An empty event. + yaml_NO_EVENT yaml_event_type_t = iota + + yaml_STREAM_START_EVENT // A STREAM-START event. + yaml_STREAM_END_EVENT // A STREAM-END event. + yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. + yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. + yaml_ALIAS_EVENT // An ALIAS event. + yaml_SCALAR_EVENT // A SCALAR event. + yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. + yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. + yaml_MAPPING_START_EVENT // A MAPPING-START event. + yaml_MAPPING_END_EVENT // A MAPPING-END event. + yaml_TAIL_COMMENT_EVENT +) + +var eventStrings = []string{ + yaml_NO_EVENT: "none", + yaml_STREAM_START_EVENT: "stream start", + yaml_STREAM_END_EVENT: "stream end", + yaml_DOCUMENT_START_EVENT: "document start", + yaml_DOCUMENT_END_EVENT: "document end", + yaml_ALIAS_EVENT: "alias", + yaml_SCALAR_EVENT: "scalar", + yaml_SEQUENCE_START_EVENT: "sequence start", + yaml_SEQUENCE_END_EVENT: "sequence end", + yaml_MAPPING_START_EVENT: "mapping start", + yaml_MAPPING_END_EVENT: "mapping end", + yaml_TAIL_COMMENT_EVENT: "tail comment", +} + +func (e yaml_event_type_t) String() string { + if e < 0 || int(e) >= len(eventStrings) { + return fmt.Sprintf("unknown event %d", e) + } + return eventStrings[e] +} + +// The event structure. +type yaml_event_t struct { + + // The event type. + typ yaml_event_type_t + + // The start and end of the event. + start_mark, end_mark yaml_mark_t + + // The document encoding (for yaml_STREAM_START_EVENT). + encoding yaml_encoding_t + + // The version directive (for yaml_DOCUMENT_START_EVENT). + version_directive *yaml_version_directive_t + + // The list of tag directives (for yaml_DOCUMENT_START_EVENT). + tag_directives []yaml_tag_directive_t + + // The comments + head_comment []byte + line_comment []byte + foot_comment []byte + tail_comment []byte + + // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). + anchor []byte + + // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + tag []byte + + // The scalar value (for yaml_SCALAR_EVENT). + value []byte + + // Is the document start/end indicator implicit, or the tag optional? + // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). + implicit bool + + // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). + quoted_implicit bool + + // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + style yaml_style_t +} + +func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } +func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } +func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } + +// Nodes + +const ( + yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. + yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. + yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. + yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. + yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. + yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. + + yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. + yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. + + // Not in original libyaml. + yaml_BINARY_TAG = "tag:yaml.org,2002:binary" + yaml_MERGE_TAG = "tag:yaml.org,2002:merge" + + yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. + yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. + yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. +) + +type yaml_node_type_t int + +// Node types. +const ( + // An empty node. + yaml_NO_NODE yaml_node_type_t = iota + + yaml_SCALAR_NODE // A scalar node. + yaml_SEQUENCE_NODE // A sequence node. + yaml_MAPPING_NODE // A mapping node. +) + +// An element of a sequence node. +type yaml_node_item_t int + +// An element of a mapping node. +type yaml_node_pair_t struct { + key int // The key of the element. + value int // The value of the element. +} + +// The node structure. +type yaml_node_t struct { + typ yaml_node_type_t // The node type. + tag []byte // The node tag. + + // The node data. + + // The scalar parameters (for yaml_SCALAR_NODE). + scalar struct { + value []byte // The scalar value. + length int // The length of the scalar value. + style yaml_scalar_style_t // The scalar style. + } + + // The sequence parameters (for YAML_SEQUENCE_NODE). + sequence struct { + items_data []yaml_node_item_t // The stack of sequence items. + style yaml_sequence_style_t // The sequence style. + } + + // The mapping parameters (for yaml_MAPPING_NODE). + mapping struct { + pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). + pairs_start *yaml_node_pair_t // The beginning of the stack. + pairs_end *yaml_node_pair_t // The end of the stack. + pairs_top *yaml_node_pair_t // The top of the stack. + style yaml_mapping_style_t // The mapping style. + } + + start_mark yaml_mark_t // The beginning of the node. + end_mark yaml_mark_t // The end of the node. + +} + +// The document structure. +type yaml_document_t struct { + + // The document nodes. + nodes []yaml_node_t + + // The version directive. + version_directive *yaml_version_directive_t + + // The list of tag directives. + tag_directives_data []yaml_tag_directive_t + tag_directives_start int // The beginning of the tag directives list. + tag_directives_end int // The end of the tag directives list. + + start_implicit int // Is the document start indicator implicit? + end_implicit int // Is the document end indicator implicit? + + // The start/end of the document. + start_mark, end_mark yaml_mark_t +} + +// The prototype of a read handler. +// +// The read handler is called when the parser needs to read more bytes from the +// source. The handler should write not more than size bytes to the buffer. +// The number of written bytes should be set to the size_read variable. +// +// [in,out] data A pointer to an application data specified by +// yaml_parser_set_input(). +// [out] buffer The buffer to write the data from the source. +// [in] size The size of the buffer. +// [out] size_read The actual number of bytes read from the source. +// +// On success, the handler should return 1. If the handler failed, +// the returned value should be 0. On EOF, the handler should set the +// size_read to 0 and return 1. +type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) + +// This structure holds information about a potential simple key. +type yaml_simple_key_t struct { + possible bool // Is a simple key possible? + required bool // Is a simple key required? + token_number int // The number of the token. + mark yaml_mark_t // The position mark. +} + +// The states of the parser. +type yaml_parser_state_t int + +const ( + yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota + + yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. + yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. + yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. + yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. + yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. + yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. + yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. + yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. + yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. + yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. + yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. + yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. + yaml_PARSE_END_STATE // Expect nothing. +) + +func (ps yaml_parser_state_t) String() string { + switch ps { + case yaml_PARSE_STREAM_START_STATE: + return "yaml_PARSE_STREAM_START_STATE" + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_START_STATE: + return "yaml_PARSE_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return "yaml_PARSE_DOCUMENT_CONTENT_STATE" + case yaml_PARSE_DOCUMENT_END_STATE: + return "yaml_PARSE_DOCUMENT_END_STATE" + case yaml_PARSE_BLOCK_NODE_STATE: + return "yaml_PARSE_BLOCK_NODE_STATE" + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" + case yaml_PARSE_FLOW_NODE_STATE: + return "yaml_PARSE_FLOW_NODE_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" + case yaml_PARSE_END_STATE: + return "yaml_PARSE_END_STATE" + } + return "" +} + +// This structure holds aliases data. +type yaml_alias_data_t struct { + anchor []byte // The anchor. + index int // The node id. + mark yaml_mark_t // The anchor mark. +} + +// The parser structure. +// +// All members are internal. Manage the structure using the +// yaml_parser_ family of functions. +type yaml_parser_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + + problem string // Error description. + + // The byte about which the problem occurred. + problem_offset int + problem_value int + problem_mark yaml_mark_t + + // The error context. + context string + context_mark yaml_mark_t + + // Reader stuff + + read_handler yaml_read_handler_t // Read handler. + + input_reader io.Reader // File input data. + input []byte // String input data. + input_pos int + + eof bool // EOF flag + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + unread int // The number of unread characters in the buffer. + + newlines int // The number of line breaks since last non-break/non-blank character + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The input encoding. + + offset int // The offset of the current position (in bytes). + mark yaml_mark_t // The mark of the current position. + + // Comments + + head_comment []byte // The current head comments + line_comment []byte // The current line comments + foot_comment []byte // The current foot comments + tail_comment []byte // Foot comment that happens at the end of a block. + stem_comment []byte // Comment in item preceding a nested structure (list inside list item, etc) + + comments []yaml_comment_t // The folded comments for all parsed tokens + comments_head int + + // Scanner stuff + + stream_start_produced bool // Have we started to scan the input stream? + stream_end_produced bool // Have we reached the end of the input stream? + + flow_level int // The number of unclosed '[' and '{' indicators. + + tokens []yaml_token_t // The tokens queue. + tokens_head int // The head of the tokens queue. + tokens_parsed int // The number of tokens fetched from the queue. + token_available bool // Does the tokens queue contain a token ready for dequeueing. + + indent int // The current indentation level. + indents []int // The indentation levels stack. + + simple_key_allowed bool // May a simple key occur at the current position? + simple_keys []yaml_simple_key_t // The stack of simple keys. + simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number + + // Parser stuff + + state yaml_parser_state_t // The current parser state. + states []yaml_parser_state_t // The parser states stack. + marks []yaml_mark_t // The stack of marks. + tag_directives []yaml_tag_directive_t // The list of TAG directives. + + // Dumper stuff + + aliases []yaml_alias_data_t // The alias data. + + document *yaml_document_t // The currently parsed document. +} + +type yaml_comment_t struct { + + scan_mark yaml_mark_t // Position where scanning for comments started + token_mark yaml_mark_t // Position after which tokens will be associated with this comment + start_mark yaml_mark_t // Position of '#' comment mark + end_mark yaml_mark_t // Position where comment terminated + + head []byte + line []byte + foot []byte +} + +// Emitter Definitions + +// The prototype of a write handler. +// +// The write handler is called when the emitter needs to flush the accumulated +// characters to the output. The handler should write @a size bytes of the +// @a buffer to the output. +// +// @param[in,out] data A pointer to an application data specified by +// yaml_emitter_set_output(). +// @param[in] buffer The buffer with bytes to be written. +// @param[in] size The size of the buffer. +// +// @returns On success, the handler should return @c 1. If the handler failed, +// the returned value should be @c 0. +// +type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error + +type yaml_emitter_state_t int + +// The emitter states. +const ( + // Expect STREAM-START. + yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota + + yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. + yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE // Expect the next item of a flow sequence, with the comma already written out + yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. + yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE // Expect the next key of a flow mapping, with the comma already written out + yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. + yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. + yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. + yaml_EMIT_END_STATE // Expect nothing. +) + +// The emitter structure. +// +// All members are internal. Manage the structure using the @c yaml_emitter_ +// family of functions. +type yaml_emitter_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + problem string // Error description. + + // Writer stuff + + write_handler yaml_write_handler_t // Write handler. + + output_buffer *[]byte // String output data. + output_writer io.Writer // File output data. + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The stream encoding. + + // Emitter stuff + + canonical bool // If the output is in the canonical style? + best_indent int // The number of indentation spaces. + best_width int // The preferred width of the output lines. + unicode bool // Allow unescaped non-ASCII characters? + line_break yaml_break_t // The preferred line break. + + state yaml_emitter_state_t // The current emitter state. + states []yaml_emitter_state_t // The stack of states. + + events []yaml_event_t // The event queue. + events_head int // The head of the event queue. + + indents []int // The stack of indentation levels. + + tag_directives []yaml_tag_directive_t // The list of tag directives. + + indent int // The current indentation level. + + flow_level int // The current flow level. + + root_context bool // Is it the document root context? + sequence_context bool // Is it a sequence context? + mapping_context bool // Is it a mapping context? + simple_key_context bool // Is it a simple mapping key context? + + line int // The current line. + column int // The current column. + whitespace bool // If the last character was a whitespace? + indention bool // If the last character was an indentation character (' ', '-', '?', ':')? + open_ended bool // If an explicit document end is required? + + space_above bool // Is there's an empty line above? + foot_indent int // The indent used to write the foot comment above, or -1 if none. + + // Anchor analysis. + anchor_data struct { + anchor []byte // The anchor value. + alias bool // Is it an alias? + } + + // Tag analysis. + tag_data struct { + handle []byte // The tag handle. + suffix []byte // The tag suffix. + } + + // Scalar analysis. + scalar_data struct { + value []byte // The scalar value. + multiline bool // Does the scalar contain line breaks? + flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? + block_plain_allowed bool // Can the scalar be expressed in the block plain style? + single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? + block_allowed bool // Can the scalar be expressed in the literal or folded styles? + style yaml_scalar_style_t // The output style. + } + + // Comments + head_comment []byte + line_comment []byte + foot_comment []byte + tail_comment []byte + + key_line_comment []byte + + // Dumper stuff + + opened bool // If the stream was already opened? + closed bool // If the stream was already closed? + + // The information associated with the document nodes. + anchors *struct { + references int // The number of references. + anchor int // The anchor id. + serialized bool // If the node has been emitted? + } + + last_anchor_id int // The last assigned anchor id. + + document *yaml_document_t // The currently emitted document. +} diff --git a/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/vendor/gopkg.in/yaml.v3/yamlprivateh.go new file mode 100644 index 0000000..e88f9c5 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -0,0 +1,198 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +const ( + // The size of the input raw buffer. + input_raw_buffer_size = 512 + + // The size of the input buffer. + // It should be possible to decode the whole raw buffer. + input_buffer_size = input_raw_buffer_size * 3 + + // The size of the output buffer. + output_buffer_size = 128 + + // The size of the output raw buffer. + // It should be possible to encode the whole output buffer. + output_raw_buffer_size = (output_buffer_size*2 + 2) + + // The size of other stacks and queues. + initial_stack_size = 16 + initial_queue_size = 16 + initial_string_size = 16 +) + +// Check if the character at the specified position is an alphabetical +// character, a digit, '_', or '-'. +func is_alpha(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' +} + +// Check if the character at the specified position is a digit. +func is_digit(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' +} + +// Get the value of a digit. +func as_digit(b []byte, i int) int { + return int(b[i]) - '0' +} + +// Check if the character at the specified position is a hex-digit. +func is_hex(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' +} + +// Get the value of a hex-digit. +func as_hex(b []byte, i int) int { + bi := b[i] + if bi >= 'A' && bi <= 'F' { + return int(bi) - 'A' + 10 + } + if bi >= 'a' && bi <= 'f' { + return int(bi) - 'a' + 10 + } + return int(bi) - '0' +} + +// Check if the character is ASCII. +func is_ascii(b []byte, i int) bool { + return b[i] <= 0x7F +} + +// Check if the character at the start of the buffer can be printed unescaped. +func is_printable(b []byte, i int) bool { + return ((b[i] == 0x0A) || // . == #x0A + (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E + (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF + (b[i] > 0xC2 && b[i] < 0xED) || + (b[i] == 0xED && b[i+1] < 0xA0) || + (b[i] == 0xEE) || + (b[i] == 0xEF && // #xE000 <= . <= #xFFFD + !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF + !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) +} + +// Check if the character at the specified position is NUL. +func is_z(b []byte, i int) bool { + return b[i] == 0x00 +} + +// Check if the beginning of the buffer is a BOM. +func is_bom(b []byte, i int) bool { + return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF +} + +// Check if the character at the specified position is space. +func is_space(b []byte, i int) bool { + return b[i] == ' ' +} + +// Check if the character at the specified position is tab. +func is_tab(b []byte, i int) bool { + return b[i] == '\t' +} + +// Check if the character at the specified position is blank (space or tab). +func is_blank(b []byte, i int) bool { + //return is_space(b, i) || is_tab(b, i) + return b[i] == ' ' || b[i] == '\t' +} + +// Check if the character at the specified position is a line break. +func is_break(b []byte, i int) bool { + return (b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) +} + +func is_crlf(b []byte, i int) bool { + return b[i] == '\r' && b[i+1] == '\n' +} + +// Check if the character is a line break or NUL. +func is_breakz(b []byte, i int) bool { + //return is_break(b, i) || is_z(b, i) + return ( + // is_break: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + // is_z: + b[i] == 0) +} + +// Check if the character is a line break, space, or NUL. +func is_spacez(b []byte, i int) bool { + //return is_space(b, i) || is_breakz(b, i) + return ( + // is_space: + b[i] == ' ' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Check if the character is a line break, space, tab, or NUL. +func is_blankz(b []byte, i int) bool { + //return is_blank(b, i) || is_breakz(b, i) + return ( + // is_blank: + b[i] == ' ' || b[i] == '\t' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Determine the width of the character. +func width(b byte) int { + // Don't replace these by a switch without first + // confirming that it is being inlined. + if b&0x80 == 0x00 { + return 1 + } + if b&0xE0 == 0xC0 { + return 2 + } + if b&0xF0 == 0xE0 { + return 3 + } + if b&0xF8 == 0xF0 { + return 4 + } + return 0 + +} From 1d3efe56b0146114fa2ebb2f4dd041e021fb5950 Mon Sep 17 00:00:00 2001 From: shuwenwei <55970239+shuwenwei@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:13:48 +0800 Subject: [PATCH 2/4] Fix multiple issues in SessionPool and PooledTableSession (#153) --- client/sessionpool.go | 11 +- client/tablesessionpool.go | 39 +- common/common.go | 469 +- rpc/client.go | 21218 +++++++++++++++++++---------------- test/e2e/e2e_table_test.go | 57 + 5 files changed, 12025 insertions(+), 9769 deletions(-) diff --git a/client/sessionpool.go b/client/sessionpool.go index 2670196..757b298 100644 --- a/client/sessionpool.go +++ b/client/sessionpool.go @@ -91,7 +91,10 @@ func (spool *SessionPool) GetSession() (session Session, err error) { } default: config := spool.config - session, err := spool.ConstructSession(config) + session, err = spool.ConstructSession(config) + if err != nil { + <-spool.sem + } return session, err } case <-time.After(time.Millisecond * time.Duration(spool.waitToGetSessionTimeoutInMs)): @@ -165,7 +168,7 @@ func (spool *SessionPool) PutBack(session Session) { session.Close() } }() - if session.trans.IsOpen() { + if session.trans != nil && session.trans.IsOpen() { spool.ch <- session } <-spool.sem @@ -174,7 +177,9 @@ func (spool *SessionPool) PutBack(session Session) { func (spool *SessionPool) dropSession(session Session) { defer func() { if e := recover(); e != nil { - session.Close() + if session.trans != nil && session.trans.IsOpen() { + session.Close() + } } }() err := session.Close() diff --git a/client/tablesessionpool.go b/client/tablesessionpool.go index 482d56e..17fa173 100644 --- a/client/tablesessionpool.go +++ b/client/tablesessionpool.go @@ -25,6 +25,8 @@ import ( "sync/atomic" ) +var ErrTableSessionClosed = errors.New("table session has been closed") + // TableSessionPool manages a pool of ITableSession instances, enabling efficient // reuse and management of resources. It provides methods to acquire a session // from the pool and to close the pool, releasing all held resources. @@ -99,14 +101,18 @@ func isConnectionError(err error) bool { // Returns: // - err: An error if an issue occurs during the operation. func (s *PooledTableSession) Insert(tablet *Tablet) error { + if atomic.LoadInt32(&s.closed) == 1 { + return ErrTableSessionClosed + } err := s.session.insertRelationalTablet(tablet) if err == nil { return nil } if isConnectionError(err) { - s.sessionPool.dropSession(s.session) - atomic.StoreInt32(&s.closed, 1) - s.session = Session{} + if atomic.CompareAndSwapInt32(&s.closed, 0, 1) { + s.sessionPool.dropSession(s.session) + s.session = Session{} + } } return err } @@ -119,14 +125,18 @@ func (s *PooledTableSession) Insert(tablet *Tablet) error { // Returns: // - err: An error if an issue occurs during the operation. func (s *PooledTableSession) ExecuteNonQueryStatement(sql string) error { + if atomic.LoadInt32(&s.closed) == 1 { + return ErrTableSessionClosed + } err := s.session.ExecuteNonQueryStatement(sql) if err == nil { return nil } if isConnectionError(err) { - s.sessionPool.dropSession(s.session) - atomic.StoreInt32(&s.closed, 1) - s.session = Session{} + if atomic.CompareAndSwapInt32(&s.closed, 0, 1) { + s.sessionPool.dropSession(s.session) + s.session = Session{} + } } return err } @@ -141,14 +151,18 @@ func (s *PooledTableSession) ExecuteNonQueryStatement(sql string) error { // - result: A pointer to SessionDataSet containing the query results. // - err: An error if an issue occurs during the operation. func (s *PooledTableSession) ExecuteQueryStatement(sql string, timeoutInMs *int64) (*SessionDataSet, error) { + if atomic.LoadInt32(&s.closed) == 1 { + return nil, ErrTableSessionClosed + } sessionDataSet, err := s.session.ExecuteQueryStatement(sql, timeoutInMs) if err == nil { return sessionDataSet, nil } if isConnectionError(err) { - s.sessionPool.dropSession(s.session) - atomic.StoreInt32(&s.closed, 1) - s.session = Session{} + if atomic.CompareAndSwapInt32(&s.closed, 0, 1) { + s.sessionPool.dropSession(s.session) + s.session = Session{} + } } return nil, err } @@ -163,12 +177,13 @@ func (s *PooledTableSession) Close() error { err := s.session.ExecuteNonQueryStatement("use " + s.sessionPool.config.Database) if err != nil { log.Println("Failed to change back database by executing: use ", s.sessionPool.config.Database) - s.session.Close() + s.sessionPool.dropSession(s.session) + s.session = Session{} return nil } } + s.sessionPool.PutBack(s.session) + s.session = Session{} } - s.sessionPool.PutBack(s.session) - s.session = Session{} return nil } diff --git a/common/common.go b/common/common.go index dcd6b46..5679270 100644 --- a/common/common.go +++ b/common/common.go @@ -7124,6 +7124,461 @@ func (p *TNodeLocations) String() string { return fmt.Sprintf("TNodeLocations(%+v)", *p) } +// Attributes: +// - Status +// - ExternalServiceInfos +type TExternalServiceListResp struct { + Status *TSStatus `thrift:"status,1,required" db:"status" json:"status"` + ExternalServiceInfos []*TExternalServiceEntry `thrift:"externalServiceInfos,2,required" db:"externalServiceInfos" json:"externalServiceInfos"` +} + +func NewTExternalServiceListResp() *TExternalServiceListResp { + return &TExternalServiceListResp{} +} + +var TExternalServiceListResp_Status_DEFAULT *TSStatus +func (p *TExternalServiceListResp) GetStatus() *TSStatus { + if !p.IsSetStatus() { + return TExternalServiceListResp_Status_DEFAULT + } +return p.Status +} + +func (p *TExternalServiceListResp) GetExternalServiceInfos() []*TExternalServiceEntry { + return p.ExternalServiceInfos +} +func (p *TExternalServiceListResp) IsSetStatus() bool { + return p.Status != nil +} + +func (p *TExternalServiceListResp) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetStatus bool = false; + var issetExternalServiceInfos bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetStatus = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.LIST { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetExternalServiceInfos = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + } + if !issetExternalServiceInfos{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ExternalServiceInfos is not set")); + } + return nil +} + +func (p *TExternalServiceListResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + } + return nil +} + +func (p *TExternalServiceListResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]*TExternalServiceEntry, 0, size) + p.ExternalServiceInfos = tSlice + for i := 0; i < size; i ++ { + _elem38 := &TExternalServiceEntry{} + if err := _elem38.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem38), err) + } + p.ExternalServiceInfos = append(p.ExternalServiceInfos, _elem38) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TExternalServiceListResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TExternalServiceListResp"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TExternalServiceListResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return err +} + +func (p *TExternalServiceListResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "externalServiceInfos", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:externalServiceInfos: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.ExternalServiceInfos)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.ExternalServiceInfos { + if err := v.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:externalServiceInfos: ", p), err) } + return err +} + +func (p *TExternalServiceListResp) Equals(other *TExternalServiceListResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Status.Equals(other.Status) { return false } + if len(p.ExternalServiceInfos) != len(other.ExternalServiceInfos) { return false } + for i, _tgt := range p.ExternalServiceInfos { + _src39 := other.ExternalServiceInfos[i] + if !_tgt.Equals(_src39) { return false } + } + return true +} + +func (p *TExternalServiceListResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TExternalServiceListResp(%+v)", *p) +} + +// Attributes: +// - ServiceName +// - ClassName +// - State +// - DataNodeId +// - ServiceType +type TExternalServiceEntry struct { + ServiceName string `thrift:"serviceName,1,required" db:"serviceName" json:"serviceName"` + ClassName string `thrift:"className,2,required" db:"className" json:"className"` + State int8 `thrift:"state,3,required" db:"state" json:"state"` + DataNodeId int32 `thrift:"dataNodeId,4,required" db:"dataNodeId" json:"dataNodeId"` + ServiceType int8 `thrift:"serviceType,5,required" db:"serviceType" json:"serviceType"` +} + +func NewTExternalServiceEntry() *TExternalServiceEntry { + return &TExternalServiceEntry{} +} + + +func (p *TExternalServiceEntry) GetServiceName() string { + return p.ServiceName +} + +func (p *TExternalServiceEntry) GetClassName() string { + return p.ClassName +} + +func (p *TExternalServiceEntry) GetState() int8 { + return p.State +} + +func (p *TExternalServiceEntry) GetDataNodeId() int32 { + return p.DataNodeId +} + +func (p *TExternalServiceEntry) GetServiceType() int8 { + return p.ServiceType +} +func (p *TExternalServiceEntry) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetServiceName bool = false; + var issetClassName bool = false; + var issetState bool = false; + var issetDataNodeId bool = false; + var issetServiceType bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetServiceName = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRING { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetClassName = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.BYTE { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + issetState = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.I32 { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + issetDataNodeId = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.BYTE { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + issetServiceType = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetServiceName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set")); + } + if !issetClassName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ClassName is not set")); + } + if !issetState{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field State is not set")); + } + if !issetDataNodeId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataNodeId is not set")); + } + if !issetServiceType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceType is not set")); + } + return nil +} + +func (p *TExternalServiceEntry) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.ServiceName = v +} + return nil +} + +func (p *TExternalServiceEntry) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.ClassName = v +} + return nil +} + +func (p *TExternalServiceEntry) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadByte(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + temp := int8(v) + p.State = temp +} + return nil +} + +func (p *TExternalServiceEntry) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.DataNodeId = v +} + return nil +} + +func (p *TExternalServiceEntry) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadByte(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) +} else { + temp := int8(v) + p.ServiceType = temp +} + return nil +} + +func (p *TExternalServiceEntry) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TExternalServiceEntry"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TExternalServiceEntry) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) } + return err +} + +func (p *TExternalServiceEntry) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "className", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:className: ", p), err) } + if err := oprot.WriteString(ctx, string(p.ClassName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.className (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:className: ", p), err) } + return err +} + +func (p *TExternalServiceEntry) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "state", thrift.BYTE, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:state: ", p), err) } + if err := oprot.WriteByte(ctx, int8(p.State)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.state (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:state: ", p), err) } + return err +} + +func (p *TExternalServiceEntry) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "dataNodeId", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:dataNodeId: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.DataNodeId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.dataNodeId (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:dataNodeId: ", p), err) } + return err +} + +func (p *TExternalServiceEntry) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serviceType", thrift.BYTE, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:serviceType: ", p), err) } + if err := oprot.WriteByte(ctx, int8(p.ServiceType)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.serviceType (5) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:serviceType: ", p), err) } + return err +} + +func (p *TExternalServiceEntry) Equals(other *TExternalServiceEntry) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ServiceName != other.ServiceName { return false } + if p.ClassName != other.ClassName { return false } + if p.State != other.State { return false } + if p.DataNodeId != other.DataNodeId { return false } + if p.ServiceType != other.ServiceType { return false } + return true +} + +func (p *TExternalServiceEntry) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TExternalServiceEntry(%+v)", *p) +} + // Attributes: // - Status // - Content @@ -7535,19 +7990,19 @@ func (p *TShowAppliedConfigurationsResp) ReadField2(ctx context.Context, iprot tMap := make(map[string]string, size) p.Data = tMap for i := 0; i < size; i ++ { -var _key38 string +var _key40 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key38 = v + _key40 = v } -var _val39 string +var _val41 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val39 = v + _val41 = v } - p.Data[_key38] = _val39 + p.Data[_key40] = _val41 } if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) @@ -7611,8 +8066,8 @@ func (p *TShowAppliedConfigurationsResp) Equals(other *TShowAppliedConfiguration if !p.Status.Equals(other.Status) { return false } if len(p.Data) != len(other.Data) { return false } for k, _tgt := range p.Data { - _src40 := other.Data[k] - if _tgt != _src40 { return false } + _src42 := other.Data[k] + if _tgt != _src42 { return false } } return true } diff --git a/rpc/client.go b/rpc/client.go index 061a712..de7682f 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -4118,78 +4118,38 @@ func (p *TSCloseOperationReq) String() string { // Attributes: // - SessionId -// - Statement -// - FetchSize -// - QueryId -// - IsAlign -// - Timeout -// - StatementId -type TSFetchResultsReq struct { +// - Sql +// - StatementName +type TSPrepareReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Statement string `thrift:"statement,2,required" db:"statement" json:"statement"` - FetchSize int32 `thrift:"fetchSize,3,required" db:"fetchSize" json:"fetchSize"` - QueryId int64 `thrift:"queryId,4,required" db:"queryId" json:"queryId"` - IsAlign bool `thrift:"isAlign,5,required" db:"isAlign" json:"isAlign"` - Timeout *int64 `thrift:"timeout,6" db:"timeout" json:"timeout,omitempty"` - StatementId *int64 `thrift:"statementId,7" db:"statementId" json:"statementId,omitempty"` + Sql string `thrift:"sql,2,required" db:"sql" json:"sql"` + StatementName string `thrift:"statementName,3,required" db:"statementName" json:"statementName"` } -func NewTSFetchResultsReq() *TSFetchResultsReq { - return &TSFetchResultsReq{} +func NewTSPrepareReq() *TSPrepareReq { + return &TSPrepareReq{} } -func (p *TSFetchResultsReq) GetSessionId() int64 { +func (p *TSPrepareReq) GetSessionId() int64 { return p.SessionId } -func (p *TSFetchResultsReq) GetStatement() string { - return p.Statement -} - -func (p *TSFetchResultsReq) GetFetchSize() int32 { - return p.FetchSize -} - -func (p *TSFetchResultsReq) GetQueryId() int64 { - return p.QueryId -} - -func (p *TSFetchResultsReq) GetIsAlign() bool { - return p.IsAlign -} -var TSFetchResultsReq_Timeout_DEFAULT int64 -func (p *TSFetchResultsReq) GetTimeout() int64 { - if !p.IsSetTimeout() { - return TSFetchResultsReq_Timeout_DEFAULT - } -return *p.Timeout -} -var TSFetchResultsReq_StatementId_DEFAULT int64 -func (p *TSFetchResultsReq) GetStatementId() int64 { - if !p.IsSetStatementId() { - return TSFetchResultsReq_StatementId_DEFAULT - } -return *p.StatementId -} -func (p *TSFetchResultsReq) IsSetTimeout() bool { - return p.Timeout != nil +func (p *TSPrepareReq) GetSql() string { + return p.Sql } -func (p *TSFetchResultsReq) IsSetStatementId() bool { - return p.StatementId != nil +func (p *TSPrepareReq) GetStatementName() string { + return p.StatementName } - -func (p *TSFetchResultsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSPrepareReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetStatement bool = false; - var issetFetchSize bool = false; - var issetQueryId bool = false; - var issetIsAlign bool = false; + var issetSql bool = false; + var issetStatementName bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -4214,60 +4174,18 @@ func (p *TSFetchResultsReq) Read(ctx context.Context, iprot thrift.TProtocol) er if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetStatement = true + issetSql = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.STRING { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetFetchSize = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I64 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetQueryId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - issetIsAlign = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.I64 { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.I64 { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } + issetStatementName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -4288,22 +4206,16 @@ func (p *TSFetchResultsReq) Read(ctx context.Context, iprot thrift.TProtocol) er if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetStatement{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Statement is not set")); - } - if !issetFetchSize{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FetchSize is not set")); - } - if !issetQueryId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field QueryId is not set")); + if !issetSql{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Sql is not set")); } - if !issetIsAlign{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAlign is not set")); + if !issetStatementName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementName is not set")); } return nil } -func (p *TSFetchResultsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSPrepareReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -4312,71 +4224,31 @@ func (p *TSFetchResultsReq) ReadField1(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSFetchResultsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSPrepareReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.Statement = v + p.Sql = v } return nil } -func (p *TSFetchResultsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { +func (p *TSPrepareReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.FetchSize = v -} - return nil -} - -func (p *TSFetchResultsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - p.QueryId = v -} - return nil -} - -func (p *TSFetchResultsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) -} else { - p.IsAlign = v -} - return nil -} - -func (p *TSFetchResultsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) -} else { - p.Timeout = &v -} - return nil -} - -func (p *TSFetchResultsReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) -} else { - p.StatementId = &v + p.StatementName = v } return nil } -func (p *TSFetchResultsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSFetchResultsReq"); err != nil { +func (p *TSPrepareReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSPrepareReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -4385,7 +4257,7 @@ func (p *TSFetchResultsReq) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TSFetchResultsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSPrepareReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -4395,194 +4267,276 @@ func (p *TSFetchResultsReq) writeField1(ctx context.Context, oprot thrift.TProto return err } -func (p *TSFetchResultsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "statement", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statement: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Statement)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statement (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statement: ", p), err) } - return err -} - -func (p *TSFetchResultsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.FetchSize)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fetchSize (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:fetchSize: ", p), err) } - return err -} - -func (p *TSFetchResultsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "queryId", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:queryId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.QueryId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.queryId (4) field write error: ", p), err) } +func (p *TSPrepareReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sql", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:sql: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Sql)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sql (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:queryId: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:sql: ", p), err) } return err } -func (p *TSFetchResultsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "isAlign", thrift.BOOL, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:isAlign: ", p), err) } - if err := oprot.WriteBool(ctx, bool(p.IsAlign)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAlign (5) field write error: ", p), err) } +func (p *TSPrepareReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementName", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:statementName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.StatementName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementName (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:isAlign: ", p), err) } - return err -} - -func (p *TSFetchResultsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:timeout: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:timeout: ", p), err) } - } - return err -} - -func (p *TSFetchResultsReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetStatementId() { - if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:statementId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.StatementId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statementId (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:statementId: ", p), err) } - } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:statementName: ", p), err) } return err } -func (p *TSFetchResultsReq) Equals(other *TSFetchResultsReq) bool { +func (p *TSPrepareReq) Equals(other *TSPrepareReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.Statement != other.Statement { return false } - if p.FetchSize != other.FetchSize { return false } - if p.QueryId != other.QueryId { return false } - if p.IsAlign != other.IsAlign { return false } - if p.Timeout != other.Timeout { - if p.Timeout == nil || other.Timeout == nil { - return false - } - if (*p.Timeout) != (*other.Timeout) { return false } - } - if p.StatementId != other.StatementId { - if p.StatementId == nil || other.StatementId == nil { - return false - } - if (*p.StatementId) != (*other.StatementId) { return false } - } + if p.Sql != other.Sql { return false } + if p.StatementName != other.StatementName { return false } return true } -func (p *TSFetchResultsReq) String() string { +func (p *TSPrepareReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSFetchResultsReq(%+v)", *p) + return fmt.Sprintf("TSPrepareReq(%+v)", *p) } // Attributes: // - Status -// - HasResultSet -// - IsAlign -// - QueryDataSet -// - NonAlignQueryDataSet -// - QueryResult_ -// - MoreData -type TSFetchResultsResp struct { +// - ParameterCount +type TSPrepareResp struct { Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - HasResultSet bool `thrift:"hasResultSet,2,required" db:"hasResultSet" json:"hasResultSet"` - IsAlign bool `thrift:"isAlign,3,required" db:"isAlign" json:"isAlign"` - QueryDataSet *TSQueryDataSet `thrift:"queryDataSet,4" db:"queryDataSet" json:"queryDataSet,omitempty"` - NonAlignQueryDataSet *TSQueryNonAlignDataSet `thrift:"nonAlignQueryDataSet,5" db:"nonAlignQueryDataSet" json:"nonAlignQueryDataSet,omitempty"` - QueryResult_ [][]byte `thrift:"queryResult,6" db:"queryResult" json:"queryResult,omitempty"` - MoreData *bool `thrift:"moreData,7" db:"moreData" json:"moreData,omitempty"` + ParameterCount *int32 `thrift:"parameterCount,2" db:"parameterCount" json:"parameterCount,omitempty"` } -func NewTSFetchResultsResp() *TSFetchResultsResp { - return &TSFetchResultsResp{} +func NewTSPrepareResp() *TSPrepareResp { + return &TSPrepareResp{} } -var TSFetchResultsResp_Status_DEFAULT *common.TSStatus -func (p *TSFetchResultsResp) GetStatus() *common.TSStatus { +var TSPrepareResp_Status_DEFAULT *common.TSStatus +func (p *TSPrepareResp) GetStatus() *common.TSStatus { if !p.IsSetStatus() { - return TSFetchResultsResp_Status_DEFAULT + return TSPrepareResp_Status_DEFAULT } return p.Status } - -func (p *TSFetchResultsResp) GetHasResultSet() bool { - return p.HasResultSet +var TSPrepareResp_ParameterCount_DEFAULT int32 +func (p *TSPrepareResp) GetParameterCount() int32 { + if !p.IsSetParameterCount() { + return TSPrepareResp_ParameterCount_DEFAULT + } +return *p.ParameterCount +} +func (p *TSPrepareResp) IsSetStatus() bool { + return p.Status != nil } -func (p *TSFetchResultsResp) GetIsAlign() bool { - return p.IsAlign +func (p *TSPrepareResp) IsSetParameterCount() bool { + return p.ParameterCount != nil } -var TSFetchResultsResp_QueryDataSet_DEFAULT *TSQueryDataSet -func (p *TSFetchResultsResp) GetQueryDataSet() *TSQueryDataSet { - if !p.IsSetQueryDataSet() { - return TSFetchResultsResp_QueryDataSet_DEFAULT + +func (p *TSPrepareResp) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } -return p.QueryDataSet + + var issetStatus bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetStatus = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.I32 { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + } + return nil } -var TSFetchResultsResp_NonAlignQueryDataSet_DEFAULT *TSQueryNonAlignDataSet -func (p *TSFetchResultsResp) GetNonAlignQueryDataSet() *TSQueryNonAlignDataSet { - if !p.IsSetNonAlignQueryDataSet() { - return TSFetchResultsResp_NonAlignQueryDataSet_DEFAULT + +func (p *TSPrepareResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) } -return p.NonAlignQueryDataSet + return nil } -var TSFetchResultsResp_QueryResult__DEFAULT [][]byte -func (p *TSFetchResultsResp) GetQueryResult_() [][]byte { - return p.QueryResult_ +func (p *TSPrepareResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.ParameterCount = &v } -var TSFetchResultsResp_MoreData_DEFAULT bool -func (p *TSFetchResultsResp) GetMoreData() bool { - if !p.IsSetMoreData() { - return TSFetchResultsResp_MoreData_DEFAULT + return nil +} + +func (p *TSPrepareResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSPrepareResp"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } -return *p.MoreData + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil } -func (p *TSFetchResultsResp) IsSetStatus() bool { - return p.Status != nil + +func (p *TSPrepareResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return err } -func (p *TSFetchResultsResp) IsSetQueryDataSet() bool { - return p.QueryDataSet != nil +func (p *TSPrepareResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetParameterCount() { + if err := oprot.WriteFieldBegin(ctx, "parameterCount", thrift.I32, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:parameterCount: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.ParameterCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.parameterCount (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:parameterCount: ", p), err) } + } + return err } -func (p *TSFetchResultsResp) IsSetNonAlignQueryDataSet() bool { - return p.NonAlignQueryDataSet != nil +func (p *TSPrepareResp) Equals(other *TSPrepareResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Status.Equals(other.Status) { return false } + if p.ParameterCount != other.ParameterCount { + if p.ParameterCount == nil || other.ParameterCount == nil { + return false + } + if (*p.ParameterCount) != (*other.ParameterCount) { return false } + } + return true } -func (p *TSFetchResultsResp) IsSetQueryResult_() bool { - return p.QueryResult_ != nil +func (p *TSPrepareResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TSPrepareResp(%+v)", *p) } -func (p *TSFetchResultsResp) IsSetMoreData() bool { - return p.MoreData != nil +// Attributes: +// - SessionId +// - StatementName +// - Parameters +// - FetchSize +// - Timeout +// - StatementId +type TSExecutePreparedReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + StatementName string `thrift:"statementName,2,required" db:"statementName" json:"statementName"` + Parameters []byte `thrift:"parameters,3,required" db:"parameters" json:"parameters"` + FetchSize *int32 `thrift:"fetchSize,4" db:"fetchSize" json:"fetchSize,omitempty"` + Timeout *int64 `thrift:"timeout,5" db:"timeout" json:"timeout,omitempty"` + StatementId int64 `thrift:"statementId,6,required" db:"statementId" json:"statementId"` } -func (p *TSFetchResultsResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func NewTSExecutePreparedReq() *TSExecutePreparedReq { + return &TSExecutePreparedReq{} +} + + +func (p *TSExecutePreparedReq) GetSessionId() int64 { + return p.SessionId +} + +func (p *TSExecutePreparedReq) GetStatementName() string { + return p.StatementName +} + +func (p *TSExecutePreparedReq) GetParameters() []byte { + return p.Parameters +} +var TSExecutePreparedReq_FetchSize_DEFAULT int32 +func (p *TSExecutePreparedReq) GetFetchSize() int32 { + if !p.IsSetFetchSize() { + return TSExecutePreparedReq_FetchSize_DEFAULT + } +return *p.FetchSize +} +var TSExecutePreparedReq_Timeout_DEFAULT int64 +func (p *TSExecutePreparedReq) GetTimeout() int64 { + if !p.IsSetTimeout() { + return TSExecutePreparedReq_Timeout_DEFAULT + } +return *p.Timeout +} + +func (p *TSExecutePreparedReq) GetStatementId() int64 { + return p.StatementId +} +func (p *TSExecutePreparedReq) IsSetFetchSize() bool { + return p.FetchSize != nil +} + +func (p *TSExecutePreparedReq) IsSetTimeout() bool { + return p.Timeout != nil +} + +func (p *TSExecutePreparedReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetStatus bool = false; - var issetHasResultSet bool = false; - var issetIsAlign bool = false; + var issetSessionId bool = false; + var issetStatementName bool = false; + var issetParameters bool = false; + var issetStatementId bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -4592,40 +4546,40 @@ func (p *TSFetchResultsResp) Read(ctx context.Context, iprot thrift.TProtocol) e if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetStatus = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetHasResultSet = true + issetStatementName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.STRING { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetIsAlign = true + issetParameters = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I32 { if err := p.ReadField4(ctx, iprot); err != nil { return err } @@ -4635,7 +4589,7 @@ func (p *TSFetchResultsResp) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 5: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I64 { if err := p.ReadField5(ctx, iprot); err != nil { return err } @@ -4645,20 +4599,11 @@ func (p *TSFetchResultsResp) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 6: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField6(ctx, iprot); err != nil { return err } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } + issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -4676,93 +4621,77 @@ func (p *TSFetchResultsResp) Read(ctx context.Context, iprot thrift.TProtocol) e if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetHasResultSet{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field HasResultSet is not set")); + if !issetStatementName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementName is not set")); } - if !issetIsAlign{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAlign is not set")); + if !issetParameters{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Parameters is not set")); + } + if !issetStatementId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); } return nil } -func (p *TSFetchResultsResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Status = &common.TSStatus{} - if err := p.Status.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) - } +func (p *TSExecutePreparedReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.SessionId = v +} return nil } -func (p *TSFetchResultsResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { +func (p *TSExecutePreparedReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.HasResultSet = v + p.StatementName = v } return nil } -func (p *TSFetchResultsResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { +func (p *TSExecutePreparedReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.IsAlign = v + p.Parameters = v } return nil } -func (p *TSFetchResultsResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - p.QueryDataSet = &TSQueryDataSet{} - if err := p.QueryDataSet.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueryDataSet), err) - } +func (p *TSExecutePreparedReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.FetchSize = &v +} return nil } -func (p *TSFetchResultsResp) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - p.NonAlignQueryDataSet = &TSQueryNonAlignDataSet{} - if err := p.NonAlignQueryDataSet.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NonAlignQueryDataSet), err) - } +func (p *TSExecutePreparedReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) +} else { + p.Timeout = &v +} return nil } -func (p *TSFetchResultsResp) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([][]byte, 0, size) - p.QueryResult_ = tSlice - for i := 0; i < size; i ++ { -var _elem35 []byte - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem35 = v -} - p.QueryResult_ = append(p.QueryResult_, _elem35) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSFetchResultsResp) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) +func (p *TSExecutePreparedReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { - p.MoreData = &v + p.StatementId = v } return nil } -func (p *TSFetchResultsResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSFetchResultsResp"); err != nil { +func (p *TSExecutePreparedReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSExecutePreparedReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -4771,7 +4700,6 @@ func (p *TSFetchResultsResp) Write(ctx context.Context, oprot thrift.TProtocol) if err := p.writeField4(ctx, oprot); err != nil { return err } if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -4780,191 +4708,129 @@ func (p *TSFetchResultsResp) Write(ctx context.Context, oprot thrift.TProtocol) return nil } -func (p *TSFetchResultsResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } +func (p *TSExecutePreparedReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TSFetchResultsResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "hasResultSet", thrift.BOOL, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hasResultSet: ", p), err) } - if err := oprot.WriteBool(ctx, bool(p.HasResultSet)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.hasResultSet (2) field write error: ", p), err) } +func (p *TSExecutePreparedReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementName", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statementName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.StatementName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementName (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hasResultSet: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statementName: ", p), err) } return err } -func (p *TSFetchResultsResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "isAlign", thrift.BOOL, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:isAlign: ", p), err) } - if err := oprot.WriteBool(ctx, bool(p.IsAlign)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAlign (3) field write error: ", p), err) } +func (p *TSExecutePreparedReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "parameters", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:parameters: ", p), err) } + if err := oprot.WriteBinary(ctx, p.Parameters); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.parameters (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:isAlign: ", p), err) } - return err -} - -func (p *TSFetchResultsResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetQueryDataSet() { - if err := oprot.WriteFieldBegin(ctx, "queryDataSet", thrift.STRUCT, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:queryDataSet: ", p), err) } - if err := p.QueryDataSet.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueryDataSet), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:queryDataSet: ", p), err) } - } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:parameters: ", p), err) } return err } -func (p *TSFetchResultsResp) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetNonAlignQueryDataSet() { - if err := oprot.WriteFieldBegin(ctx, "nonAlignQueryDataSet", thrift.STRUCT, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:nonAlignQueryDataSet: ", p), err) } - if err := p.NonAlignQueryDataSet.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonAlignQueryDataSet), err) - } +func (p *TSExecutePreparedReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetFetchSize() { + if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:fetchSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.fetchSize (4) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:nonAlignQueryDataSet: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:fetchSize: ", p), err) } } return err } -func (p *TSFetchResultsResp) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetQueryResult_() { - if err := oprot.WriteFieldBegin(ctx, "queryResult", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:queryResult: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.QueryResult_)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.QueryResult_ { - if err := oprot.WriteBinary(ctx, v); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSExecutePreparedReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTimeout() { + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timeout: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeout (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:queryResult: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timeout: ", p), err) } } return err } -func (p *TSFetchResultsResp) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMoreData() { - if err := oprot.WriteFieldBegin(ctx, "moreData", thrift.BOOL, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:moreData: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.MoreData)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.moreData (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:moreData: ", p), err) } - } +func (p *TSExecutePreparedReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:statementId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementId (6) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:statementId: ", p), err) } return err } -func (p *TSFetchResultsResp) Equals(other *TSFetchResultsResp) bool { +func (p *TSExecutePreparedReq) Equals(other *TSExecutePreparedReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if !p.Status.Equals(other.Status) { return false } - if p.HasResultSet != other.HasResultSet { return false } - if p.IsAlign != other.IsAlign { return false } - if !p.QueryDataSet.Equals(other.QueryDataSet) { return false } - if !p.NonAlignQueryDataSet.Equals(other.NonAlignQueryDataSet) { return false } - if len(p.QueryResult_) != len(other.QueryResult_) { return false } - for i, _tgt := range p.QueryResult_ { - _src36 := other.QueryResult_[i] - if bytes.Compare(_tgt, _src36) != 0 { return false } + if p.SessionId != other.SessionId { return false } + if p.StatementName != other.StatementName { return false } + if bytes.Compare(p.Parameters, other.Parameters) != 0 { return false } + if p.FetchSize != other.FetchSize { + if p.FetchSize == nil || other.FetchSize == nil { + return false + } + if (*p.FetchSize) != (*other.FetchSize) { return false } } - if p.MoreData != other.MoreData { - if p.MoreData == nil || other.MoreData == nil { + if p.Timeout != other.Timeout { + if p.Timeout == nil || other.Timeout == nil { return false } - if (*p.MoreData) != (*other.MoreData) { return false } + if (*p.Timeout) != (*other.Timeout) { return false } } + if p.StatementId != other.StatementId { return false } return true } -func (p *TSFetchResultsResp) String() string { +func (p *TSExecutePreparedReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSFetchResultsResp(%+v)", *p) + return fmt.Sprintf("TSExecutePreparedReq(%+v)", *p) } // Attributes: -// - Status -// - MetadataInJson -// - ColumnsList -// - DataType -type TSFetchMetadataResp struct { - Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - MetadataInJson *string `thrift:"metadataInJson,2" db:"metadataInJson" json:"metadataInJson,omitempty"` - ColumnsList []string `thrift:"columnsList,3" db:"columnsList" json:"columnsList,omitempty"` - DataType *string `thrift:"dataType,4" db:"dataType" json:"dataType,omitempty"` -} - -func NewTSFetchMetadataResp() *TSFetchMetadataResp { - return &TSFetchMetadataResp{} -} - -var TSFetchMetadataResp_Status_DEFAULT *common.TSStatus -func (p *TSFetchMetadataResp) GetStatus() *common.TSStatus { - if !p.IsSetStatus() { - return TSFetchMetadataResp_Status_DEFAULT - } -return p.Status -} -var TSFetchMetadataResp_MetadataInJson_DEFAULT string -func (p *TSFetchMetadataResp) GetMetadataInJson() string { - if !p.IsSetMetadataInJson() { - return TSFetchMetadataResp_MetadataInJson_DEFAULT - } -return *p.MetadataInJson +// - SessionId +// - StatementName +type TSDeallocatePreparedReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + StatementName string `thrift:"statementName,2,required" db:"statementName" json:"statementName"` } -var TSFetchMetadataResp_ColumnsList_DEFAULT []string -func (p *TSFetchMetadataResp) GetColumnsList() []string { - return p.ColumnsList -} -var TSFetchMetadataResp_DataType_DEFAULT string -func (p *TSFetchMetadataResp) GetDataType() string { - if !p.IsSetDataType() { - return TSFetchMetadataResp_DataType_DEFAULT - } -return *p.DataType -} -func (p *TSFetchMetadataResp) IsSetStatus() bool { - return p.Status != nil +func NewTSDeallocatePreparedReq() *TSDeallocatePreparedReq { + return &TSDeallocatePreparedReq{} } -func (p *TSFetchMetadataResp) IsSetMetadataInJson() bool { - return p.MetadataInJson != nil -} -func (p *TSFetchMetadataResp) IsSetColumnsList() bool { - return p.ColumnsList != nil +func (p *TSDeallocatePreparedReq) GetSessionId() int64 { + return p.SessionId } -func (p *TSFetchMetadataResp) IsSetDataType() bool { - return p.DataType != nil +func (p *TSDeallocatePreparedReq) GetStatementName() string { + return p.StatementName } - -func (p *TSFetchMetadataResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSDeallocatePreparedReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetStatus bool = false; + var issetSessionId bool = false; + var issetStatementName bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -4974,11 +4840,11 @@ func (p *TSFetchMetadataResp) Read(ctx context.Context, iprot thrift.TProtocol) if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetStatus = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -4989,26 +4855,7 @@ func (p *TSFetchMetadataResp) Read(ctx context.Context, iprot thrift.TProtocol) if err := p.ReadField2(ctx, iprot); err != nil { return err } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.LIST { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.STRING { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } + issetStatementName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -5026,205 +4873,159 @@ func (p *TSFetchMetadataResp) Read(ctx context.Context, iprot thrift.TProtocol) if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); + } + if !issetStatementName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementName is not set")); } return nil } -func (p *TSFetchMetadataResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Status = &common.TSStatus{} - if err := p.Status.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) - } +func (p *TSDeallocatePreparedReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.SessionId = v +} return nil } -func (p *TSFetchMetadataResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSDeallocatePreparedReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.MetadataInJson = &v + p.StatementName = v } return nil } -func (p *TSFetchMetadataResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.ColumnsList = tSlice - for i := 0; i < size; i ++ { -var _elem37 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem37 = v -} - p.ColumnsList = append(p.ColumnsList, _elem37) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) +func (p *TSDeallocatePreparedReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSDeallocatePreparedReq"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TSFetchMetadataResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - p.DataType = &v -} - return nil -} - -func (p *TSFetchMetadataResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSFetchMetadataResp"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil -} - -func (p *TSFetchMetadataResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } +func (p *TSDeallocatePreparedReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } - return err -} - -func (p *TSFetchMetadataResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMetadataInJson() { - if err := oprot.WriteFieldBegin(ctx, "metadataInJson", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:metadataInJson: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.MetadataInJson)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.metadataInJson (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:metadataInJson: ", p), err) } - } - return err -} - -func (p *TSFetchMetadataResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetColumnsList() { - if err := oprot.WriteFieldBegin(ctx, "columnsList", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:columnsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ColumnsList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.ColumnsList { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:columnsList: ", p), err) } - } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TSFetchMetadataResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetDataType() { - if err := oprot.WriteFieldBegin(ctx, "dataType", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:dataType: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.DataType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.dataType (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:dataType: ", p), err) } - } +func (p *TSDeallocatePreparedReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementName", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statementName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.StatementName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementName (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statementName: ", p), err) } return err } -func (p *TSFetchMetadataResp) Equals(other *TSFetchMetadataResp) bool { +func (p *TSDeallocatePreparedReq) Equals(other *TSDeallocatePreparedReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if !p.Status.Equals(other.Status) { return false } - if p.MetadataInJson != other.MetadataInJson { - if p.MetadataInJson == nil || other.MetadataInJson == nil { - return false - } - if (*p.MetadataInJson) != (*other.MetadataInJson) { return false } - } - if len(p.ColumnsList) != len(other.ColumnsList) { return false } - for i, _tgt := range p.ColumnsList { - _src38 := other.ColumnsList[i] - if _tgt != _src38 { return false } - } - if p.DataType != other.DataType { - if p.DataType == nil || other.DataType == nil { - return false - } - if (*p.DataType) != (*other.DataType) { return false } - } + if p.SessionId != other.SessionId { return false } + if p.StatementName != other.StatementName { return false } return true } -func (p *TSFetchMetadataResp) String() string { +func (p *TSDeallocatePreparedReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSFetchMetadataResp(%+v)", *p) + return fmt.Sprintf("TSDeallocatePreparedReq(%+v)", *p) } // Attributes: // - SessionId -// - Type -// - ColumnPath -type TSFetchMetadataReq struct { +// - Statement +// - FetchSize +// - QueryId +// - IsAlign +// - Timeout +// - StatementId +type TSFetchResultsReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Type string `thrift:"type,2,required" db:"type" json:"type"` - ColumnPath *string `thrift:"columnPath,3" db:"columnPath" json:"columnPath,omitempty"` + Statement string `thrift:"statement,2,required" db:"statement" json:"statement"` + FetchSize int32 `thrift:"fetchSize,3,required" db:"fetchSize" json:"fetchSize"` + QueryId int64 `thrift:"queryId,4,required" db:"queryId" json:"queryId"` + IsAlign bool `thrift:"isAlign,5,required" db:"isAlign" json:"isAlign"` + Timeout *int64 `thrift:"timeout,6" db:"timeout" json:"timeout,omitempty"` + StatementId *int64 `thrift:"statementId,7" db:"statementId" json:"statementId,omitempty"` } -func NewTSFetchMetadataReq() *TSFetchMetadataReq { - return &TSFetchMetadataReq{} +func NewTSFetchResultsReq() *TSFetchResultsReq { + return &TSFetchResultsReq{} } -func (p *TSFetchMetadataReq) GetSessionId() int64 { +func (p *TSFetchResultsReq) GetSessionId() int64 { return p.SessionId } -func (p *TSFetchMetadataReq) GetType() string { - return p.Type +func (p *TSFetchResultsReq) GetStatement() string { + return p.Statement } -var TSFetchMetadataReq_ColumnPath_DEFAULT string -func (p *TSFetchMetadataReq) GetColumnPath() string { - if !p.IsSetColumnPath() { - return TSFetchMetadataReq_ColumnPath_DEFAULT + +func (p *TSFetchResultsReq) GetFetchSize() int32 { + return p.FetchSize +} + +func (p *TSFetchResultsReq) GetQueryId() int64 { + return p.QueryId +} + +func (p *TSFetchResultsReq) GetIsAlign() bool { + return p.IsAlign +} +var TSFetchResultsReq_Timeout_DEFAULT int64 +func (p *TSFetchResultsReq) GetTimeout() int64 { + if !p.IsSetTimeout() { + return TSFetchResultsReq_Timeout_DEFAULT } -return *p.ColumnPath +return *p.Timeout } -func (p *TSFetchMetadataReq) IsSetColumnPath() bool { - return p.ColumnPath != nil +var TSFetchResultsReq_StatementId_DEFAULT int64 +func (p *TSFetchResultsReq) GetStatementId() int64 { + if !p.IsSetStatementId() { + return TSFetchResultsReq_StatementId_DEFAULT + } +return *p.StatementId +} +func (p *TSFetchResultsReq) IsSetTimeout() bool { + return p.Timeout != nil } -func (p *TSFetchMetadataReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchResultsReq) IsSetStatementId() bool { + return p.StatementId != nil +} + +func (p *TSFetchResultsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetType bool = false; + var issetStatement bool = false; + var issetFetchSize bool = false; + var issetQueryId bool = false; + var issetIsAlign bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -5249,17 +5050,60 @@ func (p *TSFetchMetadataReq) Read(ctx context.Context, iprot thrift.TProtocol) e if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetType = true + issetStatement = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I32 { if err := p.ReadField3(ctx, iprot); err != nil { return err } + issetFetchSize = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.I64 { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + issetQueryId = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + issetIsAlign = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 6: + if fieldTypeId == thrift.I64 { + if err := p.ReadField6(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 7: + if fieldTypeId == thrift.I64 { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -5280,13 +5124,22 @@ func (p *TSFetchMetadataReq) Read(ctx context.Context, iprot thrift.TProtocol) e if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + if !issetStatement{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Statement is not set")); + } + if !issetFetchSize{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FetchSize is not set")); + } + if !issetQueryId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field QueryId is not set")); + } + if !issetIsAlign{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAlign is not set")); } return nil } -func (p *TSFetchMetadataReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchResultsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -5295,40 +5148,80 @@ func (p *TSFetchMetadataReq) ReadField1(ctx context.Context, iprot thrift.TProt return nil } -func (p *TSFetchMetadataReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchResultsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.Type = v + p.Statement = v } return nil } -func (p *TSFetchMetadataReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TSFetchResultsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.ColumnPath = &v + p.FetchSize = v } return nil } -func (p *TSFetchMetadataReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSFetchMetadataReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { +func (p *TSFetchResultsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.QueryId = v +} + return nil +} + +func (p *TSFetchResultsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) +} else { + p.IsAlign = v +} + return nil +} + +func (p *TSFetchResultsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) +} else { + p.Timeout = &v +} + return nil +} + +func (p *TSFetchResultsReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) +} else { + p.StatementId = &v +} + return nil +} + +func (p *TSFetchResultsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSFetchResultsReq"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TSFetchMetadataReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSFetchResultsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -5338,86 +5231,194 @@ func (p *TSFetchMetadataReq) writeField1(ctx context.Context, oprot thrift.TProt return err } -func (p *TSFetchMetadataReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "type", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err) } +func (p *TSFetchResultsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statement", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statement: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Statement)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statement (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statement: ", p), err) } return err } -func (p *TSFetchMetadataReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetColumnPath() { - if err := oprot.WriteFieldBegin(ctx, "columnPath", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:columnPath: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.ColumnPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.columnPath (3) field write error: ", p), err) } +func (p *TSFetchResultsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.FetchSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.fetchSize (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:fetchSize: ", p), err) } + return err +} + +func (p *TSFetchResultsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "queryId", thrift.I64, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:queryId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.QueryId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.queryId (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:queryId: ", p), err) } + return err +} + +func (p *TSFetchResultsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "isAlign", thrift.BOOL, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:isAlign: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.IsAlign)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAlign (5) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:isAlign: ", p), err) } + return err +} + +func (p *TSFetchResultsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTimeout() { + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:timeout: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeout (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:columnPath: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:timeout: ", p), err) } } return err } -func (p *TSFetchMetadataReq) Equals(other *TSFetchMetadataReq) bool { +func (p *TSFetchResultsReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetStatementId() { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:statementId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.StatementId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementId (7) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:statementId: ", p), err) } + } + return err +} + +func (p *TSFetchResultsReq) Equals(other *TSFetchResultsReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.Type != other.Type { return false } - if p.ColumnPath != other.ColumnPath { - if p.ColumnPath == nil || other.ColumnPath == nil { + if p.Statement != other.Statement { return false } + if p.FetchSize != other.FetchSize { return false } + if p.QueryId != other.QueryId { return false } + if p.IsAlign != other.IsAlign { return false } + if p.Timeout != other.Timeout { + if p.Timeout == nil || other.Timeout == nil { return false } - if (*p.ColumnPath) != (*other.ColumnPath) { return false } + if (*p.Timeout) != (*other.Timeout) { return false } + } + if p.StatementId != other.StatementId { + if p.StatementId == nil || other.StatementId == nil { + return false + } + if (*p.StatementId) != (*other.StatementId) { return false } } return true } -func (p *TSFetchMetadataReq) String() string { +func (p *TSFetchResultsReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSFetchMetadataReq(%+v)", *p) + return fmt.Sprintf("TSFetchResultsReq(%+v)", *p) } // Attributes: // - Status -// - TimeZone -type TSGetTimeZoneResp struct { +// - HasResultSet +// - IsAlign +// - QueryDataSet +// - NonAlignQueryDataSet +// - QueryResult_ +// - MoreData +type TSFetchResultsResp struct { Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - TimeZone string `thrift:"timeZone,2,required" db:"timeZone" json:"timeZone"` + HasResultSet bool `thrift:"hasResultSet,2,required" db:"hasResultSet" json:"hasResultSet"` + IsAlign bool `thrift:"isAlign,3,required" db:"isAlign" json:"isAlign"` + QueryDataSet *TSQueryDataSet `thrift:"queryDataSet,4" db:"queryDataSet" json:"queryDataSet,omitempty"` + NonAlignQueryDataSet *TSQueryNonAlignDataSet `thrift:"nonAlignQueryDataSet,5" db:"nonAlignQueryDataSet" json:"nonAlignQueryDataSet,omitempty"` + QueryResult_ [][]byte `thrift:"queryResult,6" db:"queryResult" json:"queryResult,omitempty"` + MoreData *bool `thrift:"moreData,7" db:"moreData" json:"moreData,omitempty"` } -func NewTSGetTimeZoneResp() *TSGetTimeZoneResp { - return &TSGetTimeZoneResp{} +func NewTSFetchResultsResp() *TSFetchResultsResp { + return &TSFetchResultsResp{} } -var TSGetTimeZoneResp_Status_DEFAULT *common.TSStatus -func (p *TSGetTimeZoneResp) GetStatus() *common.TSStatus { +var TSFetchResultsResp_Status_DEFAULT *common.TSStatus +func (p *TSFetchResultsResp) GetStatus() *common.TSStatus { if !p.IsSetStatus() { - return TSGetTimeZoneResp_Status_DEFAULT + return TSFetchResultsResp_Status_DEFAULT } return p.Status } -func (p *TSGetTimeZoneResp) GetTimeZone() string { - return p.TimeZone +func (p *TSFetchResultsResp) GetHasResultSet() bool { + return p.HasResultSet } -func (p *TSGetTimeZoneResp) IsSetStatus() bool { + +func (p *TSFetchResultsResp) GetIsAlign() bool { + return p.IsAlign +} +var TSFetchResultsResp_QueryDataSet_DEFAULT *TSQueryDataSet +func (p *TSFetchResultsResp) GetQueryDataSet() *TSQueryDataSet { + if !p.IsSetQueryDataSet() { + return TSFetchResultsResp_QueryDataSet_DEFAULT + } +return p.QueryDataSet +} +var TSFetchResultsResp_NonAlignQueryDataSet_DEFAULT *TSQueryNonAlignDataSet +func (p *TSFetchResultsResp) GetNonAlignQueryDataSet() *TSQueryNonAlignDataSet { + if !p.IsSetNonAlignQueryDataSet() { + return TSFetchResultsResp_NonAlignQueryDataSet_DEFAULT + } +return p.NonAlignQueryDataSet +} +var TSFetchResultsResp_QueryResult__DEFAULT [][]byte + +func (p *TSFetchResultsResp) GetQueryResult_() [][]byte { + return p.QueryResult_ +} +var TSFetchResultsResp_MoreData_DEFAULT bool +func (p *TSFetchResultsResp) GetMoreData() bool { + if !p.IsSetMoreData() { + return TSFetchResultsResp_MoreData_DEFAULT + } +return *p.MoreData +} +func (p *TSFetchResultsResp) IsSetStatus() bool { return p.Status != nil } -func (p *TSGetTimeZoneResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchResultsResp) IsSetQueryDataSet() bool { + return p.QueryDataSet != nil +} + +func (p *TSFetchResultsResp) IsSetNonAlignQueryDataSet() bool { + return p.NonAlignQueryDataSet != nil +} + +func (p *TSFetchResultsResp) IsSetQueryResult_() bool { + return p.QueryResult_ != nil +} + +func (p *TSFetchResultsResp) IsSetMoreData() bool { + return p.MoreData != nil +} + +func (p *TSFetchResultsResp) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetStatus bool = false; - var issetTimeZone bool = false; + var issetHasResultSet bool = false; + var issetIsAlign bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -5438,38 +5439,92 @@ func (p *TSGetTimeZoneResp) Read(ctx context.Context, iprot thrift.TProtocol) er } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.BOOL { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetTimeZone = true + issetHasResultSet = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err + case 3: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + issetIsAlign = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); - } - if !issetTimeZone{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimeZone is not set")); + case 4: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 6: + if fieldTypeId == thrift.LIST { + if err := p.ReadField6(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 7: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + } + if !issetHasResultSet{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field HasResultSet is not set")); + } + if !issetIsAlign{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAlign is not set")); } return nil } -func (p *TSGetTimeZoneResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchResultsResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Status = &common.TSStatus{} if err := p.Status.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) @@ -5477,21 +5532,82 @@ func (p *TSGetTimeZoneResp) ReadField1(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSGetTimeZoneResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TSFetchResultsResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.TimeZone = v + p.HasResultSet = v } return nil } -func (p *TSGetTimeZoneResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSGetTimeZoneResp"); err != nil { +func (p *TSFetchResultsResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.IsAlign = v +} + return nil +} + +func (p *TSFetchResultsResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + p.QueryDataSet = &TSQueryDataSet{} + if err := p.QueryDataSet.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueryDataSet), err) + } + return nil +} + +func (p *TSFetchResultsResp) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + p.NonAlignQueryDataSet = &TSQueryNonAlignDataSet{} + if err := p.NonAlignQueryDataSet.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NonAlignQueryDataSet), err) + } + return nil +} + +func (p *TSFetchResultsResp) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([][]byte, 0, size) + p.QueryResult_ = tSlice + for i := 0; i < size; i ++ { +var _elem35 []byte + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem35 = v +} + p.QueryResult_ = append(p.QueryResult_, _elem35) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSFetchResultsResp) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) +} else { + p.MoreData = &v +} + return nil +} + +func (p *TSFetchResultsResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSFetchResultsResp"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -5500,7 +5616,7 @@ func (p *TSGetTimeZoneResp) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TSGetTimeZoneResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSFetchResultsResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } if err := p.Status.Write(ctx, oprot); err != nil { @@ -5511,61 +5627,180 @@ func (p *TSGetTimeZoneResp) writeField1(ctx context.Context, oprot thrift.TProto return err } -func (p *TSGetTimeZoneResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timeZone", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timeZone: ", p), err) } - if err := oprot.WriteString(ctx, string(p.TimeZone)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeZone (2) field write error: ", p), err) } +func (p *TSFetchResultsResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hasResultSet", thrift.BOOL, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hasResultSet: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.HasResultSet)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.hasResultSet (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timeZone: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hasResultSet: ", p), err) } return err } -func (p *TSGetTimeZoneResp) Equals(other *TSGetTimeZoneResp) bool { +func (p *TSFetchResultsResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "isAlign", thrift.BOOL, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:isAlign: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.IsAlign)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAlign (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:isAlign: ", p), err) } + return err +} + +func (p *TSFetchResultsResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetQueryDataSet() { + if err := oprot.WriteFieldBegin(ctx, "queryDataSet", thrift.STRUCT, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:queryDataSet: ", p), err) } + if err := p.QueryDataSet.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueryDataSet), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:queryDataSet: ", p), err) } + } + return err +} + +func (p *TSFetchResultsResp) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetNonAlignQueryDataSet() { + if err := oprot.WriteFieldBegin(ctx, "nonAlignQueryDataSet", thrift.STRUCT, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:nonAlignQueryDataSet: ", p), err) } + if err := p.NonAlignQueryDataSet.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonAlignQueryDataSet), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:nonAlignQueryDataSet: ", p), err) } + } + return err +} + +func (p *TSFetchResultsResp) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetQueryResult_() { + if err := oprot.WriteFieldBegin(ctx, "queryResult", thrift.LIST, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:queryResult: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.QueryResult_)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.QueryResult_ { + if err := oprot.WriteBinary(ctx, v); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:queryResult: ", p), err) } + } + return err +} + +func (p *TSFetchResultsResp) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMoreData() { + if err := oprot.WriteFieldBegin(ctx, "moreData", thrift.BOOL, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:moreData: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.MoreData)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.moreData (7) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:moreData: ", p), err) } + } + return err +} + +func (p *TSFetchResultsResp) Equals(other *TSFetchResultsResp) bool { if p == other { return true } else if p == nil || other == nil { return false } if !p.Status.Equals(other.Status) { return false } - if p.TimeZone != other.TimeZone { return false } + if p.HasResultSet != other.HasResultSet { return false } + if p.IsAlign != other.IsAlign { return false } + if !p.QueryDataSet.Equals(other.QueryDataSet) { return false } + if !p.NonAlignQueryDataSet.Equals(other.NonAlignQueryDataSet) { return false } + if len(p.QueryResult_) != len(other.QueryResult_) { return false } + for i, _tgt := range p.QueryResult_ { + _src36 := other.QueryResult_[i] + if bytes.Compare(_tgt, _src36) != 0 { return false } + } + if p.MoreData != other.MoreData { + if p.MoreData == nil || other.MoreData == nil { + return false + } + if (*p.MoreData) != (*other.MoreData) { return false } + } return true } -func (p *TSGetTimeZoneResp) String() string { +func (p *TSFetchResultsResp) String() string { if p == nil { return "" } - return fmt.Sprintf("TSGetTimeZoneResp(%+v)", *p) + return fmt.Sprintf("TSFetchResultsResp(%+v)", *p) } // Attributes: -// - SessionId -// - TimeZone -type TSSetTimeZoneReq struct { - SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - TimeZone string `thrift:"timeZone,2,required" db:"timeZone" json:"timeZone"` +// - Status +// - MetadataInJson +// - ColumnsList +// - DataType +type TSFetchMetadataResp struct { + Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` + MetadataInJson *string `thrift:"metadataInJson,2" db:"metadataInJson" json:"metadataInJson,omitempty"` + ColumnsList []string `thrift:"columnsList,3" db:"columnsList" json:"columnsList,omitempty"` + DataType *string `thrift:"dataType,4" db:"dataType" json:"dataType,omitempty"` } -func NewTSSetTimeZoneReq() *TSSetTimeZoneReq { - return &TSSetTimeZoneReq{} +func NewTSFetchMetadataResp() *TSFetchMetadataResp { + return &TSFetchMetadataResp{} } +var TSFetchMetadataResp_Status_DEFAULT *common.TSStatus +func (p *TSFetchMetadataResp) GetStatus() *common.TSStatus { + if !p.IsSetStatus() { + return TSFetchMetadataResp_Status_DEFAULT + } +return p.Status +} +var TSFetchMetadataResp_MetadataInJson_DEFAULT string +func (p *TSFetchMetadataResp) GetMetadataInJson() string { + if !p.IsSetMetadataInJson() { + return TSFetchMetadataResp_MetadataInJson_DEFAULT + } +return *p.MetadataInJson +} +var TSFetchMetadataResp_ColumnsList_DEFAULT []string -func (p *TSSetTimeZoneReq) GetSessionId() int64 { - return p.SessionId +func (p *TSFetchMetadataResp) GetColumnsList() []string { + return p.ColumnsList +} +var TSFetchMetadataResp_DataType_DEFAULT string +func (p *TSFetchMetadataResp) GetDataType() string { + if !p.IsSetDataType() { + return TSFetchMetadataResp_DataType_DEFAULT + } +return *p.DataType +} +func (p *TSFetchMetadataResp) IsSetStatus() bool { + return p.Status != nil } -func (p *TSSetTimeZoneReq) GetTimeZone() string { - return p.TimeZone +func (p *TSFetchMetadataResp) IsSetMetadataInJson() bool { + return p.MetadataInJson != nil } -func (p *TSSetTimeZoneReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + +func (p *TSFetchMetadataResp) IsSetColumnsList() bool { + return p.ColumnsList != nil +} + +func (p *TSFetchMetadataResp) IsSetDataType() bool { + return p.DataType != nil +} + +func (p *TSFetchMetadataResp) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetSessionId bool = false; - var issetTimeZone bool = false; + var issetStatus bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -5575,11 +5810,11 @@ func (p *TSSetTimeZoneReq) Read(ctx context.Context, iprot thrift.TProtocol) err if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.STRUCT { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetSessionId = true + issetStatus = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -5590,7 +5825,26 @@ func (p *TSSetTimeZoneReq) Read(ctx context.Context, iprot thrift.TProtocol) err if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetTimeZone = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.LIST { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.STRING { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -5608,39 +5862,68 @@ func (p *TSSetTimeZoneReq) Read(ctx context.Context, iprot thrift.TProtocol) err if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetSessionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); } - if !issetTimeZone{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimeZone is not set")); + return nil +} + +func (p *TSFetchMetadataResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) } return nil } -func (p *TSSetTimeZoneReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) +func (p *TSFetchMetadataResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - p.SessionId = v + p.MetadataInJson = &v } return nil } -func (p *TSSetTimeZoneReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchMetadataResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.ColumnsList = tSlice + for i := 0; i < size; i ++ { +var _elem37 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem37 = v +} + p.ColumnsList = append(p.ColumnsList, _elem37) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSFetchMetadataResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) + return thrift.PrependError("error reading field 4: ", err) } else { - p.TimeZone = v + p.DataType = &v } return nil } -func (p *TSSetTimeZoneReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSSetTimeZoneReq"); err != nil { +func (p *TSFetchMetadataResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSFetchMetadataResp"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -5649,129 +5932,135 @@ func (p *TSSetTimeZoneReq) Write(ctx context.Context, oprot thrift.TProtocol) er return nil } -func (p *TSSetTimeZoneReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } +func (p *TSFetchMetadataResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } -func (p *TSSetTimeZoneReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timeZone", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timeZone: ", p), err) } - if err := oprot.WriteString(ctx, string(p.TimeZone)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeZone (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timeZone: ", p), err) } +func (p *TSFetchMetadataResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMetadataInJson() { + if err := oprot.WriteFieldBegin(ctx, "metadataInJson", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:metadataInJson: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.MetadataInJson)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.metadataInJson (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:metadataInJson: ", p), err) } + } return err } -func (p *TSSetTimeZoneReq) Equals(other *TSSetTimeZoneReq) bool { +func (p *TSFetchMetadataResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetColumnsList() { + if err := oprot.WriteFieldBegin(ctx, "columnsList", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:columnsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ColumnsList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.ColumnsList { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:columnsList: ", p), err) } + } + return err +} + +func (p *TSFetchMetadataResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetDataType() { + if err := oprot.WriteFieldBegin(ctx, "dataType", thrift.STRING, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:dataType: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.DataType)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.dataType (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:dataType: ", p), err) } + } + return err +} + +func (p *TSFetchMetadataResp) Equals(other *TSFetchMetadataResp) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.SessionId != other.SessionId { return false } - if p.TimeZone != other.TimeZone { return false } + if !p.Status.Equals(other.Status) { return false } + if p.MetadataInJson != other.MetadataInJson { + if p.MetadataInJson == nil || other.MetadataInJson == nil { + return false + } + if (*p.MetadataInJson) != (*other.MetadataInJson) { return false } + } + if len(p.ColumnsList) != len(other.ColumnsList) { return false } + for i, _tgt := range p.ColumnsList { + _src38 := other.ColumnsList[i] + if _tgt != _src38 { return false } + } + if p.DataType != other.DataType { + if p.DataType == nil || other.DataType == nil { + return false + } + if (*p.DataType) != (*other.DataType) { return false } + } return true } -func (p *TSSetTimeZoneReq) String() string { +func (p *TSFetchMetadataResp) String() string { if p == nil { return "" } - return fmt.Sprintf("TSSetTimeZoneReq(%+v)", *p) + return fmt.Sprintf("TSFetchMetadataResp(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPath -// - Measurements -// - Values -// - Timestamp -// - IsAligned -// - IsWriteToTable -// - ColumnCategoryies -type TSInsertRecordReq struct { +// - Type +// - ColumnPath +type TSFetchMetadataReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` - Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` - Values []byte `thrift:"values,4,required" db:"values" json:"values"` - Timestamp int64 `thrift:"timestamp,5,required" db:"timestamp" json:"timestamp"` - IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` - IsWriteToTable *bool `thrift:"isWriteToTable,7" db:"isWriteToTable" json:"isWriteToTable,omitempty"` - ColumnCategoryies []int8 `thrift:"columnCategoryies,8" db:"columnCategoryies" json:"columnCategoryies,omitempty"` + Type string `thrift:"type,2,required" db:"type" json:"type"` + ColumnPath *string `thrift:"columnPath,3" db:"columnPath" json:"columnPath,omitempty"` } -func NewTSInsertRecordReq() *TSInsertRecordReq { - return &TSInsertRecordReq{} +func NewTSFetchMetadataReq() *TSFetchMetadataReq { + return &TSFetchMetadataReq{} } -func (p *TSInsertRecordReq) GetSessionId() int64 { +func (p *TSFetchMetadataReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertRecordReq) GetPrefixPath() string { - return p.PrefixPath +func (p *TSFetchMetadataReq) GetType() string { + return p.Type } - -func (p *TSInsertRecordReq) GetMeasurements() []string { - return p.Measurements +var TSFetchMetadataReq_ColumnPath_DEFAULT string +func (p *TSFetchMetadataReq) GetColumnPath() string { + if !p.IsSetColumnPath() { + return TSFetchMetadataReq_ColumnPath_DEFAULT + } +return *p.ColumnPath +} +func (p *TSFetchMetadataReq) IsSetColumnPath() bool { + return p.ColumnPath != nil } -func (p *TSInsertRecordReq) GetValues() []byte { - return p.Values -} - -func (p *TSInsertRecordReq) GetTimestamp() int64 { - return p.Timestamp -} -var TSInsertRecordReq_IsAligned_DEFAULT bool -func (p *TSInsertRecordReq) GetIsAligned() bool { - if !p.IsSetIsAligned() { - return TSInsertRecordReq_IsAligned_DEFAULT - } -return *p.IsAligned -} -var TSInsertRecordReq_IsWriteToTable_DEFAULT bool -func (p *TSInsertRecordReq) GetIsWriteToTable() bool { - if !p.IsSetIsWriteToTable() { - return TSInsertRecordReq_IsWriteToTable_DEFAULT - } -return *p.IsWriteToTable -} -var TSInsertRecordReq_ColumnCategoryies_DEFAULT []int8 - -func (p *TSInsertRecordReq) GetColumnCategoryies() []int8 { - return p.ColumnCategoryies -} -func (p *TSInsertRecordReq) IsSetIsAligned() bool { - return p.IsAligned != nil -} - -func (p *TSInsertRecordReq) IsSetIsWriteToTable() bool { - return p.IsWriteToTable != nil -} - -func (p *TSInsertRecordReq) IsSetColumnCategoryies() bool { - return p.ColumnCategoryies != nil -} - -func (p *TSInsertRecordReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchMetadataReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPath bool = false; - var issetMeasurements bool = false; - var issetValues bool = false; - var issetTimestamp bool = false; + var issetType bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -5796,68 +6085,15 @@ func (p *TSInsertRecordReq) Read(ctx context.Context, iprot thrift.TProtocol) er if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPath = true + issetType = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.LIST { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetMeasurements = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetValues = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.I64 { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - issetTimestamp = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.LIST { - if err := p.ReadField8(ctx, iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { @@ -5880,22 +6116,13 @@ func (p *TSInsertRecordReq) Read(ctx context.Context, iprot thrift.TProtocol) er if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); - } - if !issetMeasurements{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); - } - if !issetValues{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Values is not set")); - } - if !issetTimestamp{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")); + if !issetType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); } return nil } -func (p *TSInsertRecordReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchMetadataReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -5904,108 +6131,31 @@ func (p *TSInsertRecordReq) ReadField1(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSInsertRecordReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFetchMetadataReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.PrefixPath = v -} - return nil -} - -func (p *TSInsertRecordReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.Measurements = tSlice - for i := 0; i < size; i ++ { -var _elem39 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem39 = v -} - p.Measurements = append(p.Measurements, _elem39) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSInsertRecordReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - p.Values = v -} - return nil -} - -func (p *TSInsertRecordReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) -} else { - p.Timestamp = v -} - return nil -} - -func (p *TSInsertRecordReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) -} else { - p.IsAligned = &v -} - return nil -} - -func (p *TSInsertRecordReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) -} else { - p.IsWriteToTable = &v + p.Type = v } return nil } -func (p *TSInsertRecordReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int8, 0, size) - p.ColumnCategoryies = tSlice - for i := 0; i < size; i ++ { -var _elem40 int8 - if v, err := iprot.ReadByte(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFetchMetadataReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) } else { - temp := int8(v) - _elem40 = temp + p.ColumnPath = &v } - p.ColumnCategoryies = append(p.ColumnCategoryies, _elem40) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSInsertRecordReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertRecordReq"); err != nil { +func (p *TSFetchMetadataReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSFetchMetadataReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } - if err := p.writeField8(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -6014,7 +6164,7 @@ func (p *TSInsertRecordReq) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TSInsertRecordReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSFetchMetadataReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -6024,214 +6174,86 @@ func (p *TSInsertRecordReq) writeField1(ctx context.Context, oprot thrift.TProto return err } -func (p *TSInsertRecordReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } +func (p *TSFetchMetadataReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "type", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Type)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err) } return err } -func (p *TSInsertRecordReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Measurements { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSFetchMetadataReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetColumnPath() { + if err := oprot.WriteFieldBegin(ctx, "columnPath", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:columnPath: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.ColumnPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.columnPath (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:columnPath: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurements: ", p), err) } - return err -} - -func (p *TSInsertRecordReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "values", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:values: ", p), err) } - if err := oprot.WriteBinary(ctx, p.Values); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.values (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:values: ", p), err) } return err } -func (p *TSInsertRecordReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamp: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestamp (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamp: ", p), err) } - return err -} - -func (p *TSInsertRecordReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsAligned() { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } - } - return err -} - -func (p *TSInsertRecordReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsWriteToTable() { - if err := oprot.WriteFieldBegin(ctx, "isWriteToTable", thrift.BOOL, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:isWriteToTable: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsWriteToTable)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isWriteToTable (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:isWriteToTable: ", p), err) } - } - return err -} - -func (p *TSInsertRecordReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetColumnCategoryies() { - if err := oprot.WriteFieldBegin(ctx, "columnCategoryies", thrift.LIST, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:columnCategoryies: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.BYTE, len(p.ColumnCategoryies)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.ColumnCategoryies { - if err := oprot.WriteByte(ctx, int8(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:columnCategoryies: ", p), err) } - } - return err -} - -func (p *TSInsertRecordReq) Equals(other *TSInsertRecordReq) bool { +func (p *TSFetchMetadataReq) Equals(other *TSFetchMetadataReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.PrefixPath != other.PrefixPath { return false } - if len(p.Measurements) != len(other.Measurements) { return false } - for i, _tgt := range p.Measurements { - _src41 := other.Measurements[i] - if _tgt != _src41 { return false } - } - if bytes.Compare(p.Values, other.Values) != 0 { return false } - if p.Timestamp != other.Timestamp { return false } - if p.IsAligned != other.IsAligned { - if p.IsAligned == nil || other.IsAligned == nil { - return false - } - if (*p.IsAligned) != (*other.IsAligned) { return false } - } - if p.IsWriteToTable != other.IsWriteToTable { - if p.IsWriteToTable == nil || other.IsWriteToTable == nil { + if p.Type != other.Type { return false } + if p.ColumnPath != other.ColumnPath { + if p.ColumnPath == nil || other.ColumnPath == nil { return false } - if (*p.IsWriteToTable) != (*other.IsWriteToTable) { return false } - } - if len(p.ColumnCategoryies) != len(other.ColumnCategoryies) { return false } - for i, _tgt := range p.ColumnCategoryies { - _src42 := other.ColumnCategoryies[i] - if _tgt != _src42 { return false } + if (*p.ColumnPath) != (*other.ColumnPath) { return false } } return true } -func (p *TSInsertRecordReq) String() string { +func (p *TSFetchMetadataReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertRecordReq(%+v)", *p) + return fmt.Sprintf("TSFetchMetadataReq(%+v)", *p) } // Attributes: -// - SessionId -// - PrefixPath -// - Measurements -// - Values -// - Timestamp -// - IsAligned -// - Timeout -type TSInsertStringRecordReq struct { - SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` - Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` - Values []string `thrift:"values,4,required" db:"values" json:"values"` - Timestamp int64 `thrift:"timestamp,5,required" db:"timestamp" json:"timestamp"` - IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` - Timeout *int64 `thrift:"timeout,7" db:"timeout" json:"timeout,omitempty"` -} - -func NewTSInsertStringRecordReq() *TSInsertStringRecordReq { - return &TSInsertStringRecordReq{} -} - - -func (p *TSInsertStringRecordReq) GetSessionId() int64 { - return p.SessionId -} - -func (p *TSInsertStringRecordReq) GetPrefixPath() string { - return p.PrefixPath -} - -func (p *TSInsertStringRecordReq) GetMeasurements() []string { - return p.Measurements +// - Status +// - TimeZone +type TSGetTimeZoneResp struct { + Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` + TimeZone string `thrift:"timeZone,2,required" db:"timeZone" json:"timeZone"` } -func (p *TSInsertStringRecordReq) GetValues() []string { - return p.Values +func NewTSGetTimeZoneResp() *TSGetTimeZoneResp { + return &TSGetTimeZoneResp{} } -func (p *TSInsertStringRecordReq) GetTimestamp() int64 { - return p.Timestamp -} -var TSInsertStringRecordReq_IsAligned_DEFAULT bool -func (p *TSInsertStringRecordReq) GetIsAligned() bool { - if !p.IsSetIsAligned() { - return TSInsertStringRecordReq_IsAligned_DEFAULT - } -return *p.IsAligned -} -var TSInsertStringRecordReq_Timeout_DEFAULT int64 -func (p *TSInsertStringRecordReq) GetTimeout() int64 { - if !p.IsSetTimeout() { - return TSInsertStringRecordReq_Timeout_DEFAULT +var TSGetTimeZoneResp_Status_DEFAULT *common.TSStatus +func (p *TSGetTimeZoneResp) GetStatus() *common.TSStatus { + if !p.IsSetStatus() { + return TSGetTimeZoneResp_Status_DEFAULT } -return *p.Timeout -} -func (p *TSInsertStringRecordReq) IsSetIsAligned() bool { - return p.IsAligned != nil +return p.Status } -func (p *TSInsertStringRecordReq) IsSetTimeout() bool { - return p.Timeout != nil +func (p *TSGetTimeZoneResp) GetTimeZone() string { + return p.TimeZone +} +func (p *TSGetTimeZoneResp) IsSetStatus() bool { + return p.Status != nil } -func (p *TSInsertStringRecordReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSGetTimeZoneResp) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetSessionId bool = false; - var issetPrefixPath bool = false; - var issetMeasurements bool = false; - var issetValues bool = false; - var issetTimestamp bool = false; + var issetStatus bool = false; + var issetTimeZone bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -6241,11 +6263,11 @@ func (p *TSInsertStringRecordReq) Read(ctx context.Context, iprot thrift.TProtoc if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.STRUCT { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetSessionId = true + issetStatus = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -6256,60 +6278,7 @@ func (p *TSInsertStringRecordReq) Read(ctx context.Context, iprot thrift.TProtoc if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPath = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.LIST { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetMeasurements = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.LIST { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetValues = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.I64 { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - issetTimestamp = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.I64 { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } + issetTimeZone = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -6327,124 +6296,187 @@ func (p *TSInsertStringRecordReq) Read(ctx context.Context, iprot thrift.TProtoc if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetSessionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); - } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); - } - if !issetMeasurements{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); - } - if !issetValues{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Values is not set")); + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); } - if !issetTimestamp{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")); + if !issetTimeZone{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimeZone is not set")); } return nil } -func (p *TSInsertStringRecordReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.SessionId = v -} +func (p *TSGetTimeZoneResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + } return nil } -func (p *TSInsertStringRecordReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSGetTimeZoneResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.PrefixPath = v + p.TimeZone = v } return nil } -func (p *TSInsertStringRecordReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.Measurements = tSlice - for i := 0; i < size; i ++ { -var _elem43 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem43 = v -} - p.Measurements = append(p.Measurements, _elem43) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) +func (p *TSGetTimeZoneResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSGetTimeZoneResp"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TSInsertStringRecordReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) +func (p *TSGetTimeZoneResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) } - tSlice := make([]string, 0, size) - p.Values = tSlice - for i := 0; i < size; i ++ { -var _elem44 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem44 = v + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return err } - p.Values = append(p.Values, _elem44) + +func (p *TSGetTimeZoneResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timeZone", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timeZone: ", p), err) } + if err := oprot.WriteString(ctx, string(p.TimeZone)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeZone (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timeZone: ", p), err) } + return err +} + +func (p *TSGetTimeZoneResp) Equals(other *TSGetTimeZoneResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) + if !p.Status.Equals(other.Status) { return false } + if p.TimeZone != other.TimeZone { return false } + return true +} + +func (p *TSGetTimeZoneResp) String() string { + if p == nil { + return "" } - return nil + return fmt.Sprintf("TSGetTimeZoneResp(%+v)", *p) } -func (p *TSInsertStringRecordReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) -} else { - p.Timestamp = v +// Attributes: +// - SessionId +// - TimeZone +type TSSetTimeZoneReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + TimeZone string `thrift:"timeZone,2,required" db:"timeZone" json:"timeZone"` +} + +func NewTSSetTimeZoneReq() *TSSetTimeZoneReq { + return &TSSetTimeZoneReq{} +} + + +func (p *TSSetTimeZoneReq) GetSessionId() int64 { + return p.SessionId +} + +func (p *TSSetTimeZoneReq) GetTimeZone() string { + return p.TimeZone } +func (p *TSSetTimeZoneReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetSessionId bool = false; + var issetTimeZone bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.I64 { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetSessionId = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRING { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetTimeZone = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); + } + if !issetTimeZone{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimeZone is not set")); + } return nil } -func (p *TSInsertStringRecordReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) +func (p *TSSetTimeZoneReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) } else { - p.IsAligned = &v + p.SessionId = v } return nil } -func (p *TSInsertStringRecordReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) +func (p *TSSetTimeZoneReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - p.Timeout = &v + p.TimeZone = v } return nil } -func (p *TSInsertStringRecordReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertStringRecordReq"); err != nil { +func (p *TSSetTimeZoneReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSSetTimeZoneReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -6453,7 +6485,7 @@ func (p *TSInsertStringRecordReq) Write(ctx context.Context, oprot thrift.TProto return nil } -func (p *TSInsertStringRecordReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSSetTimeZoneReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -6463,125 +6495,32 @@ func (p *TSInsertStringRecordReq) writeField1(ctx context.Context, oprot thrift. return err } -func (p *TSInsertStringRecordReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } +func (p *TSSetTimeZoneReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timeZone", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timeZone: ", p), err) } + if err := oprot.WriteString(ctx, string(p.TimeZone)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeZone (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timeZone: ", p), err) } return err } -func (p *TSInsertStringRecordReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Measurements { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSSetTimeZoneReq) Equals(other *TSSetTimeZoneReq) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurements: ", p), err) } - return err + if p.SessionId != other.SessionId { return false } + if p.TimeZone != other.TimeZone { return false } + return true } -func (p *TSInsertStringRecordReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "values", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:values: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Values)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Values { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSSetTimeZoneReq) String() string { + if p == nil { + return "" } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:values: ", p), err) } - return err -} - -func (p *TSInsertStringRecordReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamp: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestamp (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamp: ", p), err) } - return err -} - -func (p *TSInsertStringRecordReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsAligned() { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } - } - return err -} - -func (p *TSInsertStringRecordReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:timeout: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:timeout: ", p), err) } - } - return err -} - -func (p *TSInsertStringRecordReq) Equals(other *TSInsertStringRecordReq) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.SessionId != other.SessionId { return false } - if p.PrefixPath != other.PrefixPath { return false } - if len(p.Measurements) != len(other.Measurements) { return false } - for i, _tgt := range p.Measurements { - _src45 := other.Measurements[i] - if _tgt != _src45 { return false } - } - if len(p.Values) != len(other.Values) { return false } - for i, _tgt := range p.Values { - _src46 := other.Values[i] - if _tgt != _src46 { return false } - } - if p.Timestamp != other.Timestamp { return false } - if p.IsAligned != other.IsAligned { - if p.IsAligned == nil || other.IsAligned == nil { - return false - } - if (*p.IsAligned) != (*other.IsAligned) { return false } - } - if p.Timeout != other.Timeout { - if p.Timeout == nil || other.Timeout == nil { - return false - } - if (*p.Timeout) != (*other.Timeout) { return false } - } - return true -} - -func (p *TSInsertStringRecordReq) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TSInsertStringRecordReq(%+v)", *p) + return fmt.Sprintf("TSSetTimeZoneReq(%+v)", *p) } // Attributes: @@ -6589,126 +6528,77 @@ func (p *TSInsertStringRecordReq) String() string { // - PrefixPath // - Measurements // - Values -// - Timestamps -// - Types -// - Size +// - Timestamp // - IsAligned -// - WriteToTable -// - ColumnCategories -// - IsCompressed -// - EncodingTypes -// - CompressType -type TSInsertTabletReq struct { +// - IsWriteToTable +// - ColumnCategoryies +type TSInsertRecordReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` Values []byte `thrift:"values,4,required" db:"values" json:"values"` - Timestamps []byte `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` - Types []int32 `thrift:"types,6,required" db:"types" json:"types"` - Size int32 `thrift:"size,7,required" db:"size" json:"size"` - IsAligned *bool `thrift:"isAligned,8" db:"isAligned" json:"isAligned,omitempty"` - WriteToTable *bool `thrift:"writeToTable,9" db:"writeToTable" json:"writeToTable,omitempty"` - ColumnCategories []int8 `thrift:"columnCategories,10" db:"columnCategories" json:"columnCategories,omitempty"` - IsCompressed *bool `thrift:"isCompressed,11" db:"isCompressed" json:"isCompressed,omitempty"` - EncodingTypes []int8 `thrift:"encodingTypes,12" db:"encodingTypes" json:"encodingTypes,omitempty"` - CompressType *int8 `thrift:"compressType,13" db:"compressType" json:"compressType,omitempty"` + Timestamp int64 `thrift:"timestamp,5,required" db:"timestamp" json:"timestamp"` + IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` + IsWriteToTable *bool `thrift:"isWriteToTable,7" db:"isWriteToTable" json:"isWriteToTable,omitempty"` + ColumnCategoryies []int8 `thrift:"columnCategoryies,8" db:"columnCategoryies" json:"columnCategoryies,omitempty"` } -func NewTSInsertTabletReq() *TSInsertTabletReq { - return &TSInsertTabletReq{} +func NewTSInsertRecordReq() *TSInsertRecordReq { + return &TSInsertRecordReq{} } -func (p *TSInsertTabletReq) GetSessionId() int64 { +func (p *TSInsertRecordReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertTabletReq) GetPrefixPath() string { +func (p *TSInsertRecordReq) GetPrefixPath() string { return p.PrefixPath } -func (p *TSInsertTabletReq) GetMeasurements() []string { +func (p *TSInsertRecordReq) GetMeasurements() []string { return p.Measurements } -func (p *TSInsertTabletReq) GetValues() []byte { +func (p *TSInsertRecordReq) GetValues() []byte { return p.Values } -func (p *TSInsertTabletReq) GetTimestamps() []byte { - return p.Timestamps -} - -func (p *TSInsertTabletReq) GetTypes() []int32 { - return p.Types -} - -func (p *TSInsertTabletReq) GetSize() int32 { - return p.Size +func (p *TSInsertRecordReq) GetTimestamp() int64 { + return p.Timestamp } -var TSInsertTabletReq_IsAligned_DEFAULT bool -func (p *TSInsertTabletReq) GetIsAligned() bool { +var TSInsertRecordReq_IsAligned_DEFAULT bool +func (p *TSInsertRecordReq) GetIsAligned() bool { if !p.IsSetIsAligned() { - return TSInsertTabletReq_IsAligned_DEFAULT + return TSInsertRecordReq_IsAligned_DEFAULT } return *p.IsAligned } -var TSInsertTabletReq_WriteToTable_DEFAULT bool -func (p *TSInsertTabletReq) GetWriteToTable() bool { - if !p.IsSetWriteToTable() { - return TSInsertTabletReq_WriteToTable_DEFAULT - } -return *p.WriteToTable -} -var TSInsertTabletReq_ColumnCategories_DEFAULT []int8 - -func (p *TSInsertTabletReq) GetColumnCategories() []int8 { - return p.ColumnCategories -} -var TSInsertTabletReq_IsCompressed_DEFAULT bool -func (p *TSInsertTabletReq) GetIsCompressed() bool { - if !p.IsSetIsCompressed() { - return TSInsertTabletReq_IsCompressed_DEFAULT +var TSInsertRecordReq_IsWriteToTable_DEFAULT bool +func (p *TSInsertRecordReq) GetIsWriteToTable() bool { + if !p.IsSetIsWriteToTable() { + return TSInsertRecordReq_IsWriteToTable_DEFAULT } -return *p.IsCompressed +return *p.IsWriteToTable } -var TSInsertTabletReq_EncodingTypes_DEFAULT []int8 +var TSInsertRecordReq_ColumnCategoryies_DEFAULT []int8 -func (p *TSInsertTabletReq) GetEncodingTypes() []int8 { - return p.EncodingTypes -} -var TSInsertTabletReq_CompressType_DEFAULT int8 -func (p *TSInsertTabletReq) GetCompressType() int8 { - if !p.IsSetCompressType() { - return TSInsertTabletReq_CompressType_DEFAULT - } -return *p.CompressType +func (p *TSInsertRecordReq) GetColumnCategoryies() []int8 { + return p.ColumnCategoryies } -func (p *TSInsertTabletReq) IsSetIsAligned() bool { +func (p *TSInsertRecordReq) IsSetIsAligned() bool { return p.IsAligned != nil } -func (p *TSInsertTabletReq) IsSetWriteToTable() bool { - return p.WriteToTable != nil -} - -func (p *TSInsertTabletReq) IsSetColumnCategories() bool { - return p.ColumnCategories != nil -} - -func (p *TSInsertTabletReq) IsSetIsCompressed() bool { - return p.IsCompressed != nil -} - -func (p *TSInsertTabletReq) IsSetEncodingTypes() bool { - return p.EncodingTypes != nil +func (p *TSInsertRecordReq) IsSetIsWriteToTable() bool { + return p.IsWriteToTable != nil } -func (p *TSInsertTabletReq) IsSetCompressType() bool { - return p.CompressType != nil +func (p *TSInsertRecordReq) IsSetColumnCategoryies() bool { + return p.ColumnCategoryies != nil } -func (p *TSInsertTabletReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -6717,9 +6607,7 @@ func (p *TSInsertTabletReq) Read(ctx context.Context, iprot thrift.TProtocol) er var issetPrefixPath bool = false; var issetMeasurements bool = false; var issetValues bool = false; - var issetTimestamps bool = false; - var issetTypes bool = false; - var issetSize bool = false; + var issetTimestamp bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -6773,91 +6661,39 @@ func (p *TSInsertTabletReq) Read(ctx context.Context, iprot thrift.TProtocol) er } } case 5: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I64 { if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetTimestamps = true + issetTimestamp = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.BOOL { if err := p.ReadField6(ctx, iprot); err != nil { return err } - issetTypes = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.BOOL { if err := p.ReadField7(ctx, iprot); err != nil { return err } - issetSize = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 10: - if fieldTypeId == thrift.LIST { - if err := p.ReadField10(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 11: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField11(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 12: if fieldTypeId == thrift.LIST { - if err := p.ReadField12(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 13: - if fieldTypeId == thrift.BYTE { - if err := p.ReadField13(ctx, iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { @@ -6889,19 +6725,13 @@ func (p *TSInsertTabletReq) Read(ctx context.Context, iprot thrift.TProtocol) er if !issetValues{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Values is not set")); } - if !issetTimestamps{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamps is not set")); - } - if !issetTypes{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Types is not set")); - } - if !issetSize{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Size is not set")); + if !issetTimestamp{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")); } return nil } -func (p *TSInsertTabletReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -6910,7 +6740,7 @@ func (p *TSInsertTabletReq) ReadField1(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSInsertTabletReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { @@ -6919,7 +6749,7 @@ func (p *TSInsertTabletReq) ReadField2(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSInsertTabletReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -6927,13 +6757,13 @@ func (p *TSInsertTabletReq) ReadField3(ctx context.Context, iprot thrift.TProto tSlice := make([]string, 0, size) p.Measurements = tSlice for i := 0; i < size; i ++ { -var _elem47 string +var _elem39 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem47 = v + _elem39 = v } - p.Measurements = append(p.Measurements, _elem47) + p.Measurements = append(p.Measurements, _elem39) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -6941,7 +6771,7 @@ var _elem47 string return nil } -func (p *TSInsertTabletReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { @@ -6950,112 +6780,49 @@ func (p *TSInsertTabletReq) ReadField4(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSInsertTabletReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { +func (p *TSInsertRecordReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { - p.Timestamps = v -} - return nil -} - -func (p *TSInsertTabletReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.Types = tSlice - for i := 0; i < size; i ++ { -var _elem48 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem48 = v -} - p.Types = append(p.Types, _elem48) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSInsertTabletReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) -} else { - p.Size = v + p.Timestamp = v } return nil } -func (p *TSInsertTabletReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) + return thrift.PrependError("error reading field 6: ", err) } else { p.IsAligned = &v } return nil } -func (p *TSInsertTabletReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) -} else { - p.WriteToTable = &v -} - return nil -} - -func (p *TSInsertTabletReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int8, 0, size) - p.ColumnCategories = tSlice - for i := 0; i < size; i ++ { -var _elem49 int8 - if v, err := iprot.ReadByte(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - temp := int8(v) - _elem49 = temp -} - p.ColumnCategories = append(p.ColumnCategories, _elem49) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSInsertTabletReq) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 11: ", err) + return thrift.PrependError("error reading field 7: ", err) } else { - p.IsCompressed = &v + p.IsWriteToTable = &v } return nil } -func (p *TSInsertTabletReq) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]int8, 0, size) - p.EncodingTypes = tSlice + p.ColumnCategoryies = tSlice for i := 0; i < size; i ++ { -var _elem50 int8 +var _elem40 int8 if v, err := iprot.ReadByte(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := int8(v) - _elem50 = temp + _elem40 = temp } - p.EncodingTypes = append(p.EncodingTypes, _elem50) + p.ColumnCategoryies = append(p.ColumnCategoryies, _elem40) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -7063,18 +6830,8 @@ var _elem50 int8 return nil } -func (p *TSInsertTabletReq) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { - return thrift.PrependError("error reading field 13: ", err) -} else { - temp := int8(v) - p.CompressType = &temp -} - return nil -} - -func (p *TSInsertTabletReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertTabletReq"); err != nil { +func (p *TSInsertRecordReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertRecordReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -7085,11 +6842,6 @@ func (p *TSInsertTabletReq) Write(ctx context.Context, oprot thrift.TProtocol) e if err := p.writeField6(ctx, oprot); err != nil { return err } if err := p.writeField7(ctx, oprot); err != nil { return err } if err := p.writeField8(ctx, oprot); err != nil { return err } - if err := p.writeField9(ctx, oprot); err != nil { return err } - if err := p.writeField10(ctx, oprot); err != nil { return err } - if err := p.writeField11(ctx, oprot); err != nil { return err } - if err := p.writeField12(ctx, oprot); err != nil { return err } - if err := p.writeField13(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -7098,7 +6850,7 @@ func (p *TSInsertTabletReq) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TSInsertTabletReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -7108,7 +6860,7 @@ func (p *TSInsertTabletReq) writeField1(ctx context.Context, oprot thrift.TProto return err } -func (p *TSInsertTabletReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { @@ -7118,7 +6870,7 @@ func (p *TSInsertTabletReq) writeField2(ctx context.Context, oprot thrift.TProto return err } -func (p *TSInsertTabletReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { @@ -7136,7 +6888,7 @@ func (p *TSInsertTabletReq) writeField3(ctx context.Context, oprot thrift.TProto return err } -func (p *TSInsertTabletReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "values", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:values: ", p), err) } if err := oprot.WriteBinary(ctx, p.Values); err != nil { @@ -7146,108 +6898,48 @@ func (p *TSInsertTabletReq) writeField4(ctx context.Context, oprot thrift.TProto return err } -func (p *TSInsertTabletReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.STRING, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } - if err := oprot.WriteBinary(ctx, p.Timestamps); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestamps (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamps: ", p), err) } - return err -} - -func (p *TSInsertTabletReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "types", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:types: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Types)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Types { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:types: ", p), err) } - return err -} - -func (p *TSInsertTabletReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "size", thrift.I32, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:size: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.Size)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.size (7) field write error: ", p), err) } +func (p *TSInsertRecordReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamp: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestamp (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:size: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamp: ", p), err) } return err } -func (p *TSInsertTabletReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetIsAligned() { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:isAligned: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (8) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:isAligned: ", p), err) } - } - return err -} - -func (p *TSInsertTabletReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetWriteToTable() { - if err := oprot.WriteFieldBegin(ctx, "writeToTable", thrift.BOOL, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:writeToTable: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.WriteToTable)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.writeToTable (9) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:writeToTable: ", p), err) } - } - return err -} - -func (p *TSInsertTabletReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetColumnCategories() { - if err := oprot.WriteFieldBegin(ctx, "columnCategories", thrift.LIST, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:columnCategories: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.BYTE, len(p.ColumnCategories)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.ColumnCategories { - if err := oprot.WriteByte(ctx, int8(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } + return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:columnCategories: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } } return err } -func (p *TSInsertTabletReq) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsCompressed() { - if err := oprot.WriteFieldBegin(ctx, "isCompressed", thrift.BOOL, 11); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:isCompressed: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsCompressed)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isCompressed (11) field write error: ", p), err) } +func (p *TSInsertRecordReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsWriteToTable() { + if err := oprot.WriteFieldBegin(ctx, "isWriteToTable", thrift.BOOL, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:isWriteToTable: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsWriteToTable)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isWriteToTable (7) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 11:isCompressed: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:isWriteToTable: ", p), err) } } return err } -func (p *TSInsertTabletReq) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetEncodingTypes() { - if err := oprot.WriteFieldBegin(ctx, "encodingTypes", thrift.LIST, 12); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:encodingTypes: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.BYTE, len(p.EncodingTypes)); err != nil { +func (p *TSInsertRecordReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetColumnCategoryies() { + if err := oprot.WriteFieldBegin(ctx, "columnCategoryies", thrift.LIST, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:columnCategoryies: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.BYTE, len(p.ColumnCategoryies)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.EncodingTypes { + for _, v := range p.ColumnCategoryies { if err := oprot.WriteByte(ctx, int8(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -7255,24 +6947,12 @@ func (p *TSInsertTabletReq) writeField12(ctx context.Context, oprot thrift.TProt return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 12:encodingTypes: ", p), err) } - } - return err -} - -func (p *TSInsertTabletReq) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetCompressType() { - if err := oprot.WriteFieldBegin(ctx, "compressType", thrift.BYTE, 13); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:compressType: ", p), err) } - if err := oprot.WriteByte(ctx, int8(*p.CompressType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.compressType (13) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 13:compressType: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:columnCategoryies: ", p), err) } } return err } -func (p *TSInsertTabletReq) Equals(other *TSInsertTabletReq) bool { +func (p *TSInsertRecordReq) Equals(other *TSInsertRecordReq) bool { if p == other { return true } else if p == nil || other == nil { @@ -7282,136 +6962,112 @@ func (p *TSInsertTabletReq) Equals(other *TSInsertTabletReq) bool { if p.PrefixPath != other.PrefixPath { return false } if len(p.Measurements) != len(other.Measurements) { return false } for i, _tgt := range p.Measurements { - _src51 := other.Measurements[i] - if _tgt != _src51 { return false } + _src41 := other.Measurements[i] + if _tgt != _src41 { return false } } if bytes.Compare(p.Values, other.Values) != 0 { return false } - if bytes.Compare(p.Timestamps, other.Timestamps) != 0 { return false } - if len(p.Types) != len(other.Types) { return false } - for i, _tgt := range p.Types { - _src52 := other.Types[i] - if _tgt != _src52 { return false } - } - if p.Size != other.Size { return false } + if p.Timestamp != other.Timestamp { return false } if p.IsAligned != other.IsAligned { if p.IsAligned == nil || other.IsAligned == nil { return false } if (*p.IsAligned) != (*other.IsAligned) { return false } } - if p.WriteToTable != other.WriteToTable { - if p.WriteToTable == nil || other.WriteToTable == nil { - return false - } - if (*p.WriteToTable) != (*other.WriteToTable) { return false } - } - if len(p.ColumnCategories) != len(other.ColumnCategories) { return false } - for i, _tgt := range p.ColumnCategories { - _src53 := other.ColumnCategories[i] - if _tgt != _src53 { return false } - } - if p.IsCompressed != other.IsCompressed { - if p.IsCompressed == nil || other.IsCompressed == nil { + if p.IsWriteToTable != other.IsWriteToTable { + if p.IsWriteToTable == nil || other.IsWriteToTable == nil { return false } - if (*p.IsCompressed) != (*other.IsCompressed) { return false } - } - if len(p.EncodingTypes) != len(other.EncodingTypes) { return false } - for i, _tgt := range p.EncodingTypes { - _src54 := other.EncodingTypes[i] - if _tgt != _src54 { return false } + if (*p.IsWriteToTable) != (*other.IsWriteToTable) { return false } } - if p.CompressType != other.CompressType { - if p.CompressType == nil || other.CompressType == nil { - return false - } - if (*p.CompressType) != (*other.CompressType) { return false } + if len(p.ColumnCategoryies) != len(other.ColumnCategoryies) { return false } + for i, _tgt := range p.ColumnCategoryies { + _src42 := other.ColumnCategoryies[i] + if _tgt != _src42 { return false } } return true } -func (p *TSInsertTabletReq) String() string { +func (p *TSInsertRecordReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertTabletReq(%+v)", *p) + return fmt.Sprintf("TSInsertRecordReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPaths -// - MeasurementsList -// - ValuesList -// - TimestampsList -// - TypesList -// - SizeList +// - PrefixPath +// - Measurements +// - Values +// - Timestamp // - IsAligned -type TSInsertTabletsReq struct { +// - Timeout +type TSInsertStringRecordReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPaths []string `thrift:"prefixPaths,2,required" db:"prefixPaths" json:"prefixPaths"` - MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` - ValuesList [][]byte `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` - TimestampsList [][]byte `thrift:"timestampsList,5,required" db:"timestampsList" json:"timestampsList"` - TypesList [][]int32 `thrift:"typesList,6,required" db:"typesList" json:"typesList"` - SizeList []int32 `thrift:"sizeList,7,required" db:"sizeList" json:"sizeList"` - IsAligned *bool `thrift:"isAligned,8" db:"isAligned" json:"isAligned,omitempty"` + PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` + Values []string `thrift:"values,4,required" db:"values" json:"values"` + Timestamp int64 `thrift:"timestamp,5,required" db:"timestamp" json:"timestamp"` + IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` + Timeout *int64 `thrift:"timeout,7" db:"timeout" json:"timeout,omitempty"` } -func NewTSInsertTabletsReq() *TSInsertTabletsReq { - return &TSInsertTabletsReq{} +func NewTSInsertStringRecordReq() *TSInsertStringRecordReq { + return &TSInsertStringRecordReq{} } -func (p *TSInsertTabletsReq) GetSessionId() int64 { +func (p *TSInsertStringRecordReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertTabletsReq) GetPrefixPaths() []string { - return p.PrefixPaths -} - -func (p *TSInsertTabletsReq) GetMeasurementsList() [][]string { - return p.MeasurementsList -} - -func (p *TSInsertTabletsReq) GetValuesList() [][]byte { - return p.ValuesList +func (p *TSInsertStringRecordReq) GetPrefixPath() string { + return p.PrefixPath } -func (p *TSInsertTabletsReq) GetTimestampsList() [][]byte { - return p.TimestampsList +func (p *TSInsertStringRecordReq) GetMeasurements() []string { + return p.Measurements } -func (p *TSInsertTabletsReq) GetTypesList() [][]int32 { - return p.TypesList +func (p *TSInsertStringRecordReq) GetValues() []string { + return p.Values } -func (p *TSInsertTabletsReq) GetSizeList() []int32 { - return p.SizeList +func (p *TSInsertStringRecordReq) GetTimestamp() int64 { + return p.Timestamp } -var TSInsertTabletsReq_IsAligned_DEFAULT bool -func (p *TSInsertTabletsReq) GetIsAligned() bool { +var TSInsertStringRecordReq_IsAligned_DEFAULT bool +func (p *TSInsertStringRecordReq) GetIsAligned() bool { if !p.IsSetIsAligned() { - return TSInsertTabletsReq_IsAligned_DEFAULT + return TSInsertStringRecordReq_IsAligned_DEFAULT } return *p.IsAligned } -func (p *TSInsertTabletsReq) IsSetIsAligned() bool { +var TSInsertStringRecordReq_Timeout_DEFAULT int64 +func (p *TSInsertStringRecordReq) GetTimeout() int64 { + if !p.IsSetTimeout() { + return TSInsertStringRecordReq_Timeout_DEFAULT + } +return *p.Timeout +} +func (p *TSInsertStringRecordReq) IsSetIsAligned() bool { return p.IsAligned != nil } -func (p *TSInsertTabletsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordReq) IsSetTimeout() bool { + return p.Timeout != nil +} + +func (p *TSInsertStringRecordReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPaths bool = false; - var issetMeasurementsList bool = false; - var issetValuesList bool = false; - var issetTimestampsList bool = false; - var issetTypesList bool = false; - var issetSizeList bool = false; + var issetPrefixPath bool = false; + var issetMeasurements bool = false; + var issetValues bool = false; + var issetTimestamp bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -7432,11 +7088,11 @@ func (p *TSInsertTabletsReq) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPaths = true + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -7447,7 +7103,7 @@ func (p *TSInsertTabletsReq) Read(ctx context.Context, iprot thrift.TProtocol) e if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetMeasurementsList = true + issetMeasurements = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -7458,50 +7114,38 @@ func (p *TSInsertTabletsReq) Read(ctx context.Context, iprot thrift.TProtocol) e if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetValuesList = true + issetValues = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetTimestampsList = true + issetTimestamp = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.BOOL { if err := p.ReadField6(ctx, iprot); err != nil { return err } - issetTypesList = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField7(ctx, iprot); err != nil { return err } - issetSizeList = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -7522,28 +7166,22 @@ func (p *TSInsertTabletsReq) Read(ctx context.Context, iprot thrift.TProtocol) e if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPaths is not set")); - } - if !issetMeasurementsList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); - } - if !issetValuesList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ValuesList is not set")); + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); } - if !issetTimestampsList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimestampsList is not set")); + if !issetMeasurements{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); } - if !issetTypesList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TypesList is not set")); + if !issetValues{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Values is not set")); } - if !issetSizeList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SizeList is not set")); + if !issetTimestamp{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")); } return nil } -func (p *TSInsertTabletsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -7552,55 +7190,30 @@ func (p *TSInsertTabletsReq) ReadField1(ctx context.Context, iprot thrift.TProt return nil } -func (p *TSInsertTabletsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.PrefixPaths = tSlice - for i := 0; i < size; i ++ { -var _elem55 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSInsertStringRecordReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - _elem55 = v + p.PrefixPath = v } - p.PrefixPaths = append(p.PrefixPaths, _elem55) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSInsertTabletsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([][]string, 0, size) - p.MeasurementsList = tSlice + tSlice := make([]string, 0, size) + p.Measurements = tSlice for i := 0; i < size; i ++ { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - _elem56 := tSlice - for i := 0; i < size; i ++ { -var _elem57 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +var _elem43 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _elem57 = v + _elem43 = v } - _elem56 = append(_elem56, _elem57) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - p.MeasurementsList = append(p.MeasurementsList, _elem56) + p.Measurements = append(p.Measurements, _elem43) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -7608,21 +7221,21 @@ var _elem57 string return nil } -func (p *TSInsertTabletsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([][]byte, 0, size) - p.ValuesList = tSlice + tSlice := make([]string, 0, size) + p.Values = tSlice for i := 0; i < size; i ++ { -var _elem58 []byte - if v, err := iprot.ReadBinary(ctx); err != nil { +var _elem44 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem58 = v + _elem44 = v } - p.ValuesList = append(p.ValuesList, _elem58) + p.Values = append(p.Values, _elem44) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -7630,95 +7243,35 @@ var _elem58 []byte return nil } -func (p *TSInsertTabletsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([][]byte, 0, size) - p.TimestampsList = tSlice - for i := 0; i < size; i ++ { -var _elem59 []byte - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSInsertStringRecordReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) } else { - _elem59 = v + p.Timestamp = v } - p.TimestampsList = append(p.TimestampsList, _elem59) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSInsertTabletsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([][]int32, 0, size) - p.TypesList = tSlice - for i := 0; i < size; i ++ { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - _elem60 := tSlice - for i := 0; i < size; i ++ { -var _elem61 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem61 = v -} - _elem60 = append(_elem60, _elem61) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - p.TypesList = append(p.TypesList, _elem60) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSInsertTabletsReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.SizeList = tSlice - for i := 0; i < size; i ++ { -var _elem62 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSInsertStringRecordReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { - _elem62 = v + p.IsAligned = &v } - p.SizeList = append(p.SizeList, _elem62) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSInsertTabletsReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) +func (p *TSInsertStringRecordReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) } else { - p.IsAligned = &v + p.Timeout = &v } return nil } -func (p *TSInsertTabletsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertTabletsReq"); err != nil { +func (p *TSInsertStringRecordReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertStringRecordReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -7728,7 +7281,6 @@ func (p *TSInsertTabletsReq) Write(ctx context.Context, oprot thrift.TProtocol) if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } if err := p.writeField7(ctx, oprot); err != nil { return err } - if err := p.writeField8(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -7737,7 +7289,7 @@ func (p *TSInsertTabletsReq) Write(ctx context.Context, oprot thrift.TProtocol) return nil } -func (p *TSInsertTabletsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertStringRecordReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -7747,264 +7299,263 @@ func (p *TSInsertTabletsReq) writeField1(ctx context.Context, oprot thrift.TProt return err } -func (p *TSInsertTabletsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPaths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPaths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PrefixPaths)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.PrefixPaths { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPaths: ", p), err) } - return err -} - -func (p *TSInsertTabletsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.MeasurementsList { - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range v { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSInsertStringRecordReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurementsList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } return err } -func (p *TSInsertTabletsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ValuesList)); err != nil { +func (p *TSInsertStringRecordReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.ValuesList { - if err := oprot.WriteBinary(ctx, v); err != nil { + for _, v := range p.Measurements { + if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:valuesList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurements: ", p), err) } return err } -func (p *TSInsertTabletsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestampsList", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestampsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.TimestampsList)); err != nil { +func (p *TSInsertStringRecordReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "values", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:values: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Values)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.TimestampsList { - if err := oprot.WriteBinary(ctx, v); err != nil { + for _, v := range p.Values { + if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestampsList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:values: ", p), err) } return err } -func (p *TSInsertTabletsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "typesList", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:typesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.TypesList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.TypesList { - if err := oprot.WriteListBegin(ctx, thrift.I32, len(v)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range v { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSInsertStringRecordReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamp: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestamp (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:typesList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamp: ", p), err) } return err } -func (p *TSInsertTabletsReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sizeList", thrift.LIST, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:sizeList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.SizeList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.SizeList { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSInsertStringRecordReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsAligned() { + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:sizeList: ", p), err) } return err } -func (p *TSInsertTabletsReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsAligned() { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:isAligned: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (8) field write error: ", p), err) } +func (p *TSInsertStringRecordReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTimeout() { + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:timeout: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeout (7) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:isAligned: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:timeout: ", p), err) } } return err } -func (p *TSInsertTabletsReq) Equals(other *TSInsertTabletsReq) bool { +func (p *TSInsertStringRecordReq) Equals(other *TSInsertStringRecordReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.PrefixPaths) != len(other.PrefixPaths) { return false } - for i, _tgt := range p.PrefixPaths { - _src63 := other.PrefixPaths[i] - if _tgt != _src63 { return false } + if p.PrefixPath != other.PrefixPath { return false } + if len(p.Measurements) != len(other.Measurements) { return false } + for i, _tgt := range p.Measurements { + _src45 := other.Measurements[i] + if _tgt != _src45 { return false } } - if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } - for i, _tgt := range p.MeasurementsList { - _src64 := other.MeasurementsList[i] - if len(_tgt) != len(_src64) { return false } - for i, _tgt := range _tgt { - _src65 := _src64[i] - if _tgt != _src65 { return false } - } + if len(p.Values) != len(other.Values) { return false } + for i, _tgt := range p.Values { + _src46 := other.Values[i] + if _tgt != _src46 { return false } } - if len(p.ValuesList) != len(other.ValuesList) { return false } - for i, _tgt := range p.ValuesList { - _src66 := other.ValuesList[i] - if bytes.Compare(_tgt, _src66) != 0 { return false } + if p.Timestamp != other.Timestamp { return false } + if p.IsAligned != other.IsAligned { + if p.IsAligned == nil || other.IsAligned == nil { + return false + } + if (*p.IsAligned) != (*other.IsAligned) { return false } } - if len(p.TimestampsList) != len(other.TimestampsList) { return false } - for i, _tgt := range p.TimestampsList { - _src67 := other.TimestampsList[i] - if bytes.Compare(_tgt, _src67) != 0 { return false } - } - if len(p.TypesList) != len(other.TypesList) { return false } - for i, _tgt := range p.TypesList { - _src68 := other.TypesList[i] - if len(_tgt) != len(_src68) { return false } - for i, _tgt := range _tgt { - _src69 := _src68[i] - if _tgt != _src69 { return false } - } - } - if len(p.SizeList) != len(other.SizeList) { return false } - for i, _tgt := range p.SizeList { - _src70 := other.SizeList[i] - if _tgt != _src70 { return false } - } - if p.IsAligned != other.IsAligned { - if p.IsAligned == nil || other.IsAligned == nil { - return false - } - if (*p.IsAligned) != (*other.IsAligned) { return false } + if p.Timeout != other.Timeout { + if p.Timeout == nil || other.Timeout == nil { + return false + } + if (*p.Timeout) != (*other.Timeout) { return false } } return true } -func (p *TSInsertTabletsReq) String() string { +func (p *TSInsertStringRecordReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertTabletsReq(%+v)", *p) + return fmt.Sprintf("TSInsertStringRecordReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPaths -// - MeasurementsList -// - ValuesList +// - PrefixPath +// - Measurements +// - Values // - Timestamps +// - Types +// - Size // - IsAligned -type TSInsertRecordsReq struct { +// - WriteToTable +// - ColumnCategories +// - IsCompressed +// - EncodingTypes +// - CompressType +type TSInsertTabletReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPaths []string `thrift:"prefixPaths,2,required" db:"prefixPaths" json:"prefixPaths"` - MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` - ValuesList [][]byte `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` - Timestamps []int64 `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` - IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` + PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` + Values []byte `thrift:"values,4,required" db:"values" json:"values"` + Timestamps []byte `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` + Types []int32 `thrift:"types,6,required" db:"types" json:"types"` + Size int32 `thrift:"size,7,required" db:"size" json:"size"` + IsAligned *bool `thrift:"isAligned,8" db:"isAligned" json:"isAligned,omitempty"` + WriteToTable *bool `thrift:"writeToTable,9" db:"writeToTable" json:"writeToTable,omitempty"` + ColumnCategories []int8 `thrift:"columnCategories,10" db:"columnCategories" json:"columnCategories,omitempty"` + IsCompressed *bool `thrift:"isCompressed,11" db:"isCompressed" json:"isCompressed,omitempty"` + EncodingTypes []int8 `thrift:"encodingTypes,12" db:"encodingTypes" json:"encodingTypes,omitempty"` + CompressType *int8 `thrift:"compressType,13" db:"compressType" json:"compressType,omitempty"` } -func NewTSInsertRecordsReq() *TSInsertRecordsReq { - return &TSInsertRecordsReq{} +func NewTSInsertTabletReq() *TSInsertTabletReq { + return &TSInsertTabletReq{} } -func (p *TSInsertRecordsReq) GetSessionId() int64 { +func (p *TSInsertTabletReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertRecordsReq) GetPrefixPaths() []string { - return p.PrefixPaths +func (p *TSInsertTabletReq) GetPrefixPath() string { + return p.PrefixPath } -func (p *TSInsertRecordsReq) GetMeasurementsList() [][]string { - return p.MeasurementsList +func (p *TSInsertTabletReq) GetMeasurements() []string { + return p.Measurements } -func (p *TSInsertRecordsReq) GetValuesList() [][]byte { - return p.ValuesList +func (p *TSInsertTabletReq) GetValues() []byte { + return p.Values } -func (p *TSInsertRecordsReq) GetTimestamps() []int64 { +func (p *TSInsertTabletReq) GetTimestamps() []byte { return p.Timestamps } -var TSInsertRecordsReq_IsAligned_DEFAULT bool -func (p *TSInsertRecordsReq) GetIsAligned() bool { + +func (p *TSInsertTabletReq) GetTypes() []int32 { + return p.Types +} + +func (p *TSInsertTabletReq) GetSize() int32 { + return p.Size +} +var TSInsertTabletReq_IsAligned_DEFAULT bool +func (p *TSInsertTabletReq) GetIsAligned() bool { if !p.IsSetIsAligned() { - return TSInsertRecordsReq_IsAligned_DEFAULT + return TSInsertTabletReq_IsAligned_DEFAULT } return *p.IsAligned } -func (p *TSInsertRecordsReq) IsSetIsAligned() bool { +var TSInsertTabletReq_WriteToTable_DEFAULT bool +func (p *TSInsertTabletReq) GetWriteToTable() bool { + if !p.IsSetWriteToTable() { + return TSInsertTabletReq_WriteToTable_DEFAULT + } +return *p.WriteToTable +} +var TSInsertTabletReq_ColumnCategories_DEFAULT []int8 + +func (p *TSInsertTabletReq) GetColumnCategories() []int8 { + return p.ColumnCategories +} +var TSInsertTabletReq_IsCompressed_DEFAULT bool +func (p *TSInsertTabletReq) GetIsCompressed() bool { + if !p.IsSetIsCompressed() { + return TSInsertTabletReq_IsCompressed_DEFAULT + } +return *p.IsCompressed +} +var TSInsertTabletReq_EncodingTypes_DEFAULT []int8 + +func (p *TSInsertTabletReq) GetEncodingTypes() []int8 { + return p.EncodingTypes +} +var TSInsertTabletReq_CompressType_DEFAULT int8 +func (p *TSInsertTabletReq) GetCompressType() int8 { + if !p.IsSetCompressType() { + return TSInsertTabletReq_CompressType_DEFAULT + } +return *p.CompressType +} +func (p *TSInsertTabletReq) IsSetIsAligned() bool { return p.IsAligned != nil } -func (p *TSInsertRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletReq) IsSetWriteToTable() bool { + return p.WriteToTable != nil +} + +func (p *TSInsertTabletReq) IsSetColumnCategories() bool { + return p.ColumnCategories != nil +} + +func (p *TSInsertTabletReq) IsSetIsCompressed() bool { + return p.IsCompressed != nil +} + +func (p *TSInsertTabletReq) IsSetEncodingTypes() bool { + return p.EncodingTypes != nil +} + +func (p *TSInsertTabletReq) IsSetCompressType() bool { + return p.CompressType != nil +} + +func (p *TSInsertTabletReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPaths bool = false; - var issetMeasurementsList bool = false; - var issetValuesList bool = false; + var issetPrefixPath bool = false; + var issetMeasurements bool = false; + var issetValues bool = false; var issetTimestamps bool = false; + var issetTypes bool = false; + var issetSize bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -8025,11 +7576,11 @@ func (p *TSInsertRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPaths = true + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -8040,25 +7591,25 @@ func (p *TSInsertRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) e if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetMeasurementsList = true + issetMeasurements = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetValuesList = true + issetValues = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField5(ctx, iprot); err != nil { return err } @@ -8069,10 +7620,82 @@ func (p *TSInsertRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 6: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.LIST { if err := p.ReadField6(ctx, iprot); err != nil { return err } + issetTypes = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 7: + if fieldTypeId == thrift.I32 { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } + issetSize = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 8: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField8(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 9: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField9(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 10: + if fieldTypeId == thrift.LIST { + if err := p.ReadField10(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 11: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField11(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 12: + if fieldTypeId == thrift.LIST { + if err := p.ReadField12(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 13: + if fieldTypeId == thrift.BYTE { + if err := p.ReadField13(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -8093,22 +7716,28 @@ func (p *TSInsertRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) e if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPaths is not set")); + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); } - if !issetMeasurementsList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); + if !issetMeasurements{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); } - if !issetValuesList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ValuesList is not set")); + if !issetValues{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Values is not set")); } if !issetTimestamps{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamps is not set")); } + if !issetTypes{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Types is not set")); + } + if !issetSize{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Size is not set")); + } return nil } -func (p *TSInsertRecordsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -8117,21 +7746,30 @@ func (p *TSInsertRecordsReq) ReadField1(ctx context.Context, iprot thrift.TProt return nil } -func (p *TSInsertRecordsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.PrefixPath = v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.PrefixPaths = tSlice + p.Measurements = tSlice for i := 0; i < size; i ++ { -var _elem71 string +var _elem47 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem71 = v + _elem47 = v } - p.PrefixPaths = append(p.PrefixPaths, _elem71) + p.Measurements = append(p.Measurements, _elem47) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8139,33 +7777,39 @@ var _elem71 string return nil } -func (p *TSInsertRecordsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.Values = v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) +} else { + p.Timestamps = v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([][]string, 0, size) - p.MeasurementsList = tSlice + tSlice := make([]int32, 0, size) + p.Types = tSlice for i := 0; i < size; i ++ { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - _elem72 := tSlice - for i := 0; i < size; i ++ { -var _elem73 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +var _elem48 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _elem73 = v + _elem48 = v } - _elem72 = append(_elem72, _elem73) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - p.MeasurementsList = append(p.MeasurementsList, _elem72) + p.Types = append(p.Types, _elem48) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8173,21 +7817,49 @@ var _elem73 string return nil } -func (p *TSInsertRecordsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) +} else { + p.Size = v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 8: ", err) +} else { + p.IsAligned = &v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 9: ", err) +} else { + p.WriteToTable = &v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([][]byte, 0, size) - p.ValuesList = tSlice + tSlice := make([]int8, 0, size) + p.ColumnCategories = tSlice for i := 0; i < size; i ++ { -var _elem74 []byte - if v, err := iprot.ReadBinary(ctx); err != nil { +var _elem49 int8 + if v, err := iprot.ReadByte(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem74 = v + temp := int8(v) + _elem49 = temp } - p.ValuesList = append(p.ValuesList, _elem74) + p.ColumnCategories = append(p.ColumnCategories, _elem49) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8195,21 +7867,31 @@ var _elem74 []byte return nil } -func (p *TSInsertRecordsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletReq) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 11: ", err) +} else { + p.IsCompressed = &v +} + return nil +} + +func (p *TSInsertTabletReq) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]int64, 0, size) - p.Timestamps = tSlice + tSlice := make([]int8, 0, size) + p.EncodingTypes = tSlice for i := 0; i < size; i ++ { -var _elem75 int64 - if v, err := iprot.ReadI64(ctx); err != nil { +var _elem50 int8 + if v, err := iprot.ReadByte(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem75 = v + temp := int8(v) + _elem50 = temp } - p.Timestamps = append(p.Timestamps, _elem75) + p.EncodingTypes = append(p.EncodingTypes, _elem50) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8217,17 +7899,18 @@ var _elem75 int64 return nil } -func (p *TSInsertRecordsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) +func (p *TSInsertTabletReq) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadByte(ctx); err != nil { + return thrift.PrependError("error reading field 13: ", err) } else { - p.IsAligned = &v + temp := int8(v) + p.CompressType = &temp } return nil } -func (p *TSInsertRecordsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertRecordsReq"); err != nil { +func (p *TSInsertTabletReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertTabletReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -8236,6 +7919,13 @@ func (p *TSInsertRecordsReq) Write(ctx context.Context, oprot thrift.TProtocol) if err := p.writeField4(ctx, oprot); err != nil { return err } if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField12(ctx, oprot); err != nil { return err } + if err := p.writeField13(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -8244,7 +7934,7 @@ func (p *TSInsertRecordsReq) Write(ctx context.Context, oprot thrift.TProtocol) return nil } -func (p *TSInsertRecordsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertTabletReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -8254,13 +7944,23 @@ func (p *TSInsertRecordsReq) writeField1(ctx context.Context, oprot thrift.TProt return err } -func (p *TSInsertRecordsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPaths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPaths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PrefixPaths)); err != nil { +func (p *TSInsertTabletReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return err +} + +func (p *TSInsertTabletReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.PrefixPaths { + for _, v := range p.Measurements { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -8268,192 +7968,286 @@ func (p *TSInsertRecordsReq) writeField2(ctx context.Context, oprot thrift.TProt return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPaths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurements: ", p), err) } return err } -func (p *TSInsertRecordsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.MeasurementsList { - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range v { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSInsertTabletReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "values", thrift.STRING, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:values: ", p), err) } + if err := oprot.WriteBinary(ctx, p.Values); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.values (4) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurementsList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:values: ", p), err) } return err } -func (p *TSInsertRecordsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ValuesList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.ValuesList { - if err := oprot.WriteBinary(ctx, v); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSInsertTabletReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.STRING, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } + if err := oprot.WriteBinary(ctx, p.Timestamps); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestamps (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:valuesList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamps: ", p), err) } return err } -func (p *TSInsertRecordsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.Timestamps)); err != nil { +func (p *TSInsertTabletReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "types", thrift.LIST, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:types: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Types)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Timestamps { - if err := oprot.WriteI64(ctx, int64(v)); err != nil { + for _, v := range p.Types { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamps: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:types: ", p), err) } return err } -func (p *TSInsertRecordsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsAligned() { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } - } +func (p *TSInsertTabletReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "size", thrift.I32, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:size: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.Size)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.size (7) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:size: ", p), err) } return err } -func (p *TSInsertRecordsReq) Equals(other *TSInsertRecordsReq) bool { - if p == other { +func (p *TSInsertTabletReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsAligned() { + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:isAligned: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAligned (8) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:isAligned: ", p), err) } + } + return err +} + +func (p *TSInsertTabletReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetWriteToTable() { + if err := oprot.WriteFieldBegin(ctx, "writeToTable", thrift.BOOL, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:writeToTable: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.WriteToTable)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.writeToTable (9) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:writeToTable: ", p), err) } + } + return err +} + +func (p *TSInsertTabletReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetColumnCategories() { + if err := oprot.WriteFieldBegin(ctx, "columnCategories", thrift.LIST, 10); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:columnCategories: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.BYTE, len(p.ColumnCategories)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.ColumnCategories { + if err := oprot.WriteByte(ctx, int8(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 10:columnCategories: ", p), err) } + } + return err +} + +func (p *TSInsertTabletReq) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsCompressed() { + if err := oprot.WriteFieldBegin(ctx, "isCompressed", thrift.BOOL, 11); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:isCompressed: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsCompressed)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isCompressed (11) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 11:isCompressed: ", p), err) } + } + return err +} + +func (p *TSInsertTabletReq) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetEncodingTypes() { + if err := oprot.WriteFieldBegin(ctx, "encodingTypes", thrift.LIST, 12); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:encodingTypes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.BYTE, len(p.EncodingTypes)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.EncodingTypes { + if err := oprot.WriteByte(ctx, int8(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 12:encodingTypes: ", p), err) } + } + return err +} + +func (p *TSInsertTabletReq) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetCompressType() { + if err := oprot.WriteFieldBegin(ctx, "compressType", thrift.BYTE, 13); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:compressType: ", p), err) } + if err := oprot.WriteByte(ctx, int8(*p.CompressType)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.compressType (13) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 13:compressType: ", p), err) } + } + return err +} + +func (p *TSInsertTabletReq) Equals(other *TSInsertTabletReq) bool { + if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.PrefixPaths) != len(other.PrefixPaths) { return false } - for i, _tgt := range p.PrefixPaths { - _src76 := other.PrefixPaths[i] - if _tgt != _src76 { return false } - } - if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } - for i, _tgt := range p.MeasurementsList { - _src77 := other.MeasurementsList[i] - if len(_tgt) != len(_src77) { return false } - for i, _tgt := range _tgt { - _src78 := _src77[i] - if _tgt != _src78 { return false } - } - } - if len(p.ValuesList) != len(other.ValuesList) { return false } - for i, _tgt := range p.ValuesList { - _src79 := other.ValuesList[i] - if bytes.Compare(_tgt, _src79) != 0 { return false } + if p.PrefixPath != other.PrefixPath { return false } + if len(p.Measurements) != len(other.Measurements) { return false } + for i, _tgt := range p.Measurements { + _src51 := other.Measurements[i] + if _tgt != _src51 { return false } } - if len(p.Timestamps) != len(other.Timestamps) { return false } - for i, _tgt := range p.Timestamps { - _src80 := other.Timestamps[i] - if _tgt != _src80 { return false } + if bytes.Compare(p.Values, other.Values) != 0 { return false } + if bytes.Compare(p.Timestamps, other.Timestamps) != 0 { return false } + if len(p.Types) != len(other.Types) { return false } + for i, _tgt := range p.Types { + _src52 := other.Types[i] + if _tgt != _src52 { return false } } + if p.Size != other.Size { return false } if p.IsAligned != other.IsAligned { if p.IsAligned == nil || other.IsAligned == nil { return false } if (*p.IsAligned) != (*other.IsAligned) { return false } } + if p.WriteToTable != other.WriteToTable { + if p.WriteToTable == nil || other.WriteToTable == nil { + return false + } + if (*p.WriteToTable) != (*other.WriteToTable) { return false } + } + if len(p.ColumnCategories) != len(other.ColumnCategories) { return false } + for i, _tgt := range p.ColumnCategories { + _src53 := other.ColumnCategories[i] + if _tgt != _src53 { return false } + } + if p.IsCompressed != other.IsCompressed { + if p.IsCompressed == nil || other.IsCompressed == nil { + return false + } + if (*p.IsCompressed) != (*other.IsCompressed) { return false } + } + if len(p.EncodingTypes) != len(other.EncodingTypes) { return false } + for i, _tgt := range p.EncodingTypes { + _src54 := other.EncodingTypes[i] + if _tgt != _src54 { return false } + } + if p.CompressType != other.CompressType { + if p.CompressType == nil || other.CompressType == nil { + return false + } + if (*p.CompressType) != (*other.CompressType) { return false } + } return true } -func (p *TSInsertRecordsReq) String() string { +func (p *TSInsertTabletReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertRecordsReq(%+v)", *p) + return fmt.Sprintf("TSInsertTabletReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPath +// - PrefixPaths // - MeasurementsList // - ValuesList -// - Timestamps +// - TimestampsList +// - TypesList +// - SizeList // - IsAligned -type TSInsertRecordsOfOneDeviceReq struct { +type TSInsertTabletsReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + PrefixPaths []string `thrift:"prefixPaths,2,required" db:"prefixPaths" json:"prefixPaths"` MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` ValuesList [][]byte `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` - Timestamps []int64 `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` - IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` + TimestampsList [][]byte `thrift:"timestampsList,5,required" db:"timestampsList" json:"timestampsList"` + TypesList [][]int32 `thrift:"typesList,6,required" db:"typesList" json:"typesList"` + SizeList []int32 `thrift:"sizeList,7,required" db:"sizeList" json:"sizeList"` + IsAligned *bool `thrift:"isAligned,8" db:"isAligned" json:"isAligned,omitempty"` } -func NewTSInsertRecordsOfOneDeviceReq() *TSInsertRecordsOfOneDeviceReq { - return &TSInsertRecordsOfOneDeviceReq{} +func NewTSInsertTabletsReq() *TSInsertTabletsReq { + return &TSInsertTabletsReq{} } -func (p *TSInsertRecordsOfOneDeviceReq) GetSessionId() int64 { +func (p *TSInsertTabletsReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertRecordsOfOneDeviceReq) GetPrefixPath() string { - return p.PrefixPath +func (p *TSInsertTabletsReq) GetPrefixPaths() []string { + return p.PrefixPaths } -func (p *TSInsertRecordsOfOneDeviceReq) GetMeasurementsList() [][]string { +func (p *TSInsertTabletsReq) GetMeasurementsList() [][]string { return p.MeasurementsList } -func (p *TSInsertRecordsOfOneDeviceReq) GetValuesList() [][]byte { +func (p *TSInsertTabletsReq) GetValuesList() [][]byte { return p.ValuesList } -func (p *TSInsertRecordsOfOneDeviceReq) GetTimestamps() []int64 { - return p.Timestamps +func (p *TSInsertTabletsReq) GetTimestampsList() [][]byte { + return p.TimestampsList } -var TSInsertRecordsOfOneDeviceReq_IsAligned_DEFAULT bool -func (p *TSInsertRecordsOfOneDeviceReq) GetIsAligned() bool { + +func (p *TSInsertTabletsReq) GetTypesList() [][]int32 { + return p.TypesList +} + +func (p *TSInsertTabletsReq) GetSizeList() []int32 { + return p.SizeList +} +var TSInsertTabletsReq_IsAligned_DEFAULT bool +func (p *TSInsertTabletsReq) GetIsAligned() bool { if !p.IsSetIsAligned() { - return TSInsertRecordsOfOneDeviceReq_IsAligned_DEFAULT + return TSInsertTabletsReq_IsAligned_DEFAULT } return *p.IsAligned } -func (p *TSInsertRecordsOfOneDeviceReq) IsSetIsAligned() bool { +func (p *TSInsertTabletsReq) IsSetIsAligned() bool { return p.IsAligned != nil } -func (p *TSInsertRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPath bool = false; + var issetPrefixPaths bool = false; var issetMeasurementsList bool = false; var issetValuesList bool = false; - var issetTimestamps bool = false; + var issetTimestampsList bool = false; + var issetTypesList bool = false; + var issetSizeList bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -8474,11 +8268,11 @@ func (p *TSInsertRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.T } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPath = true + issetPrefixPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -8511,17 +8305,39 @@ func (p *TSInsertRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.T if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetTimestamps = true + issetTimestampsList = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.LIST { if err := p.ReadField6(ctx, iprot); err != nil { return err } + issetTypesList = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 7: + if fieldTypeId == thrift.LIST { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } + issetSizeList = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 8: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField8(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -8542,8 +8358,8 @@ func (p *TSInsertRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.T if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); + if !issetPrefixPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPaths is not set")); } if !issetMeasurementsList{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); @@ -8551,13 +8367,19 @@ func (p *TSInsertRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.T if !issetValuesList{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ValuesList is not set")); } - if !issetTimestamps{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamps is not set")); + if !issetTimestampsList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimestampsList is not set")); } - return nil -} - -func (p *TSInsertRecordsOfOneDeviceReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if !issetTypesList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TypesList is not set")); + } + if !issetSizeList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SizeList is not set")); + } + return nil +} + +func (p *TSInsertTabletsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -8566,16 +8388,29 @@ func (p *TSInsertRecordsOfOneDeviceReq) ReadField1(ctx context.Context, iprot t return nil } -func (p *TSInsertRecordsOfOneDeviceReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *TSInsertTabletsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.PrefixPaths = tSlice + for i := 0; i < size; i ++ { +var _elem55 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.PrefixPath = v + _elem55 = v } + p.PrefixPaths = append(p.PrefixPaths, _elem55) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSInsertRecordsOfOneDeviceReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -8588,20 +8423,20 @@ func (p *TSInsertRecordsOfOneDeviceReq) ReadField3(ctx context.Context, iprot t return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - _elem81 := tSlice + _elem56 := tSlice for i := 0; i < size; i ++ { -var _elem82 string +var _elem57 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem82 = v + _elem57 = v } - _elem81 = append(_elem81, _elem82) + _elem56 = append(_elem56, _elem57) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } - p.MeasurementsList = append(p.MeasurementsList, _elem81) + p.MeasurementsList = append(p.MeasurementsList, _elem56) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8609,7 +8444,7 @@ var _elem82 string return nil } -func (p *TSInsertRecordsOfOneDeviceReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -8617,13 +8452,13 @@ func (p *TSInsertRecordsOfOneDeviceReq) ReadField4(ctx context.Context, iprot t tSlice := make([][]byte, 0, size) p.ValuesList = tSlice for i := 0; i < size; i ++ { -var _elem83 []byte +var _elem58 []byte if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem83 = v + _elem58 = v } - p.ValuesList = append(p.ValuesList, _elem83) + p.ValuesList = append(p.ValuesList, _elem58) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8631,21 +8466,21 @@ var _elem83 []byte return nil } -func (p *TSInsertRecordsOfOneDeviceReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]int64, 0, size) - p.Timestamps = tSlice + tSlice := make([][]byte, 0, size) + p.TimestampsList = tSlice for i := 0; i < size; i ++ { -var _elem84 int64 - if v, err := iprot.ReadI64(ctx); err != nil { +var _elem59 []byte + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem84 = v + _elem59 = v } - p.Timestamps = append(p.Timestamps, _elem84) + p.TimestampsList = append(p.TimestampsList, _elem59) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -8653,17 +8488,73 @@ var _elem84 int64 return nil } -func (p *TSInsertRecordsOfOneDeviceReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertTabletsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([][]int32, 0, size) + p.TypesList = tSlice + for i := 0; i < size; i ++ { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + _elem60 := tSlice + for i := 0; i < size; i ++ { +var _elem61 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem61 = v +} + _elem60 = append(_elem60, _elem61) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + p.TypesList = append(p.TypesList, _elem60) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSInsertTabletsReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.SizeList = tSlice + for i := 0; i < size; i ++ { +var _elem62 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem62 = v +} + p.SizeList = append(p.SizeList, _elem62) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSInsertTabletsReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) + return thrift.PrependError("error reading field 8: ", err) } else { p.IsAligned = &v } return nil } -func (p *TSInsertRecordsOfOneDeviceReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertRecordsOfOneDeviceReq"); err != nil { +func (p *TSInsertTabletsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertTabletsReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -8672,6 +8563,8 @@ func (p *TSInsertRecordsOfOneDeviceReq) Write(ctx context.Context, oprot thrift. if err := p.writeField4(ctx, oprot); err != nil { return err } if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -8680,7 +8573,7 @@ func (p *TSInsertRecordsOfOneDeviceReq) Write(ctx context.Context, oprot thrift. return nil } -func (p *TSInsertRecordsOfOneDeviceReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertTabletsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -8690,17 +8583,25 @@ func (p *TSInsertRecordsOfOneDeviceReq) writeField1(ctx context.Context, oprot t return err } -func (p *TSInsertRecordsOfOneDeviceReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } +func (p *TSInsertTabletsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPaths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPaths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PrefixPaths)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.PrefixPaths { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPaths: ", p), err) } return err } -func (p *TSInsertRecordsOfOneDeviceReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertTabletsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { @@ -8726,7 +8627,7 @@ func (p *TSInsertRecordsOfOneDeviceReq) writeField3(ctx context.Context, oprot t return err } -func (p *TSInsertRecordsOfOneDeviceReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertTabletsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ValuesList)); err != nil { @@ -8744,137 +8645,199 @@ func (p *TSInsertRecordsOfOneDeviceReq) writeField4(ctx context.Context, oprot t return err } -func (p *TSInsertRecordsOfOneDeviceReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.Timestamps)); err != nil { +func (p *TSInsertTabletsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampsList", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestampsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.TimestampsList)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Timestamps { - if err := oprot.WriteI64(ctx, int64(v)); err != nil { + for _, v := range p.TimestampsList { + if err := oprot.WriteBinary(ctx, v); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamps: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestampsList: ", p), err) } return err } -func (p *TSInsertRecordsOfOneDeviceReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertTabletsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "typesList", thrift.LIST, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:typesList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.TypesList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.TypesList { + if err := oprot.WriteListBegin(ctx, thrift.I32, len(v)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range v { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:typesList: ", p), err) } + return err +} + +func (p *TSInsertTabletsReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sizeList", thrift.LIST, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:sizeList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.SizeList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.SizeList { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:sizeList: ", p), err) } + return err +} + +func (p *TSInsertTabletsReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetIsAligned() { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:isAligned: ", p), err) } if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.isAligned (8) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:isAligned: ", p), err) } } return err } -func (p *TSInsertRecordsOfOneDeviceReq) Equals(other *TSInsertRecordsOfOneDeviceReq) bool { +func (p *TSInsertTabletsReq) Equals(other *TSInsertTabletsReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.PrefixPath != other.PrefixPath { return false } + if len(p.PrefixPaths) != len(other.PrefixPaths) { return false } + for i, _tgt := range p.PrefixPaths { + _src63 := other.PrefixPaths[i] + if _tgt != _src63 { return false } + } if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } for i, _tgt := range p.MeasurementsList { - _src85 := other.MeasurementsList[i] - if len(_tgt) != len(_src85) { return false } + _src64 := other.MeasurementsList[i] + if len(_tgt) != len(_src64) { return false } for i, _tgt := range _tgt { - _src86 := _src85[i] - if _tgt != _src86 { return false } + _src65 := _src64[i] + if _tgt != _src65 { return false } } } if len(p.ValuesList) != len(other.ValuesList) { return false } for i, _tgt := range p.ValuesList { - _src87 := other.ValuesList[i] - if bytes.Compare(_tgt, _src87) != 0 { return false } + _src66 := other.ValuesList[i] + if bytes.Compare(_tgt, _src66) != 0 { return false } } - if len(p.Timestamps) != len(other.Timestamps) { return false } - for i, _tgt := range p.Timestamps { - _src88 := other.Timestamps[i] - if _tgt != _src88 { return false } + if len(p.TimestampsList) != len(other.TimestampsList) { return false } + for i, _tgt := range p.TimestampsList { + _src67 := other.TimestampsList[i] + if bytes.Compare(_tgt, _src67) != 0 { return false } } - if p.IsAligned != other.IsAligned { - if p.IsAligned == nil || other.IsAligned == nil { - return false + if len(p.TypesList) != len(other.TypesList) { return false } + for i, _tgt := range p.TypesList { + _src68 := other.TypesList[i] + if len(_tgt) != len(_src68) { return false } + for i, _tgt := range _tgt { + _src69 := _src68[i] + if _tgt != _src69 { return false } + } + } + if len(p.SizeList) != len(other.SizeList) { return false } + for i, _tgt := range p.SizeList { + _src70 := other.SizeList[i] + if _tgt != _src70 { return false } + } + if p.IsAligned != other.IsAligned { + if p.IsAligned == nil || other.IsAligned == nil { + return false } if (*p.IsAligned) != (*other.IsAligned) { return false } } return true } -func (p *TSInsertRecordsOfOneDeviceReq) String() string { +func (p *TSInsertTabletsReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertRecordsOfOneDeviceReq(%+v)", *p) + return fmt.Sprintf("TSInsertTabletsReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPath +// - PrefixPaths // - MeasurementsList // - ValuesList // - Timestamps // - IsAligned -type TSInsertStringRecordsOfOneDeviceReq struct { +type TSInsertRecordsReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + PrefixPaths []string `thrift:"prefixPaths,2,required" db:"prefixPaths" json:"prefixPaths"` MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` - ValuesList [][]string `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` + ValuesList [][]byte `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` Timestamps []int64 `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` } -func NewTSInsertStringRecordsOfOneDeviceReq() *TSInsertStringRecordsOfOneDeviceReq { - return &TSInsertStringRecordsOfOneDeviceReq{} +func NewTSInsertRecordsReq() *TSInsertRecordsReq { + return &TSInsertRecordsReq{} } -func (p *TSInsertStringRecordsOfOneDeviceReq) GetSessionId() int64 { +func (p *TSInsertRecordsReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertStringRecordsOfOneDeviceReq) GetPrefixPath() string { - return p.PrefixPath +func (p *TSInsertRecordsReq) GetPrefixPaths() []string { + return p.PrefixPaths } -func (p *TSInsertStringRecordsOfOneDeviceReq) GetMeasurementsList() [][]string { +func (p *TSInsertRecordsReq) GetMeasurementsList() [][]string { return p.MeasurementsList } -func (p *TSInsertStringRecordsOfOneDeviceReq) GetValuesList() [][]string { +func (p *TSInsertRecordsReq) GetValuesList() [][]byte { return p.ValuesList } -func (p *TSInsertStringRecordsOfOneDeviceReq) GetTimestamps() []int64 { +func (p *TSInsertRecordsReq) GetTimestamps() []int64 { return p.Timestamps } -var TSInsertStringRecordsOfOneDeviceReq_IsAligned_DEFAULT bool -func (p *TSInsertStringRecordsOfOneDeviceReq) GetIsAligned() bool { +var TSInsertRecordsReq_IsAligned_DEFAULT bool +func (p *TSInsertRecordsReq) GetIsAligned() bool { if !p.IsSetIsAligned() { - return TSInsertStringRecordsOfOneDeviceReq_IsAligned_DEFAULT + return TSInsertRecordsReq_IsAligned_DEFAULT } return *p.IsAligned } -func (p *TSInsertStringRecordsOfOneDeviceReq) IsSetIsAligned() bool { +func (p *TSInsertRecordsReq) IsSetIsAligned() bool { return p.IsAligned != nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPath bool = false; + var issetPrefixPaths bool = false; var issetMeasurementsList bool = false; var issetValuesList bool = false; var issetTimestamps bool = false; @@ -8898,11 +8861,11 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) Read(ctx context.Context, iprot th } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPath = true + issetPrefixPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -8966,8 +8929,8 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) Read(ctx context.Context, iprot th if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); + if !issetPrefixPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPaths is not set")); } if !issetMeasurementsList{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); @@ -8981,7 +8944,7 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) Read(ctx context.Context, iprot th return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -8990,16 +8953,29 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField1(ctx context.Context, i return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *TSInsertRecordsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.PrefixPaths = tSlice + for i := 0; i < size; i ++ { +var _elem71 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.PrefixPath = v + _elem71 = v } + p.PrefixPaths = append(p.PrefixPaths, _elem71) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -9012,20 +8988,20 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField3(ctx context.Context, i return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - _elem89 := tSlice + _elem72 := tSlice for i := 0; i < size; i ++ { -var _elem90 string +var _elem73 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem90 = v + _elem73 = v } - _elem89 = append(_elem89, _elem90) + _elem72 = append(_elem72, _elem73) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } - p.MeasurementsList = append(p.MeasurementsList, _elem89) + p.MeasurementsList = append(p.MeasurementsList, _elem72) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9033,33 +9009,21 @@ var _elem90 string return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([][]string, 0, size) + tSlice := make([][]byte, 0, size) p.ValuesList = tSlice for i := 0; i < size; i ++ { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - _elem91 := tSlice - for i := 0; i < size; i ++ { -var _elem92 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +var _elem74 []byte + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _elem92 = v + _elem74 = v } - _elem91 = append(_elem91, _elem92) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - p.ValuesList = append(p.ValuesList, _elem91) + p.ValuesList = append(p.ValuesList, _elem74) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9067,7 +9031,7 @@ var _elem92 string return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -9075,13 +9039,13 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField5(ctx context.Context, i tSlice := make([]int64, 0, size) p.Timestamps = tSlice for i := 0; i < size; i ++ { -var _elem93 int64 +var _elem75 int64 if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem93 = v + _elem75 = v } - p.Timestamps = append(p.Timestamps, _elem93) + p.Timestamps = append(p.Timestamps, _elem75) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9089,7 +9053,7 @@ var _elem93 int64 return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { @@ -9098,8 +9062,8 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField6(ctx context.Context, i return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertStringRecordsOfOneDeviceReq"); err != nil { +func (p *TSInsertRecordsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertRecordsReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -9116,7 +9080,7 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) Write(ctx context.Context, oprot t return nil } -func (p *TSInsertStringRecordsOfOneDeviceReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -9126,17 +9090,25 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) writeField1(ctx context.Context, o return err } -func (p *TSInsertStringRecordsOfOneDeviceReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } +func (p *TSInsertRecordsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPaths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPaths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PrefixPaths)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.PrefixPaths { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPaths: ", p), err) } return err } -func (p *TSInsertStringRecordsOfOneDeviceReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { @@ -9162,23 +9134,15 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) writeField3(ctx context.Context, o return err } -func (p *TSInsertStringRecordsOfOneDeviceReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.ValuesList)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ValuesList)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.ValuesList { - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range v { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } + if err := oprot.WriteBinary(ctx, v); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) @@ -9188,7 +9152,7 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) writeField4(ctx context.Context, o return err } -func (p *TSInsertStringRecordsOfOneDeviceReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.LIST, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.Timestamps)); err != nil { @@ -9206,7 +9170,7 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) writeField5(ctx context.Context, o return err } -func (p *TSInsertStringRecordsOfOneDeviceReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetIsAligned() { if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } @@ -9218,36 +9182,36 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) writeField6(ctx context.Context, o return err } -func (p *TSInsertStringRecordsOfOneDeviceReq) Equals(other *TSInsertStringRecordsOfOneDeviceReq) bool { +func (p *TSInsertRecordsReq) Equals(other *TSInsertRecordsReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.PrefixPath != other.PrefixPath { return false } + if len(p.PrefixPaths) != len(other.PrefixPaths) { return false } + for i, _tgt := range p.PrefixPaths { + _src76 := other.PrefixPaths[i] + if _tgt != _src76 { return false } + } if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } for i, _tgt := range p.MeasurementsList { - _src94 := other.MeasurementsList[i] - if len(_tgt) != len(_src94) { return false } + _src77 := other.MeasurementsList[i] + if len(_tgt) != len(_src77) { return false } for i, _tgt := range _tgt { - _src95 := _src94[i] - if _tgt != _src95 { return false } + _src78 := _src77[i] + if _tgt != _src78 { return false } } } if len(p.ValuesList) != len(other.ValuesList) { return false } for i, _tgt := range p.ValuesList { - _src96 := other.ValuesList[i] - if len(_tgt) != len(_src96) { return false } - for i, _tgt := range _tgt { - _src97 := _src96[i] - if _tgt != _src97 { return false } - } + _src79 := other.ValuesList[i] + if bytes.Compare(_tgt, _src79) != 0 { return false } } if len(p.Timestamps) != len(other.Timestamps) { return false } for i, _tgt := range p.Timestamps { - _src98 := other.Timestamps[i] - if _tgt != _src98 { return false } + _src80 := other.Timestamps[i] + if _tgt != _src80 { return false } } if p.IsAligned != other.IsAligned { if p.IsAligned == nil || other.IsAligned == nil { @@ -9258,71 +9222,71 @@ func (p *TSInsertStringRecordsOfOneDeviceReq) Equals(other *TSInsertStringRecord return true } -func (p *TSInsertStringRecordsOfOneDeviceReq) String() string { +func (p *TSInsertRecordsReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertStringRecordsOfOneDeviceReq(%+v)", *p) + return fmt.Sprintf("TSInsertRecordsReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPaths +// - PrefixPath // - MeasurementsList // - ValuesList // - Timestamps // - IsAligned -type TSInsertStringRecordsReq struct { +type TSInsertRecordsOfOneDeviceReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPaths []string `thrift:"prefixPaths,2,required" db:"prefixPaths" json:"prefixPaths"` + PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` - ValuesList [][]string `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` + ValuesList [][]byte `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` Timestamps []int64 `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` } -func NewTSInsertStringRecordsReq() *TSInsertStringRecordsReq { - return &TSInsertStringRecordsReq{} +func NewTSInsertRecordsOfOneDeviceReq() *TSInsertRecordsOfOneDeviceReq { + return &TSInsertRecordsOfOneDeviceReq{} } -func (p *TSInsertStringRecordsReq) GetSessionId() int64 { +func (p *TSInsertRecordsOfOneDeviceReq) GetSessionId() int64 { return p.SessionId } -func (p *TSInsertStringRecordsReq) GetPrefixPaths() []string { - return p.PrefixPaths +func (p *TSInsertRecordsOfOneDeviceReq) GetPrefixPath() string { + return p.PrefixPath } -func (p *TSInsertStringRecordsReq) GetMeasurementsList() [][]string { +func (p *TSInsertRecordsOfOneDeviceReq) GetMeasurementsList() [][]string { return p.MeasurementsList } -func (p *TSInsertStringRecordsReq) GetValuesList() [][]string { +func (p *TSInsertRecordsOfOneDeviceReq) GetValuesList() [][]byte { return p.ValuesList } -func (p *TSInsertStringRecordsReq) GetTimestamps() []int64 { +func (p *TSInsertRecordsOfOneDeviceReq) GetTimestamps() []int64 { return p.Timestamps } -var TSInsertStringRecordsReq_IsAligned_DEFAULT bool -func (p *TSInsertStringRecordsReq) GetIsAligned() bool { +var TSInsertRecordsOfOneDeviceReq_IsAligned_DEFAULT bool +func (p *TSInsertRecordsOfOneDeviceReq) GetIsAligned() bool { if !p.IsSetIsAligned() { - return TSInsertStringRecordsReq_IsAligned_DEFAULT + return TSInsertRecordsOfOneDeviceReq_IsAligned_DEFAULT } return *p.IsAligned } -func (p *TSInsertStringRecordsReq) IsSetIsAligned() bool { +func (p *TSInsertRecordsOfOneDeviceReq) IsSetIsAligned() bool { return p.IsAligned != nil } -func (p *TSInsertStringRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPaths bool = false; + var issetPrefixPath bool = false; var issetMeasurementsList bool = false; var issetValuesList bool = false; var issetTimestamps bool = false; @@ -9346,11 +9310,11 @@ func (p *TSInsertStringRecordsReq) Read(ctx context.Context, iprot thrift.TProto } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPaths = true + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -9414,8 +9378,8 @@ func (p *TSInsertStringRecordsReq) Read(ctx context.Context, iprot thrift.TProto if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPaths is not set")); + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); } if !issetMeasurementsList{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); @@ -9429,7 +9393,7 @@ func (p *TSInsertStringRecordsReq) Read(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSInsertStringRecordsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsOfOneDeviceReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -9438,29 +9402,16 @@ func (p *TSInsertStringRecordsReq) ReadField1(ctx context.Context, iprot thrift return nil } -func (p *TSInsertStringRecordsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.PrefixPaths = tSlice - for i := 0; i < size; i ++ { -var _elem99 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSInsertRecordsOfOneDeviceReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - _elem99 = v + p.PrefixPath = v } - p.PrefixPaths = append(p.PrefixPaths, _elem99) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSInsertStringRecordsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsOfOneDeviceReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -9473,20 +9424,20 @@ func (p *TSInsertStringRecordsReq) ReadField3(ctx context.Context, iprot thrift return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - _elem100 := tSlice + _elem81 := tSlice for i := 0; i < size; i ++ { -var _elem101 string +var _elem82 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem101 = v + _elem82 = v } - _elem100 = append(_elem100, _elem101) + _elem81 = append(_elem81, _elem82) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } - p.MeasurementsList = append(p.MeasurementsList, _elem100) + p.MeasurementsList = append(p.MeasurementsList, _elem81) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9494,33 +9445,21 @@ var _elem101 string return nil } -func (p *TSInsertStringRecordsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsOfOneDeviceReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([][]string, 0, size) + tSlice := make([][]byte, 0, size) p.ValuesList = tSlice for i := 0; i < size; i ++ { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - _elem102 := tSlice - for i := 0; i < size; i ++ { -var _elem103 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +var _elem83 []byte + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _elem103 = v + _elem83 = v } - _elem102 = append(_elem102, _elem103) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - p.ValuesList = append(p.ValuesList, _elem102) + p.ValuesList = append(p.ValuesList, _elem83) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9528,7 +9467,7 @@ var _elem103 string return nil } -func (p *TSInsertStringRecordsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsOfOneDeviceReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) @@ -9536,13 +9475,13 @@ func (p *TSInsertStringRecordsReq) ReadField5(ctx context.Context, iprot thrift tSlice := make([]int64, 0, size) p.Timestamps = tSlice for i := 0; i < size; i ++ { -var _elem104 int64 +var _elem84 int64 if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem104 = v + _elem84 = v } - p.Timestamps = append(p.Timestamps, _elem104) + p.Timestamps = append(p.Timestamps, _elem84) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9550,7 +9489,7 @@ var _elem104 int64 return nil } -func (p *TSInsertStringRecordsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertRecordsOfOneDeviceReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { @@ -9559,8 +9498,8 @@ func (p *TSInsertStringRecordsReq) ReadField6(ctx context.Context, iprot thrift return nil } -func (p *TSInsertStringRecordsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSInsertStringRecordsReq"); err != nil { +func (p *TSInsertRecordsOfOneDeviceReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertRecordsOfOneDeviceReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -9577,7 +9516,7 @@ func (p *TSInsertStringRecordsReq) Write(ctx context.Context, oprot thrift.TProt return nil } -func (p *TSInsertStringRecordsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsOfOneDeviceReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -9587,25 +9526,17 @@ func (p *TSInsertStringRecordsReq) writeField1(ctx context.Context, oprot thrift return err } -func (p *TSInsertStringRecordsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPaths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPaths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PrefixPaths)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.PrefixPaths { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSInsertRecordsOfOneDeviceReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPaths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } return err } -func (p *TSInsertStringRecordsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsOfOneDeviceReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { @@ -9631,23 +9562,15 @@ func (p *TSInsertStringRecordsReq) writeField3(ctx context.Context, oprot thrift return err } -func (p *TSInsertStringRecordsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsOfOneDeviceReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.ValuesList)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.ValuesList)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.ValuesList { - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range v { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } + if err := oprot.WriteBinary(ctx, v); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) @@ -9657,7 +9580,7 @@ func (p *TSInsertStringRecordsReq) writeField4(ctx context.Context, oprot thrift return err } -func (p *TSInsertStringRecordsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsOfOneDeviceReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.LIST, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.Timestamps)); err != nil { @@ -9675,7 +9598,7 @@ func (p *TSInsertStringRecordsReq) writeField5(ctx context.Context, oprot thrift return err } -func (p *TSInsertStringRecordsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertRecordsOfOneDeviceReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetIsAligned() { if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } @@ -9687,40 +9610,32 @@ func (p *TSInsertStringRecordsReq) writeField6(ctx context.Context, oprot thrift return err } -func (p *TSInsertStringRecordsReq) Equals(other *TSInsertStringRecordsReq) bool { +func (p *TSInsertRecordsOfOneDeviceReq) Equals(other *TSInsertRecordsOfOneDeviceReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.PrefixPaths) != len(other.PrefixPaths) { return false } - for i, _tgt := range p.PrefixPaths { - _src105 := other.PrefixPaths[i] - if _tgt != _src105 { return false } - } + if p.PrefixPath != other.PrefixPath { return false } if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } for i, _tgt := range p.MeasurementsList { - _src106 := other.MeasurementsList[i] - if len(_tgt) != len(_src106) { return false } + _src85 := other.MeasurementsList[i] + if len(_tgt) != len(_src85) { return false } for i, _tgt := range _tgt { - _src107 := _src106[i] - if _tgt != _src107 { return false } + _src86 := _src85[i] + if _tgt != _src86 { return false } } } if len(p.ValuesList) != len(other.ValuesList) { return false } for i, _tgt := range p.ValuesList { - _src108 := other.ValuesList[i] - if len(_tgt) != len(_src108) { return false } - for i, _tgt := range _tgt { - _src109 := _src108[i] - if _tgt != _src109 { return false } - } + _src87 := other.ValuesList[i] + if bytes.Compare(_tgt, _src87) != 0 { return false } } if len(p.Timestamps) != len(other.Timestamps) { return false } for i, _tgt := range p.Timestamps { - _src110 := other.Timestamps[i] - if _tgt != _src110 { return false } + _src88 := other.Timestamps[i] + if _tgt != _src88 { return false } } if p.IsAligned != other.IsAligned { if p.IsAligned == nil || other.IsAligned == nil { @@ -9731,54 +9646,74 @@ func (p *TSInsertStringRecordsReq) Equals(other *TSInsertStringRecordsReq) bool return true } -func (p *TSInsertStringRecordsReq) String() string { +func (p *TSInsertRecordsOfOneDeviceReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSInsertStringRecordsReq(%+v)", *p) + return fmt.Sprintf("TSInsertRecordsOfOneDeviceReq(%+v)", *p) } // Attributes: // - SessionId -// - Paths -// - StartTime -// - EndTime -type TSDeleteDataReq struct { +// - PrefixPath +// - MeasurementsList +// - ValuesList +// - Timestamps +// - IsAligned +type TSInsertStringRecordsOfOneDeviceReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` - StartTime int64 `thrift:"startTime,3,required" db:"startTime" json:"startTime"` - EndTime int64 `thrift:"endTime,4,required" db:"endTime" json:"endTime"` + PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` + ValuesList [][]string `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` + Timestamps []int64 `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` + IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` } -func NewTSDeleteDataReq() *TSDeleteDataReq { - return &TSDeleteDataReq{} +func NewTSInsertStringRecordsOfOneDeviceReq() *TSInsertStringRecordsOfOneDeviceReq { + return &TSInsertStringRecordsOfOneDeviceReq{} } -func (p *TSDeleteDataReq) GetSessionId() int64 { +func (p *TSInsertStringRecordsOfOneDeviceReq) GetSessionId() int64 { return p.SessionId } -func (p *TSDeleteDataReq) GetPaths() []string { - return p.Paths +func (p *TSInsertStringRecordsOfOneDeviceReq) GetPrefixPath() string { + return p.PrefixPath } -func (p *TSDeleteDataReq) GetStartTime() int64 { - return p.StartTime +func (p *TSInsertStringRecordsOfOneDeviceReq) GetMeasurementsList() [][]string { + return p.MeasurementsList } -func (p *TSDeleteDataReq) GetEndTime() int64 { - return p.EndTime +func (p *TSInsertStringRecordsOfOneDeviceReq) GetValuesList() [][]string { + return p.ValuesList } -func (p *TSDeleteDataReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + +func (p *TSInsertStringRecordsOfOneDeviceReq) GetTimestamps() []int64 { + return p.Timestamps +} +var TSInsertStringRecordsOfOneDeviceReq_IsAligned_DEFAULT bool +func (p *TSInsertStringRecordsOfOneDeviceReq) GetIsAligned() bool { + if !p.IsSetIsAligned() { + return TSInsertStringRecordsOfOneDeviceReq_IsAligned_DEFAULT + } +return *p.IsAligned +} +func (p *TSInsertStringRecordsOfOneDeviceReq) IsSetIsAligned() bool { + return p.IsAligned != nil +} + +func (p *TSInsertStringRecordsOfOneDeviceReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPaths bool = false; - var issetStartTime bool = false; - var issetEndTime bool = false; + var issetPrefixPath bool = false; + var issetMeasurementsList bool = false; + var issetValuesList bool = false; + var issetTimestamps bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -9799,33 +9734,54 @@ func (p *TSDeleteDataReq) Read(ctx context.Context, iprot thrift.TProtocol) erro } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPaths = true + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.LIST { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetStartTime = true + issetMeasurementsList = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.LIST { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetEndTime = true + issetValuesList = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.LIST { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + issetTimestamps = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 6: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField6(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -9846,19 +9802,22 @@ func (p *TSDeleteDataReq) Read(ctx context.Context, iprot thrift.TProtocol) erro if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); } - if !issetStartTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")); + if !issetMeasurementsList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); } - if !issetEndTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field EndTime is not set")); + if !issetValuesList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ValuesList is not set")); + } + if !issetTimestamps{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamps is not set")); } return nil } -func (p *TSDeleteDataReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -9867,21 +9826,42 @@ func (p *TSDeleteDataReq) ReadField1(ctx context.Context, iprot thrift.TProtoco return nil } -func (p *TSDeleteDataReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.PrefixPath = v +} + return nil +} + +func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]string, 0, size) - p.Paths = tSlice + tSlice := make([][]string, 0, size) + p.MeasurementsList = tSlice for i := 0; i < size; i ++ { -var _elem111 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + _elem89 := tSlice + for i := 0; i < size; i ++ { +var _elem90 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _elem111 = v + _elem90 = v } - p.Paths = append(p.Paths, _elem111) + _elem89 = append(_elem89, _elem90) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + p.MeasurementsList = append(p.MeasurementsList, _elem89) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -9889,32 +9869,81 @@ var _elem111 string return nil } -func (p *TSDeleteDataReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) +func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([][]string, 0, size) + p.ValuesList = tSlice + for i := 0; i < size; i ++ { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + _elem91 := tSlice + for i := 0; i < size; i ++ { +var _elem92 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.StartTime = v + _elem92 = v } + _elem91 = append(_elem91, _elem92) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + p.ValuesList = append(p.ValuesList, _elem91) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSDeleteDataReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) +func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int64, 0, size) + p.Timestamps = tSlice + for i := 0; i < size; i ++ { +var _elem93 int64 + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.EndTime = v + _elem93 = v +} + p.Timestamps = append(p.Timestamps, _elem93) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSInsertStringRecordsOfOneDeviceReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) +} else { + p.IsAligned = &v } return nil } -func (p *TSDeleteDataReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSDeleteDataReq"); err != nil { +func (p *TSInsertStringRecordsOfOneDeviceReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertStringRecordsOfOneDeviceReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -9923,7 +9952,7 @@ func (p *TSDeleteDataReq) Write(ctx context.Context, oprot thrift.TProtocol) err return nil } -func (p *TSDeleteDataReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertStringRecordsOfOneDeviceReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -9933,162 +9962,206 @@ func (p *TSDeleteDataReq) writeField1(ctx context.Context, oprot thrift.TProtoco return err } -func (p *TSDeleteDataReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { +func (p *TSInsertStringRecordsOfOneDeviceReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return err +} + +func (p *TSInsertStringRecordsOfOneDeviceReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Paths { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + for _, v := range p.MeasurementsList { + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range v { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurementsList: ", p), err) } return err } -func (p *TSDeleteDataReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:startTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.startTime (3) field write error: ", p), err) } +func (p *TSInsertStringRecordsOfOneDeviceReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.ValuesList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.ValuesList { + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range v { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:startTime: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:valuesList: ", p), err) } return err } -func (p *TSDeleteDataReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "endTime", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:endTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.EndTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.endTime (4) field write error: ", p), err) } +func (p *TSInsertStringRecordsOfOneDeviceReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.Timestamps)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Timestamps { + if err := oprot.WriteI64(ctx, int64(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:endTime: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamps: ", p), err) } return err } -func (p *TSDeleteDataReq) Equals(other *TSDeleteDataReq) bool { +func (p *TSInsertStringRecordsOfOneDeviceReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsAligned() { + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } + } + return err +} + +func (p *TSInsertStringRecordsOfOneDeviceReq) Equals(other *TSInsertStringRecordsOfOneDeviceReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.Paths) != len(other.Paths) { return false } - for i, _tgt := range p.Paths { - _src112 := other.Paths[i] - if _tgt != _src112 { return false } + if p.PrefixPath != other.PrefixPath { return false } + if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } + for i, _tgt := range p.MeasurementsList { + _src94 := other.MeasurementsList[i] + if len(_tgt) != len(_src94) { return false } + for i, _tgt := range _tgt { + _src95 := _src94[i] + if _tgt != _src95 { return false } + } + } + if len(p.ValuesList) != len(other.ValuesList) { return false } + for i, _tgt := range p.ValuesList { + _src96 := other.ValuesList[i] + if len(_tgt) != len(_src96) { return false } + for i, _tgt := range _tgt { + _src97 := _src96[i] + if _tgt != _src97 { return false } + } + } + if len(p.Timestamps) != len(other.Timestamps) { return false } + for i, _tgt := range p.Timestamps { + _src98 := other.Timestamps[i] + if _tgt != _src98 { return false } + } + if p.IsAligned != other.IsAligned { + if p.IsAligned == nil || other.IsAligned == nil { + return false + } + if (*p.IsAligned) != (*other.IsAligned) { return false } } - if p.StartTime != other.StartTime { return false } - if p.EndTime != other.EndTime { return false } return true } -func (p *TSDeleteDataReq) String() string { +func (p *TSInsertStringRecordsOfOneDeviceReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSDeleteDataReq(%+v)", *p) + return fmt.Sprintf("TSInsertStringRecordsOfOneDeviceReq(%+v)", *p) } // Attributes: // - SessionId -// - Path -// - DataType -// - Encoding -// - Compressor -// - Props -// - Tags -// - Attributes -// - MeasurementAlias -type TSCreateTimeseriesReq struct { +// - PrefixPaths +// - MeasurementsList +// - ValuesList +// - Timestamps +// - IsAligned +type TSInsertStringRecordsReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Path string `thrift:"path,2,required" db:"path" json:"path"` - DataType int32 `thrift:"dataType,3,required" db:"dataType" json:"dataType"` - Encoding int32 `thrift:"encoding,4,required" db:"encoding" json:"encoding"` - Compressor int32 `thrift:"compressor,5,required" db:"compressor" json:"compressor"` - Props map[string]string `thrift:"props,6" db:"props" json:"props,omitempty"` - Tags map[string]string `thrift:"tags,7" db:"tags" json:"tags,omitempty"` - Attributes map[string]string `thrift:"attributes,8" db:"attributes" json:"attributes,omitempty"` - MeasurementAlias *string `thrift:"measurementAlias,9" db:"measurementAlias" json:"measurementAlias,omitempty"` + PrefixPaths []string `thrift:"prefixPaths,2,required" db:"prefixPaths" json:"prefixPaths"` + MeasurementsList [][]string `thrift:"measurementsList,3,required" db:"measurementsList" json:"measurementsList"` + ValuesList [][]string `thrift:"valuesList,4,required" db:"valuesList" json:"valuesList"` + Timestamps []int64 `thrift:"timestamps,5,required" db:"timestamps" json:"timestamps"` + IsAligned *bool `thrift:"isAligned,6" db:"isAligned" json:"isAligned,omitempty"` } -func NewTSCreateTimeseriesReq() *TSCreateTimeseriesReq { - return &TSCreateTimeseriesReq{} +func NewTSInsertStringRecordsReq() *TSInsertStringRecordsReq { + return &TSInsertStringRecordsReq{} } -func (p *TSCreateTimeseriesReq) GetSessionId() int64 { +func (p *TSInsertStringRecordsReq) GetSessionId() int64 { return p.SessionId } -func (p *TSCreateTimeseriesReq) GetPath() string { - return p.Path -} - -func (p *TSCreateTimeseriesReq) GetDataType() int32 { - return p.DataType -} - -func (p *TSCreateTimeseriesReq) GetEncoding() int32 { - return p.Encoding -} - -func (p *TSCreateTimeseriesReq) GetCompressor() int32 { - return p.Compressor +func (p *TSInsertStringRecordsReq) GetPrefixPaths() []string { + return p.PrefixPaths } -var TSCreateTimeseriesReq_Props_DEFAULT map[string]string -func (p *TSCreateTimeseriesReq) GetProps() map[string]string { - return p.Props +func (p *TSInsertStringRecordsReq) GetMeasurementsList() [][]string { + return p.MeasurementsList } -var TSCreateTimeseriesReq_Tags_DEFAULT map[string]string -func (p *TSCreateTimeseriesReq) GetTags() map[string]string { - return p.Tags +func (p *TSInsertStringRecordsReq) GetValuesList() [][]string { + return p.ValuesList } -var TSCreateTimeseriesReq_Attributes_DEFAULT map[string]string -func (p *TSCreateTimeseriesReq) GetAttributes() map[string]string { - return p.Attributes +func (p *TSInsertStringRecordsReq) GetTimestamps() []int64 { + return p.Timestamps } -var TSCreateTimeseriesReq_MeasurementAlias_DEFAULT string -func (p *TSCreateTimeseriesReq) GetMeasurementAlias() string { - if !p.IsSetMeasurementAlias() { - return TSCreateTimeseriesReq_MeasurementAlias_DEFAULT +var TSInsertStringRecordsReq_IsAligned_DEFAULT bool +func (p *TSInsertStringRecordsReq) GetIsAligned() bool { + if !p.IsSetIsAligned() { + return TSInsertStringRecordsReq_IsAligned_DEFAULT } -return *p.MeasurementAlias -} -func (p *TSCreateTimeseriesReq) IsSetProps() bool { - return p.Props != nil -} - -func (p *TSCreateTimeseriesReq) IsSetTags() bool { - return p.Tags != nil -} - -func (p *TSCreateTimeseriesReq) IsSetAttributes() bool { - return p.Attributes != nil +return *p.IsAligned } - -func (p *TSCreateTimeseriesReq) IsSetMeasurementAlias() bool { - return p.MeasurementAlias != nil +func (p *TSInsertStringRecordsReq) IsSetIsAligned() bool { + return p.IsAligned != nil } -func (p *TSCreateTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordsReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPath bool = false; - var issetDataType bool = false; - var issetEncoding bool = false; - var issetCompressor bool = false; + var issetPrefixPaths bool = false; + var issetMeasurementsList bool = false; + var issetValuesList bool = false; + var issetTimestamps bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -10109,51 +10182,51 @@ func (p *TSCreateTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPath = true + issetPrefixPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.LIST { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetDataType = true + issetMeasurementsList = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.LIST { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetEncoding = true + issetValuesList = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.LIST { if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetCompressor = true + issetTimestamps = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.MAP { + if fieldTypeId == thrift.BOOL { if err := p.ReadField6(ctx, iprot); err != nil { return err } @@ -10162,36 +10235,6 @@ func (p *TSCreateTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol return err } } - case 7: - if fieldTypeId == thrift.MAP { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.MAP { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.STRING { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -10207,22 +10250,22 @@ func (p *TSCreateTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Path is not set")); + if !issetPrefixPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPaths is not set")); } - if !issetDataType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataType is not set")); + if !issetMeasurementsList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MeasurementsList is not set")); } - if !issetEncoding{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")); + if !issetValuesList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ValuesList is not set")); } - if !issetCompressor{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressor is not set")); + if !issetTimestamps{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamps is not set")); } return nil } -func (p *TSCreateTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSInsertStringRecordsReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -10231,137 +10274,129 @@ func (p *TSCreateTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TP return nil } -func (p *TSCreateTimeseriesReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Path = v -} - return nil -} - -func (p *TSCreateTimeseriesReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.DataType = v -} - return nil -} - -func (p *TSCreateTimeseriesReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - p.Encoding = v -} - return nil -} - -func (p *TSCreateTimeseriesReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) -} else { - p.Compressor = v -} - return nil -} - -func (p *TSCreateTimeseriesReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin(ctx) +func (p *TSInsertStringRecordsReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { - return thrift.PrependError("error reading map begin: ", err) + return thrift.PrependError("error reading list begin: ", err) } - tMap := make(map[string]string, size) - p.Props = tMap + tSlice := make([]string, 0, size) + p.PrefixPaths = tSlice for i := 0; i < size; i ++ { -var _key113 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key113 = v -} -var _val114 string +var _elem99 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val114 = v + _elem99 = v } - p.Props[_key113] = _val114 + p.PrefixPaths = append(p.PrefixPaths, _elem99) } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *TSCreateTimeseriesReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin(ctx) +func (p *TSInsertStringRecordsReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { - return thrift.PrependError("error reading map begin: ", err) + return thrift.PrependError("error reading list begin: ", err) } - tMap := make(map[string]string, size) - p.Tags = tMap + tSlice := make([][]string, 0, size) + p.MeasurementsList = tSlice for i := 0; i < size; i ++ { -var _key115 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key115 = v -} -var _val116 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + _elem100 := tSlice + for i := 0; i < size; i ++ { +var _elem101 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _val116 = v + _elem101 = v } - p.Tags[_key115] = _val116 + _elem100 = append(_elem100, _elem101) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + p.MeasurementsList = append(p.MeasurementsList, _elem100) } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *TSCreateTimeseriesReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin(ctx) +func (p *TSInsertStringRecordsReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { - return thrift.PrependError("error reading map begin: ", err) + return thrift.PrependError("error reading list begin: ", err) } - tMap := make(map[string]string, size) - p.Attributes = tMap + tSlice := make([][]string, 0, size) + p.ValuesList = tSlice for i := 0; i < size; i ++ { -var _key117 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + _elem102 := tSlice + for i := 0; i < size; i ++ { +var _elem103 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - _key117 = v + _elem103 = v } -var _val118 string - if v, err := iprot.ReadString(ctx); err != nil { + _elem102 = append(_elem102, _elem103) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + p.ValuesList = append(p.ValuesList, _elem102) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSInsertStringRecordsReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int64, 0, size) + p.Timestamps = tSlice + for i := 0; i < size; i ++ { +var _elem104 int64 + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val118 = v + _elem104 = v } - p.Attributes[_key117] = _val118 + p.Timestamps = append(p.Timestamps, _elem104) } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *TSCreateTimeseriesReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) +func (p *TSInsertStringRecordsReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { - p.MeasurementAlias = &v + p.IsAligned = &v } return nil } -func (p *TSCreateTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSCreateTimeseriesReq"); err != nil { +func (p *TSInsertStringRecordsReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSInsertStringRecordsReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -10370,9 +10405,6 @@ func (p *TSCreateTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtoco if err := p.writeField4(ctx, oprot); err != nil { return err } if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } - if err := p.writeField8(ctx, oprot); err != nil { return err } - if err := p.writeField9(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -10381,7 +10413,7 @@ func (p *TSCreateTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtoco return nil } -func (p *TSCreateTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSInsertStringRecordsReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -10391,254 +10423,198 @@ func (p *TSCreateTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TP return err } -func (p *TSCreateTimeseriesReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "path", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:path: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Path)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.path (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:path: ", p), err) } - return err -} - -func (p *TSCreateTimeseriesReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "dataType", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:dataType: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.DataType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.dataType (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:dataType: ", p), err) } - return err -} - -func (p *TSCreateTimeseriesReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:encoding: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.encoding (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:encoding: ", p), err) } - return err -} - -func (p *TSCreateTimeseriesReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "compressor", thrift.I32, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:compressor: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.Compressor)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.compressor (5) field write error: ", p), err) } +func (p *TSInsertStringRecordsReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPaths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPaths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PrefixPaths)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.PrefixPaths { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:compressor: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPaths: ", p), err) } return err } -func (p *TSCreateTimeseriesReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetProps() { - if err := oprot.WriteFieldBegin(ctx, "props", thrift.MAP, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:props: ", p), err) } - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Props)); err != nil { - return thrift.PrependError("error writing map begin: ", err) +func (p *TSInsertStringRecordsReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "measurementsList", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurementsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.MeasurementsList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.MeasurementsList { + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } - for k, v := range p.Props { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + for _, v := range v { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:props: ", p), err) } } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurementsList: ", p), err) } return err } -func (p *TSCreateTimeseriesReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTags() { - if err := oprot.WriteFieldBegin(ctx, "tags", thrift.MAP, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:tags: ", p), err) } - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Tags)); err != nil { - return thrift.PrependError("error writing map begin: ", err) +func (p *TSInsertStringRecordsReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "valuesList", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:valuesList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.LIST, len(p.ValuesList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.ValuesList { + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } - for k, v := range p.Tags { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + for _, v := range v { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:tags: ", p), err) } } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:valuesList: ", p), err) } return err } -func (p *TSCreateTimeseriesReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetAttributes() { - if err := oprot.WriteFieldBegin(ctx, "attributes", thrift.MAP, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:attributes: ", p), err) } - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Attributes)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.Attributes { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:attributes: ", p), err) } +func (p *TSInsertStringRecordsReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamps", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:timestamps: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.Timestamps)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Timestamps { + if err := oprot.WriteI64(ctx, int64(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:timestamps: ", p), err) } return err } -func (p *TSCreateTimeseriesReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMeasurementAlias() { - if err := oprot.WriteFieldBegin(ctx, "measurementAlias", thrift.STRING, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:measurementAlias: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.MeasurementAlias)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.measurementAlias (9) field write error: ", p), err) } +func (p *TSInsertStringRecordsReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsAligned() { + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isAligned: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAligned (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:measurementAlias: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isAligned: ", p), err) } } return err } -func (p *TSCreateTimeseriesReq) Equals(other *TSCreateTimeseriesReq) bool { +func (p *TSInsertStringRecordsReq) Equals(other *TSInsertStringRecordsReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.Path != other.Path { return false } - if p.DataType != other.DataType { return false } - if p.Encoding != other.Encoding { return false } - if p.Compressor != other.Compressor { return false } - if len(p.Props) != len(other.Props) { return false } - for k, _tgt := range p.Props { - _src119 := other.Props[k] - if _tgt != _src119 { return false } + if len(p.PrefixPaths) != len(other.PrefixPaths) { return false } + for i, _tgt := range p.PrefixPaths { + _src105 := other.PrefixPaths[i] + if _tgt != _src105 { return false } } - if len(p.Tags) != len(other.Tags) { return false } - for k, _tgt := range p.Tags { - _src120 := other.Tags[k] - if _tgt != _src120 { return false } + if len(p.MeasurementsList) != len(other.MeasurementsList) { return false } + for i, _tgt := range p.MeasurementsList { + _src106 := other.MeasurementsList[i] + if len(_tgt) != len(_src106) { return false } + for i, _tgt := range _tgt { + _src107 := _src106[i] + if _tgt != _src107 { return false } + } } - if len(p.Attributes) != len(other.Attributes) { return false } - for k, _tgt := range p.Attributes { - _src121 := other.Attributes[k] - if _tgt != _src121 { return false } + if len(p.ValuesList) != len(other.ValuesList) { return false } + for i, _tgt := range p.ValuesList { + _src108 := other.ValuesList[i] + if len(_tgt) != len(_src108) { return false } + for i, _tgt := range _tgt { + _src109 := _src108[i] + if _tgt != _src109 { return false } + } } - if p.MeasurementAlias != other.MeasurementAlias { - if p.MeasurementAlias == nil || other.MeasurementAlias == nil { + if len(p.Timestamps) != len(other.Timestamps) { return false } + for i, _tgt := range p.Timestamps { + _src110 := other.Timestamps[i] + if _tgt != _src110 { return false } + } + if p.IsAligned != other.IsAligned { + if p.IsAligned == nil || other.IsAligned == nil { return false } - if (*p.MeasurementAlias) != (*other.MeasurementAlias) { return false } + if (*p.IsAligned) != (*other.IsAligned) { return false } } return true } -func (p *TSCreateTimeseriesReq) String() string { +func (p *TSInsertStringRecordsReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSCreateTimeseriesReq(%+v)", *p) + return fmt.Sprintf("TSInsertStringRecordsReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPath -// - Measurements -// - DataTypes -// - Encodings -// - Compressors -// - MeasurementAlias -// - TagsList -// - AttributesList -type TSCreateAlignedTimeseriesReq struct { +// - Paths +// - StartTime +// - EndTime +type TSDeleteDataReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` - Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` - DataTypes []int32 `thrift:"dataTypes,4,required" db:"dataTypes" json:"dataTypes"` - Encodings []int32 `thrift:"encodings,5,required" db:"encodings" json:"encodings"` - Compressors []int32 `thrift:"compressors,6,required" db:"compressors" json:"compressors"` - MeasurementAlias []string `thrift:"measurementAlias,7" db:"measurementAlias" json:"measurementAlias,omitempty"` - TagsList []map[string]string `thrift:"tagsList,8" db:"tagsList" json:"tagsList,omitempty"` - AttributesList []map[string]string `thrift:"attributesList,9" db:"attributesList" json:"attributesList,omitempty"` + Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` + StartTime int64 `thrift:"startTime,3,required" db:"startTime" json:"startTime"` + EndTime int64 `thrift:"endTime,4,required" db:"endTime" json:"endTime"` } -func NewTSCreateAlignedTimeseriesReq() *TSCreateAlignedTimeseriesReq { - return &TSCreateAlignedTimeseriesReq{} +func NewTSDeleteDataReq() *TSDeleteDataReq { + return &TSDeleteDataReq{} } -func (p *TSCreateAlignedTimeseriesReq) GetSessionId() int64 { +func (p *TSDeleteDataReq) GetSessionId() int64 { return p.SessionId } -func (p *TSCreateAlignedTimeseriesReq) GetPrefixPath() string { - return p.PrefixPath -} - -func (p *TSCreateAlignedTimeseriesReq) GetMeasurements() []string { - return p.Measurements -} - -func (p *TSCreateAlignedTimeseriesReq) GetDataTypes() []int32 { - return p.DataTypes -} - -func (p *TSCreateAlignedTimeseriesReq) GetEncodings() []int32 { - return p.Encodings -} - -func (p *TSCreateAlignedTimeseriesReq) GetCompressors() []int32 { - return p.Compressors -} -var TSCreateAlignedTimeseriesReq_MeasurementAlias_DEFAULT []string - -func (p *TSCreateAlignedTimeseriesReq) GetMeasurementAlias() []string { - return p.MeasurementAlias -} -var TSCreateAlignedTimeseriesReq_TagsList_DEFAULT []map[string]string - -func (p *TSCreateAlignedTimeseriesReq) GetTagsList() []map[string]string { - return p.TagsList -} -var TSCreateAlignedTimeseriesReq_AttributesList_DEFAULT []map[string]string - -func (p *TSCreateAlignedTimeseriesReq) GetAttributesList() []map[string]string { - return p.AttributesList -} -func (p *TSCreateAlignedTimeseriesReq) IsSetMeasurementAlias() bool { - return p.MeasurementAlias != nil +func (p *TSDeleteDataReq) GetPaths() []string { + return p.Paths } -func (p *TSCreateAlignedTimeseriesReq) IsSetTagsList() bool { - return p.TagsList != nil +func (p *TSDeleteDataReq) GetStartTime() int64 { + return p.StartTime } -func (p *TSCreateAlignedTimeseriesReq) IsSetAttributesList() bool { - return p.AttributesList != nil +func (p *TSDeleteDataReq) GetEndTime() int64 { + return p.EndTime } - -func (p *TSCreateAlignedTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSDeleteDataReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPath bool = false; - var issetMeasurements bool = false; - var issetDataTypes bool = false; - var issetEncodings bool = false; - var issetCompressors bool = false; + var issetPaths bool = false; + var issetStartTime bool = false; + var issetEndTime bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -10659,85 +10635,33 @@ func (p *TSCreateAlignedTimeseriesReq) Read(ctx context.Context, iprot thrift.TP } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPath = true + issetPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetMeasurements = true + issetStartTime = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetDataTypes = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.LIST { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - issetEncodings = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.LIST { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - issetCompressors = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.LIST { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.LIST { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.LIST { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } + issetEndTime = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -10758,25 +10682,19 @@ func (p *TSCreateAlignedTimeseriesReq) Read(ctx context.Context, iprot thrift.TP if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); - } - if !issetMeasurements{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); - } - if !issetDataTypes{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataTypes is not set")); + if !issetPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); } - if !issetEncodings{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); + if !issetStartTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")); } - if !issetCompressors{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressors is not set")); + if !issetEndTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field EndTime is not set")); } return nil } -func (p *TSCreateAlignedTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSDeleteDataReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -10785,30 +10703,21 @@ func (p *TSCreateAlignedTimeseriesReq) ReadField1(ctx context.Context, iprot th return nil } -func (p *TSCreateAlignedTimeseriesReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.PrefixPath = v -} - return nil -} - -func (p *TSCreateAlignedTimeseriesReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSDeleteDataReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.Measurements = tSlice + p.Paths = tSlice for i := 0; i < size; i ++ { -var _elem122 string +var _elem111 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem122 = v + _elem111 = v } - p.Measurements = append(p.Measurements, _elem122) + p.Paths = append(p.Paths, _elem111) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -10816,187 +10725,32 @@ var _elem122 string return nil } -func (p *TSCreateAlignedTimeseriesReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.DataTypes = tSlice - for i := 0; i < size; i ++ { -var _elem123 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSDeleteDataReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) } else { - _elem123 = v + p.StartTime = v } - p.DataTypes = append(p.DataTypes, _elem123) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateAlignedTimeseriesReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.Encodings = tSlice - for i := 0; i < size; i ++ { -var _elem124 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem124 = v -} - p.Encodings = append(p.Encodings, _elem124) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSCreateAlignedTimeseriesReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.Compressors = tSlice - for i := 0; i < size; i ++ { -var _elem125 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem125 = v -} - p.Compressors = append(p.Compressors, _elem125) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSCreateAlignedTimeseriesReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.MeasurementAlias = tSlice - for i := 0; i < size; i ++ { -var _elem126 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem126 = v -} - p.MeasurementAlias = append(p.MeasurementAlias, _elem126) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSCreateAlignedTimeseriesReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]map[string]string, 0, size) - p.TagsList = tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem127 := tMap - for i := 0; i < size; i ++ { -var _key128 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key128 = v -} -var _val129 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _val129 = v -} - _elem127[_key128] = _val129 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.TagsList = append(p.TagsList, _elem127) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSCreateAlignedTimeseriesReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]map[string]string, 0, size) - p.AttributesList = tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem130 := tMap - for i := 0; i < size; i ++ { -var _key131 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key131 = v -} -var _val132 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSDeleteDataReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) } else { - _val132 = v + p.EndTime = v } - _elem130[_key131] = _val132 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.AttributesList = append(p.AttributesList, _elem130) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateAlignedTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSCreateAlignedTimeseriesReq"); err != nil { +func (p *TSDeleteDataReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSDeleteDataReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } - if err := p.writeField8(ctx, oprot); err != nil { return err } - if err := p.writeField9(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -11005,7 +10759,7 @@ func (p *TSCreateAlignedTimeseriesReq) Write(ctx context.Context, oprot thrift.T return nil } -func (p *TSCreateAlignedTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSDeleteDataReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -11015,23 +10769,13 @@ func (p *TSCreateAlignedTimeseriesReq) writeField1(ctx context.Context, oprot th return err } -func (p *TSCreateAlignedTimeseriesReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } - return err -} - -func (p *TSCreateAlignedTimeseriesReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { +func (p *TSDeleteDataReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Measurements { + for _, v := range p.Paths { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -11039,318 +10783,148 @@ func (p *TSCreateAlignedTimeseriesReq) writeField3(ctx context.Context, oprot th return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurements: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } return err } -func (p *TSCreateAlignedTimeseriesReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "dataTypes", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:dataTypes: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.DataTypes)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.DataTypes { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSDeleteDataReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:startTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.startTime (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:dataTypes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:startTime: ", p), err) } return err } -func (p *TSCreateAlignedTimeseriesReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:encodings: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Encodings { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSDeleteDataReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "endTime", thrift.I64, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:endTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.EndTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.endTime (4) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:encodings: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:endTime: ", p), err) } return err } -func (p *TSCreateAlignedTimeseriesReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "compressors", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:compressors: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Compressors)); err != nil { - return thrift.PrependError("error writing list begin: ", err) +func (p *TSDeleteDataReq) Equals(other *TSDeleteDataReq) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false } - for _, v := range p.Compressors { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if p.SessionId != other.SessionId { return false } + if len(p.Paths) != len(other.Paths) { return false } + for i, _tgt := range p.Paths { + _src112 := other.Paths[i] + if _tgt != _src112 { return false } } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) + if p.StartTime != other.StartTime { return false } + if p.EndTime != other.EndTime { return false } + return true +} + +func (p *TSDeleteDataReq) String() string { + if p == nil { + return "" } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:compressors: ", p), err) } - return err -} - -func (p *TSCreateAlignedTimeseriesReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMeasurementAlias() { - if err := oprot.WriteFieldBegin(ctx, "measurementAlias", thrift.LIST, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:measurementAlias: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MeasurementAlias)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.MeasurementAlias { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:measurementAlias: ", p), err) } - } - return err -} - -func (p *TSCreateAlignedTimeseriesReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTagsList() { - if err := oprot.WriteFieldBegin(ctx, "tagsList", thrift.LIST, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:tagsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.TagsList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.TagsList { - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:tagsList: ", p), err) } - } - return err -} - -func (p *TSCreateAlignedTimeseriesReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetAttributesList() { - if err := oprot.WriteFieldBegin(ctx, "attributesList", thrift.LIST, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:attributesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.AttributesList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.AttributesList { - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:attributesList: ", p), err) } - } - return err -} - -func (p *TSCreateAlignedTimeseriesReq) Equals(other *TSCreateAlignedTimeseriesReq) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.SessionId != other.SessionId { return false } - if p.PrefixPath != other.PrefixPath { return false } - if len(p.Measurements) != len(other.Measurements) { return false } - for i, _tgt := range p.Measurements { - _src133 := other.Measurements[i] - if _tgt != _src133 { return false } - } - if len(p.DataTypes) != len(other.DataTypes) { return false } - for i, _tgt := range p.DataTypes { - _src134 := other.DataTypes[i] - if _tgt != _src134 { return false } - } - if len(p.Encodings) != len(other.Encodings) { return false } - for i, _tgt := range p.Encodings { - _src135 := other.Encodings[i] - if _tgt != _src135 { return false } - } - if len(p.Compressors) != len(other.Compressors) { return false } - for i, _tgt := range p.Compressors { - _src136 := other.Compressors[i] - if _tgt != _src136 { return false } - } - if len(p.MeasurementAlias) != len(other.MeasurementAlias) { return false } - for i, _tgt := range p.MeasurementAlias { - _src137 := other.MeasurementAlias[i] - if _tgt != _src137 { return false } - } - if len(p.TagsList) != len(other.TagsList) { return false } - for i, _tgt := range p.TagsList { - _src138 := other.TagsList[i] - if len(_tgt) != len(_src138) { return false } - for k, _tgt := range _tgt { - _src139 := _src138[k] - if _tgt != _src139 { return false } - } - } - if len(p.AttributesList) != len(other.AttributesList) { return false } - for i, _tgt := range p.AttributesList { - _src140 := other.AttributesList[i] - if len(_tgt) != len(_src140) { return false } - for k, _tgt := range _tgt { - _src141 := _src140[k] - if _tgt != _src141 { return false } - } - } - return true -} - -func (p *TSCreateAlignedTimeseriesReq) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TSCreateAlignedTimeseriesReq(%+v)", *p) + return fmt.Sprintf("TSDeleteDataReq(%+v)", *p) } // Attributes: // - SessionId -// - Paths -// - FetchSize -// - StartTime -// - EndTime -// - StatementId -// - EnableRedirectQuery -// - JdbcQuery -// - Timeout -// - LegalPathNodes -type TSRawDataQueryReq struct { +// - Path +// - DataType +// - Encoding +// - Compressor +// - Props +// - Tags +// - Attributes +// - MeasurementAlias +type TSCreateTimeseriesReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` - FetchSize *int32 `thrift:"fetchSize,3" db:"fetchSize" json:"fetchSize,omitempty"` - StartTime int64 `thrift:"startTime,4,required" db:"startTime" json:"startTime"` - EndTime int64 `thrift:"endTime,5,required" db:"endTime" json:"endTime"` - StatementId int64 `thrift:"statementId,6,required" db:"statementId" json:"statementId"` - EnableRedirectQuery *bool `thrift:"enableRedirectQuery,7" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` - JdbcQuery *bool `thrift:"jdbcQuery,8" db:"jdbcQuery" json:"jdbcQuery,omitempty"` - Timeout *int64 `thrift:"timeout,9" db:"timeout" json:"timeout,omitempty"` - LegalPathNodes *bool `thrift:"legalPathNodes,10" db:"legalPathNodes" json:"legalPathNodes,omitempty"` + Path string `thrift:"path,2,required" db:"path" json:"path"` + DataType int32 `thrift:"dataType,3,required" db:"dataType" json:"dataType"` + Encoding int32 `thrift:"encoding,4,required" db:"encoding" json:"encoding"` + Compressor int32 `thrift:"compressor,5,required" db:"compressor" json:"compressor"` + Props map[string]string `thrift:"props,6" db:"props" json:"props,omitempty"` + Tags map[string]string `thrift:"tags,7" db:"tags" json:"tags,omitempty"` + Attributes map[string]string `thrift:"attributes,8" db:"attributes" json:"attributes,omitempty"` + MeasurementAlias *string `thrift:"measurementAlias,9" db:"measurementAlias" json:"measurementAlias,omitempty"` } -func NewTSRawDataQueryReq() *TSRawDataQueryReq { - return &TSRawDataQueryReq{} +func NewTSCreateTimeseriesReq() *TSCreateTimeseriesReq { + return &TSCreateTimeseriesReq{} } -func (p *TSRawDataQueryReq) GetSessionId() int64 { +func (p *TSCreateTimeseriesReq) GetSessionId() int64 { return p.SessionId } -func (p *TSRawDataQueryReq) GetPaths() []string { - return p.Paths -} -var TSRawDataQueryReq_FetchSize_DEFAULT int32 -func (p *TSRawDataQueryReq) GetFetchSize() int32 { - if !p.IsSetFetchSize() { - return TSRawDataQueryReq_FetchSize_DEFAULT - } -return *p.FetchSize +func (p *TSCreateTimeseriesReq) GetPath() string { + return p.Path } -func (p *TSRawDataQueryReq) GetStartTime() int64 { - return p.StartTime +func (p *TSCreateTimeseriesReq) GetDataType() int32 { + return p.DataType } -func (p *TSRawDataQueryReq) GetEndTime() int64 { - return p.EndTime +func (p *TSCreateTimeseriesReq) GetEncoding() int32 { + return p.Encoding } -func (p *TSRawDataQueryReq) GetStatementId() int64 { - return p.StatementId +func (p *TSCreateTimeseriesReq) GetCompressor() int32 { + return p.Compressor } -var TSRawDataQueryReq_EnableRedirectQuery_DEFAULT bool -func (p *TSRawDataQueryReq) GetEnableRedirectQuery() bool { - if !p.IsSetEnableRedirectQuery() { - return TSRawDataQueryReq_EnableRedirectQuery_DEFAULT - } -return *p.EnableRedirectQuery +var TSCreateTimeseriesReq_Props_DEFAULT map[string]string + +func (p *TSCreateTimeseriesReq) GetProps() map[string]string { + return p.Props } -var TSRawDataQueryReq_JdbcQuery_DEFAULT bool -func (p *TSRawDataQueryReq) GetJdbcQuery() bool { - if !p.IsSetJdbcQuery() { - return TSRawDataQueryReq_JdbcQuery_DEFAULT - } -return *p.JdbcQuery +var TSCreateTimeseriesReq_Tags_DEFAULT map[string]string + +func (p *TSCreateTimeseriesReq) GetTags() map[string]string { + return p.Tags } -var TSRawDataQueryReq_Timeout_DEFAULT int64 -func (p *TSRawDataQueryReq) GetTimeout() int64 { - if !p.IsSetTimeout() { - return TSRawDataQueryReq_Timeout_DEFAULT - } -return *p.Timeout +var TSCreateTimeseriesReq_Attributes_DEFAULT map[string]string + +func (p *TSCreateTimeseriesReq) GetAttributes() map[string]string { + return p.Attributes } -var TSRawDataQueryReq_LegalPathNodes_DEFAULT bool -func (p *TSRawDataQueryReq) GetLegalPathNodes() bool { - if !p.IsSetLegalPathNodes() { - return TSRawDataQueryReq_LegalPathNodes_DEFAULT +var TSCreateTimeseriesReq_MeasurementAlias_DEFAULT string +func (p *TSCreateTimeseriesReq) GetMeasurementAlias() string { + if !p.IsSetMeasurementAlias() { + return TSCreateTimeseriesReq_MeasurementAlias_DEFAULT } -return *p.LegalPathNodes -} -func (p *TSRawDataQueryReq) IsSetFetchSize() bool { - return p.FetchSize != nil +return *p.MeasurementAlias } - -func (p *TSRawDataQueryReq) IsSetEnableRedirectQuery() bool { - return p.EnableRedirectQuery != nil +func (p *TSCreateTimeseriesReq) IsSetProps() bool { + return p.Props != nil } -func (p *TSRawDataQueryReq) IsSetJdbcQuery() bool { - return p.JdbcQuery != nil +func (p *TSCreateTimeseriesReq) IsSetTags() bool { + return p.Tags != nil } -func (p *TSRawDataQueryReq) IsSetTimeout() bool { - return p.Timeout != nil +func (p *TSCreateTimeseriesReq) IsSetAttributes() bool { + return p.Attributes != nil } -func (p *TSRawDataQueryReq) IsSetLegalPathNodes() bool { - return p.LegalPathNodes != nil +func (p *TSCreateTimeseriesReq) IsSetMeasurementAlias() bool { + return p.MeasurementAlias != nil } -func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPaths bool = false; - var issetStartTime bool = false; - var issetEndTime bool = false; - var issetStatementId bool = false; + var issetPath bool = false; + var issetDataType bool = false; + var issetEncoding bool = false; + var issetCompressor bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -11371,11 +10945,11 @@ func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) er } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPaths = true + issetPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -11386,46 +10960,46 @@ func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) er if err := p.ReadField3(ctx, iprot); err != nil { return err } + issetDataType = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.I32 { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetStartTime = true + issetEncoding = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.I32 { if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetEndTime = true + issetCompressor = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.MAP { if err := p.ReadField6(ctx, iprot); err != nil { return err } - issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.MAP { if err := p.ReadField7(ctx, iprot); err != nil { return err } @@ -11435,7 +11009,7 @@ func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) er } } case 8: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.MAP { if err := p.ReadField8(ctx, iprot); err != nil { return err } @@ -11445,7 +11019,7 @@ func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) er } } case 9: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.STRING { if err := p.ReadField9(ctx, iprot); err != nil { return err } @@ -11454,16 +11028,6 @@ func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) er return err } } - case 10: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField10(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -11479,22 +11043,22 @@ func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) er if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); + if !issetPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Path is not set")); } - if !issetStartTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")); + if !issetDataType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataType is not set")); } - if !issetEndTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field EndTime is not set")); + if !issetEncoding{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")); } - if !issetStatementId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); + if !issetCompressor{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressor is not set")); } return nil } -func (p *TSRawDataQueryReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -11503,102 +11067,137 @@ func (p *TSRawDataQueryReq) ReadField1(ctx context.Context, iprot thrift.TProto return nil } -func (p *TSRawDataQueryReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.Paths = tSlice - for i := 0; i < size; i ++ { -var _elem142 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSCreateTimeseriesReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - _elem142 = v + p.Path = v } - p.Paths = append(p.Paths, _elem142) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSRawDataQueryReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateTimeseriesReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.FetchSize = &v + p.DataType = v } return nil } -func (p *TSRawDataQueryReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { +func (p *TSCreateTimeseriesReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { - p.StartTime = v + p.Encoding = v } return nil } -func (p *TSRawDataQueryReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { +func (p *TSCreateTimeseriesReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { - p.EndTime = v + p.Compressor = v } return nil } -func (p *TSRawDataQueryReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) +func (p *TSCreateTimeseriesReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + p.Props = tMap + for i := 0; i < size; i ++ { +var _key113 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.StatementId = v -} - return nil + _key113 = v } - -func (p *TSRawDataQueryReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) +var _val114 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.EnableRedirectQuery = &v + _val114 = v } + p.Props[_key113] = _val114 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } return nil } -func (p *TSRawDataQueryReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) +func (p *TSCreateTimeseriesReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + p.Tags = tMap + for i := 0; i < size; i ++ { +var _key115 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.JdbcQuery = &v + _key115 = v +} +var _val116 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _val116 = v } + p.Tags[_key115] = _val116 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } return nil } -func (p *TSRawDataQueryReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) +func (p *TSCreateTimeseriesReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + p.Attributes = tMap + for i := 0; i < size; i ++ { +var _key117 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.Timeout = &v + _key117 = v +} +var _val118 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _val118 = v } + p.Attributes[_key117] = _val118 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } return nil } -func (p *TSRawDataQueryReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 10: ", err) +func (p *TSCreateTimeseriesReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 9: ", err) } else { - p.LegalPathNodes = &v + p.MeasurementAlias = &v } return nil } -func (p *TSRawDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSRawDataQueryReq"); err != nil { +func (p *TSCreateTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSCreateTimeseriesReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -11610,7 +11209,6 @@ func (p *TSRawDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) e if err := p.writeField7(ctx, oprot); err != nil { return err } if err := p.writeField8(ctx, oprot); err != nil { return err } if err := p.writeField9(ctx, oprot); err != nil { return err } - if err := p.writeField10(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -11619,7 +11217,7 @@ func (p *TSRawDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TSRawDataQueryReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSCreateTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -11629,275 +11227,254 @@ func (p *TSRawDataQueryReq) writeField1(ctx context.Context, oprot thrift.TProto return err } -func (p *TSRawDataQueryReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Paths { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSCreateTimeseriesReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "path", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:path: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Path)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.path (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:path: ", p), err) } return err } -func (p *TSRawDataQueryReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetFetchSize() { - if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } - if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fetchSize (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:fetchSize: ", p), err) } - } +func (p *TSCreateTimeseriesReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "dataType", thrift.I32, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:dataType: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.DataType)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.dataType (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:dataType: ", p), err) } return err } -func (p *TSRawDataQueryReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:startTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.startTime (4) field write error: ", p), err) } +func (p *TSCreateTimeseriesReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:encoding: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.encoding (4) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:startTime: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:encoding: ", p), err) } return err } -func (p *TSRawDataQueryReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "endTime", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:endTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.EndTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.endTime (5) field write error: ", p), err) } +func (p *TSCreateTimeseriesReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "compressor", thrift.I32, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:compressor: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.Compressor)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.compressor (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:endTime: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:compressor: ", p), err) } return err } -func (p *TSRawDataQueryReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:statementId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statementId (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:statementId: ", p), err) } - return err -} - -func (p *TSRawDataQueryReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetEnableRedirectQuery() { - if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:enableRedirectQuery: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (7) field write error: ", p), err) } +func (p *TSCreateTimeseriesReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetProps() { + if err := oprot.WriteFieldBegin(ctx, "props", thrift.MAP, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:props: ", p), err) } + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Props)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Props { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:enableRedirectQuery: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:props: ", p), err) } } return err } -func (p *TSRawDataQueryReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetJdbcQuery() { - if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:jdbcQuery: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.JdbcQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (8) field write error: ", p), err) } +func (p *TSCreateTimeseriesReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTags() { + if err := oprot.WriteFieldBegin(ctx, "tags", thrift.MAP, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:tags: ", p), err) } + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Tags)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Tags { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:jdbcQuery: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:tags: ", p), err) } } return err } -func (p *TSRawDataQueryReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:timeout: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (9) field write error: ", p), err) } +func (p *TSCreateTimeseriesReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetAttributes() { + if err := oprot.WriteFieldBegin(ctx, "attributes", thrift.MAP, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:attributes: ", p), err) } + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Attributes)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Attributes { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:timeout: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:attributes: ", p), err) } } return err } -func (p *TSRawDataQueryReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetLegalPathNodes() { - if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:legalPathNodes: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (10) field write error: ", p), err) } +func (p *TSCreateTimeseriesReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMeasurementAlias() { + if err := oprot.WriteFieldBegin(ctx, "measurementAlias", thrift.STRING, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:measurementAlias: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.MeasurementAlias)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.measurementAlias (9) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:legalPathNodes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:measurementAlias: ", p), err) } } return err } -func (p *TSRawDataQueryReq) Equals(other *TSRawDataQueryReq) bool { +func (p *TSCreateTimeseriesReq) Equals(other *TSCreateTimeseriesReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.Paths) != len(other.Paths) { return false } - for i, _tgt := range p.Paths { - _src143 := other.Paths[i] - if _tgt != _src143 { return false } - } - if p.FetchSize != other.FetchSize { - if p.FetchSize == nil || other.FetchSize == nil { - return false - } - if (*p.FetchSize) != (*other.FetchSize) { return false } - } - if p.StartTime != other.StartTime { return false } - if p.EndTime != other.EndTime { return false } - if p.StatementId != other.StatementId { return false } - if p.EnableRedirectQuery != other.EnableRedirectQuery { - if p.EnableRedirectQuery == nil || other.EnableRedirectQuery == nil { - return false - } - if (*p.EnableRedirectQuery) != (*other.EnableRedirectQuery) { return false } + if p.Path != other.Path { return false } + if p.DataType != other.DataType { return false } + if p.Encoding != other.Encoding { return false } + if p.Compressor != other.Compressor { return false } + if len(p.Props) != len(other.Props) { return false } + for k, _tgt := range p.Props { + _src119 := other.Props[k] + if _tgt != _src119 { return false } } - if p.JdbcQuery != other.JdbcQuery { - if p.JdbcQuery == nil || other.JdbcQuery == nil { - return false - } - if (*p.JdbcQuery) != (*other.JdbcQuery) { return false } + if len(p.Tags) != len(other.Tags) { return false } + for k, _tgt := range p.Tags { + _src120 := other.Tags[k] + if _tgt != _src120 { return false } } - if p.Timeout != other.Timeout { - if p.Timeout == nil || other.Timeout == nil { - return false - } - if (*p.Timeout) != (*other.Timeout) { return false } + if len(p.Attributes) != len(other.Attributes) { return false } + for k, _tgt := range p.Attributes { + _src121 := other.Attributes[k] + if _tgt != _src121 { return false } } - if p.LegalPathNodes != other.LegalPathNodes { - if p.LegalPathNodes == nil || other.LegalPathNodes == nil { + if p.MeasurementAlias != other.MeasurementAlias { + if p.MeasurementAlias == nil || other.MeasurementAlias == nil { return false } - if (*p.LegalPathNodes) != (*other.LegalPathNodes) { return false } + if (*p.MeasurementAlias) != (*other.MeasurementAlias) { return false } } return true } -func (p *TSRawDataQueryReq) String() string { +func (p *TSCreateTimeseriesReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSRawDataQueryReq(%+v)", *p) + return fmt.Sprintf("TSCreateTimeseriesReq(%+v)", *p) } // Attributes: // - SessionId -// - Paths -// - FetchSize -// - Time -// - StatementId -// - EnableRedirectQuery -// - JdbcQuery -// - Timeout -// - LegalPathNodes -type TSLastDataQueryReq struct { +// - PrefixPath +// - Measurements +// - DataTypes +// - Encodings +// - Compressors +// - MeasurementAlias +// - TagsList +// - AttributesList +type TSCreateAlignedTimeseriesReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` - FetchSize *int32 `thrift:"fetchSize,3" db:"fetchSize" json:"fetchSize,omitempty"` - Time int64 `thrift:"time,4,required" db:"time" json:"time"` - StatementId int64 `thrift:"statementId,5,required" db:"statementId" json:"statementId"` - EnableRedirectQuery *bool `thrift:"enableRedirectQuery,6" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` - JdbcQuery *bool `thrift:"jdbcQuery,7" db:"jdbcQuery" json:"jdbcQuery,omitempty"` - Timeout *int64 `thrift:"timeout,8" db:"timeout" json:"timeout,omitempty"` - LegalPathNodes *bool `thrift:"legalPathNodes,9" db:"legalPathNodes" json:"legalPathNodes,omitempty"` + PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + Measurements []string `thrift:"measurements,3,required" db:"measurements" json:"measurements"` + DataTypes []int32 `thrift:"dataTypes,4,required" db:"dataTypes" json:"dataTypes"` + Encodings []int32 `thrift:"encodings,5,required" db:"encodings" json:"encodings"` + Compressors []int32 `thrift:"compressors,6,required" db:"compressors" json:"compressors"` + MeasurementAlias []string `thrift:"measurementAlias,7" db:"measurementAlias" json:"measurementAlias,omitempty"` + TagsList []map[string]string `thrift:"tagsList,8" db:"tagsList" json:"tagsList,omitempty"` + AttributesList []map[string]string `thrift:"attributesList,9" db:"attributesList" json:"attributesList,omitempty"` } -func NewTSLastDataQueryReq() *TSLastDataQueryReq { - return &TSLastDataQueryReq{} +func NewTSCreateAlignedTimeseriesReq() *TSCreateAlignedTimeseriesReq { + return &TSCreateAlignedTimeseriesReq{} } -func (p *TSLastDataQueryReq) GetSessionId() int64 { +func (p *TSCreateAlignedTimeseriesReq) GetSessionId() int64 { return p.SessionId } -func (p *TSLastDataQueryReq) GetPaths() []string { - return p.Paths -} -var TSLastDataQueryReq_FetchSize_DEFAULT int32 -func (p *TSLastDataQueryReq) GetFetchSize() int32 { - if !p.IsSetFetchSize() { - return TSLastDataQueryReq_FetchSize_DEFAULT - } -return *p.FetchSize +func (p *TSCreateAlignedTimeseriesReq) GetPrefixPath() string { + return p.PrefixPath } -func (p *TSLastDataQueryReq) GetTime() int64 { - return p.Time +func (p *TSCreateAlignedTimeseriesReq) GetMeasurements() []string { + return p.Measurements } -func (p *TSLastDataQueryReq) GetStatementId() int64 { - return p.StatementId -} -var TSLastDataQueryReq_EnableRedirectQuery_DEFAULT bool -func (p *TSLastDataQueryReq) GetEnableRedirectQuery() bool { - if !p.IsSetEnableRedirectQuery() { - return TSLastDataQueryReq_EnableRedirectQuery_DEFAULT - } -return *p.EnableRedirectQuery -} -var TSLastDataQueryReq_JdbcQuery_DEFAULT bool -func (p *TSLastDataQueryReq) GetJdbcQuery() bool { - if !p.IsSetJdbcQuery() { - return TSLastDataQueryReq_JdbcQuery_DEFAULT - } -return *p.JdbcQuery -} -var TSLastDataQueryReq_Timeout_DEFAULT int64 -func (p *TSLastDataQueryReq) GetTimeout() int64 { - if !p.IsSetTimeout() { - return TSLastDataQueryReq_Timeout_DEFAULT - } -return *p.Timeout -} -var TSLastDataQueryReq_LegalPathNodes_DEFAULT bool -func (p *TSLastDataQueryReq) GetLegalPathNodes() bool { - if !p.IsSetLegalPathNodes() { - return TSLastDataQueryReq_LegalPathNodes_DEFAULT - } -return *p.LegalPathNodes -} -func (p *TSLastDataQueryReq) IsSetFetchSize() bool { - return p.FetchSize != nil +func (p *TSCreateAlignedTimeseriesReq) GetDataTypes() []int32 { + return p.DataTypes } -func (p *TSLastDataQueryReq) IsSetEnableRedirectQuery() bool { - return p.EnableRedirectQuery != nil +func (p *TSCreateAlignedTimeseriesReq) GetEncodings() []int32 { + return p.Encodings } -func (p *TSLastDataQueryReq) IsSetJdbcQuery() bool { - return p.JdbcQuery != nil +func (p *TSCreateAlignedTimeseriesReq) GetCompressors() []int32 { + return p.Compressors } +var TSCreateAlignedTimeseriesReq_MeasurementAlias_DEFAULT []string -func (p *TSLastDataQueryReq) IsSetTimeout() bool { - return p.Timeout != nil +func (p *TSCreateAlignedTimeseriesReq) GetMeasurementAlias() []string { + return p.MeasurementAlias } +var TSCreateAlignedTimeseriesReq_TagsList_DEFAULT []map[string]string -func (p *TSLastDataQueryReq) IsSetLegalPathNodes() bool { - return p.LegalPathNodes != nil +func (p *TSCreateAlignedTimeseriesReq) GetTagsList() []map[string]string { + return p.TagsList } +var TSCreateAlignedTimeseriesReq_AttributesList_DEFAULT []map[string]string -func (p *TSLastDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateAlignedTimeseriesReq) GetAttributesList() []map[string]string { + return p.AttributesList +} +func (p *TSCreateAlignedTimeseriesReq) IsSetMeasurementAlias() bool { + return p.MeasurementAlias != nil +} + +func (p *TSCreateAlignedTimeseriesReq) IsSetTagsList() bool { + return p.TagsList != nil +} + +func (p *TSCreateAlignedTimeseriesReq) IsSetAttributesList() bool { + return p.AttributesList != nil +} + +func (p *TSCreateAlignedTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPaths bool = false; - var issetTime bool = false; - var issetStatementId bool = false; + var issetPrefixPath bool = false; + var issetMeasurements bool = false; + var issetDataTypes bool = false; + var issetEncodings bool = false; + var issetCompressors bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -11918,60 +11495,62 @@ func (p *TSLastDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPaths = true + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.LIST { if err := p.ReadField3(ctx, iprot); err != nil { return err } + issetMeasurements = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.LIST { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetTime = true + issetDataTypes = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.LIST { if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetStatementId = true + issetEncodings = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.LIST { if err := p.ReadField6(ctx, iprot); err != nil { return err } + issetCompressors = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.LIST { if err := p.ReadField7(ctx, iprot); err != nil { return err } @@ -11981,7 +11560,7 @@ func (p *TSLastDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 8: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.LIST { if err := p.ReadField8(ctx, iprot); err != nil { return err } @@ -11991,7 +11570,7 @@ func (p *TSLastDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) e } } case 9: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.LIST { if err := p.ReadField9(ctx, iprot); err != nil { return err } @@ -12015,19 +11594,25 @@ func (p *TSLastDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) e if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); } - if !issetTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Time is not set")); + if !issetMeasurements{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); } - if !issetStatementId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); + if !issetDataTypes{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataTypes is not set")); + } + if !issetEncodings{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); + } + if !issetCompressors{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressors is not set")); } return nil } -func (p *TSLastDataQueryReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateAlignedTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -12036,21 +11621,30 @@ func (p *TSLastDataQueryReq) ReadField1(ctx context.Context, iprot thrift.TProt return nil } -func (p *TSLastDataQueryReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateAlignedTimeseriesReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.PrefixPath = v +} + return nil +} + +func (p *TSCreateAlignedTimeseriesReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.Paths = tSlice + p.Measurements = tSlice for i := 0; i < size; i ++ { -var _elem144 string +var _elem122 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem144 = v + _elem122 = v } - p.Paths = append(p.Paths, _elem144) + p.Measurements = append(p.Measurements, _elem122) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -12058,73 +11652,178 @@ var _elem144 string return nil } -func (p *TSLastDataQueryReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) +func (p *TSCreateAlignedTimeseriesReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.DataTypes = tSlice + for i := 0; i < size; i ++ { +var _elem123 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.FetchSize = &v + _elem123 = v } + p.DataTypes = append(p.DataTypes, _elem123) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSLastDataQueryReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) +func (p *TSCreateAlignedTimeseriesReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.Encodings = tSlice + for i := 0; i < size; i ++ { +var _elem124 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.Time = v + _elem124 = v } + p.Encodings = append(p.Encodings, _elem124) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSLastDataQueryReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) +func (p *TSCreateAlignedTimeseriesReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.Compressors = tSlice + for i := 0; i < size; i ++ { +var _elem125 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.StatementId = v + _elem125 = v } + p.Compressors = append(p.Compressors, _elem125) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSLastDataQueryReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) +func (p *TSCreateAlignedTimeseriesReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.MeasurementAlias = tSlice + for i := 0; i < size; i ++ { +var _elem126 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.EnableRedirectQuery = &v + _elem126 = v } + p.MeasurementAlias = append(p.MeasurementAlias, _elem126) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSLastDataQueryReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) +func (p *TSCreateAlignedTimeseriesReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]map[string]string, 0, size) + p.TagsList = tSlice + for i := 0; i < size; i ++ { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem127 := tMap + for i := 0; i < size; i ++ { +var _key128 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.JdbcQuery = &v -} - return nil + _key128 = v } - -func (p *TSLastDataQueryReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) +var _val129 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.Timeout = &v + _val129 = v } + _elem127[_key128] = _val129 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.TagsList = append(p.TagsList, _elem127) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSLastDataQueryReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) +func (p *TSCreateAlignedTimeseriesReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]map[string]string, 0, size) + p.AttributesList = tSlice + for i := 0; i < size; i ++ { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem130 := tMap + for i := 0; i < size; i ++ { +var _key131 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.LegalPathNodes = &v + _key131 = v } - return nil +var _val132 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _val132 = v } - -func (p *TSLastDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSLastDataQueryReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { + _elem130[_key131] = _val132 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.AttributesList = append(p.AttributesList, _elem130) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSCreateAlignedTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSCreateAlignedTimeseriesReq"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } @@ -12142,7 +11841,7 @@ func (p *TSLastDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) return nil } -func (p *TSLastDataQueryReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSCreateAlignedTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -12152,13 +11851,23 @@ func (p *TSLastDataQueryReq) writeField1(ctx context.Context, oprot thrift.TProt return err } -func (p *TSLastDataQueryReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { +func (p *TSCreateAlignedTimeseriesReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } + return err +} + +func (p *TSCreateAlignedTimeseriesReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:measurements: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Paths { + for _, v := range p.Measurements { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -12166,229 +11875,317 @@ func (p *TSLastDataQueryReq) writeField2(ctx context.Context, oprot thrift.TProt return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:measurements: ", p), err) } return err } -func (p *TSLastDataQueryReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetFetchSize() { - if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } - if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fetchSize (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:fetchSize: ", p), err) } +func (p *TSCreateAlignedTimeseriesReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "dataTypes", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:dataTypes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.DataTypes)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.DataTypes { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - return err -} - -func (p *TSLastDataQueryReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "time", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:time: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.Time)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.time (4) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:time: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:dataTypes: ", p), err) } return err } -func (p *TSLastDataQueryReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:statementId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statementId (5) field write error: ", p), err) } +func (p *TSCreateAlignedTimeseriesReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:encodings: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Encodings { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:statementId: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:encodings: ", p), err) } return err } -func (p *TSLastDataQueryReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetEnableRedirectQuery() { - if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:enableRedirectQuery: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:enableRedirectQuery: ", p), err) } +func (p *TSCreateAlignedTimeseriesReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "compressors", thrift.LIST, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:compressors: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Compressors)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } + for _, v := range p.Compressors { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:compressors: ", p), err) } return err } -func (p *TSLastDataQueryReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetJdbcQuery() { - if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:jdbcQuery: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.JdbcQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (7) field write error: ", p), err) } +func (p *TSCreateAlignedTimeseriesReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMeasurementAlias() { + if err := oprot.WriteFieldBegin(ctx, "measurementAlias", thrift.LIST, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:measurementAlias: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MeasurementAlias)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.MeasurementAlias { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:jdbcQuery: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:measurementAlias: ", p), err) } } return err } -func (p *TSLastDataQueryReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:timeout: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (8) field write error: ", p), err) } +func (p *TSCreateAlignedTimeseriesReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTagsList() { + if err := oprot.WriteFieldBegin(ctx, "tagsList", thrift.LIST, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:tagsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.TagsList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.TagsList { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:timeout: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:tagsList: ", p), err) } } return err } -func (p *TSLastDataQueryReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetLegalPathNodes() { - if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:legalPathNodes: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (9) field write error: ", p), err) } +func (p *TSCreateAlignedTimeseriesReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetAttributesList() { + if err := oprot.WriteFieldBegin(ctx, "attributesList", thrift.LIST, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:attributesList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.AttributesList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.AttributesList { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:legalPathNodes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:attributesList: ", p), err) } } return err } -func (p *TSLastDataQueryReq) Equals(other *TSLastDataQueryReq) bool { +func (p *TSCreateAlignedTimeseriesReq) Equals(other *TSCreateAlignedTimeseriesReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.Paths) != len(other.Paths) { return false } - for i, _tgt := range p.Paths { - _src145 := other.Paths[i] - if _tgt != _src145 { return false } + if p.PrefixPath != other.PrefixPath { return false } + if len(p.Measurements) != len(other.Measurements) { return false } + for i, _tgt := range p.Measurements { + _src133 := other.Measurements[i] + if _tgt != _src133 { return false } } - if p.FetchSize != other.FetchSize { - if p.FetchSize == nil || other.FetchSize == nil { - return false - } - if (*p.FetchSize) != (*other.FetchSize) { return false } + if len(p.DataTypes) != len(other.DataTypes) { return false } + for i, _tgt := range p.DataTypes { + _src134 := other.DataTypes[i] + if _tgt != _src134 { return false } } - if p.Time != other.Time { return false } - if p.StatementId != other.StatementId { return false } - if p.EnableRedirectQuery != other.EnableRedirectQuery { - if p.EnableRedirectQuery == nil || other.EnableRedirectQuery == nil { - return false - } - if (*p.EnableRedirectQuery) != (*other.EnableRedirectQuery) { return false } + if len(p.Encodings) != len(other.Encodings) { return false } + for i, _tgt := range p.Encodings { + _src135 := other.Encodings[i] + if _tgt != _src135 { return false } } - if p.JdbcQuery != other.JdbcQuery { - if p.JdbcQuery == nil || other.JdbcQuery == nil { - return false - } - if (*p.JdbcQuery) != (*other.JdbcQuery) { return false } + if len(p.Compressors) != len(other.Compressors) { return false } + for i, _tgt := range p.Compressors { + _src136 := other.Compressors[i] + if _tgt != _src136 { return false } } - if p.Timeout != other.Timeout { - if p.Timeout == nil || other.Timeout == nil { - return false + if len(p.MeasurementAlias) != len(other.MeasurementAlias) { return false } + for i, _tgt := range p.MeasurementAlias { + _src137 := other.MeasurementAlias[i] + if _tgt != _src137 { return false } + } + if len(p.TagsList) != len(other.TagsList) { return false } + for i, _tgt := range p.TagsList { + _src138 := other.TagsList[i] + if len(_tgt) != len(_src138) { return false } + for k, _tgt := range _tgt { + _src139 := _src138[k] + if _tgt != _src139 { return false } } - if (*p.Timeout) != (*other.Timeout) { return false } } - if p.LegalPathNodes != other.LegalPathNodes { - if p.LegalPathNodes == nil || other.LegalPathNodes == nil { - return false + if len(p.AttributesList) != len(other.AttributesList) { return false } + for i, _tgt := range p.AttributesList { + _src140 := other.AttributesList[i] + if len(_tgt) != len(_src140) { return false } + for k, _tgt := range _tgt { + _src141 := _src140[k] + if _tgt != _src141 { return false } } - if (*p.LegalPathNodes) != (*other.LegalPathNodes) { return false } } return true } -func (p *TSLastDataQueryReq) String() string { +func (p *TSCreateAlignedTimeseriesReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSLastDataQueryReq(%+v)", *p) + return fmt.Sprintf("TSCreateAlignedTimeseriesReq(%+v)", *p) } // Attributes: // - SessionId -// - Prefixes +// - Paths // - FetchSize +// - StartTime +// - EndTime // - StatementId // - EnableRedirectQuery // - JdbcQuery // - Timeout -type TSFastLastDataQueryForOnePrefixPathReq struct { +// - LegalPathNodes +type TSRawDataQueryReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Prefixes []string `thrift:"prefixes,2,required" db:"prefixes" json:"prefixes"` + Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` FetchSize *int32 `thrift:"fetchSize,3" db:"fetchSize" json:"fetchSize,omitempty"` - StatementId int64 `thrift:"statementId,4,required" db:"statementId" json:"statementId"` - EnableRedirectQuery *bool `thrift:"enableRedirectQuery,5" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` - JdbcQuery *bool `thrift:"jdbcQuery,6" db:"jdbcQuery" json:"jdbcQuery,omitempty"` - Timeout *int64 `thrift:"timeout,7" db:"timeout" json:"timeout,omitempty"` + StartTime int64 `thrift:"startTime,4,required" db:"startTime" json:"startTime"` + EndTime int64 `thrift:"endTime,5,required" db:"endTime" json:"endTime"` + StatementId int64 `thrift:"statementId,6,required" db:"statementId" json:"statementId"` + EnableRedirectQuery *bool `thrift:"enableRedirectQuery,7" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` + JdbcQuery *bool `thrift:"jdbcQuery,8" db:"jdbcQuery" json:"jdbcQuery,omitempty"` + Timeout *int64 `thrift:"timeout,9" db:"timeout" json:"timeout,omitempty"` + LegalPathNodes *bool `thrift:"legalPathNodes,10" db:"legalPathNodes" json:"legalPathNodes,omitempty"` } -func NewTSFastLastDataQueryForOnePrefixPathReq() *TSFastLastDataQueryForOnePrefixPathReq { - return &TSFastLastDataQueryForOnePrefixPathReq{} +func NewTSRawDataQueryReq() *TSRawDataQueryReq { + return &TSRawDataQueryReq{} } -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetSessionId() int64 { +func (p *TSRawDataQueryReq) GetSessionId() int64 { return p.SessionId } -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetPrefixes() []string { - return p.Prefixes +func (p *TSRawDataQueryReq) GetPaths() []string { + return p.Paths } -var TSFastLastDataQueryForOnePrefixPathReq_FetchSize_DEFAULT int32 -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetFetchSize() int32 { +var TSRawDataQueryReq_FetchSize_DEFAULT int32 +func (p *TSRawDataQueryReq) GetFetchSize() int32 { if !p.IsSetFetchSize() { - return TSFastLastDataQueryForOnePrefixPathReq_FetchSize_DEFAULT + return TSRawDataQueryReq_FetchSize_DEFAULT } return *p.FetchSize } -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetStatementId() int64 { +func (p *TSRawDataQueryReq) GetStartTime() int64 { + return p.StartTime +} + +func (p *TSRawDataQueryReq) GetEndTime() int64 { + return p.EndTime +} + +func (p *TSRawDataQueryReq) GetStatementId() int64 { return p.StatementId } -var TSFastLastDataQueryForOnePrefixPathReq_EnableRedirectQuery_DEFAULT bool -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetEnableRedirectQuery() bool { +var TSRawDataQueryReq_EnableRedirectQuery_DEFAULT bool +func (p *TSRawDataQueryReq) GetEnableRedirectQuery() bool { if !p.IsSetEnableRedirectQuery() { - return TSFastLastDataQueryForOnePrefixPathReq_EnableRedirectQuery_DEFAULT + return TSRawDataQueryReq_EnableRedirectQuery_DEFAULT } return *p.EnableRedirectQuery } -var TSFastLastDataQueryForOnePrefixPathReq_JdbcQuery_DEFAULT bool -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetJdbcQuery() bool { +var TSRawDataQueryReq_JdbcQuery_DEFAULT bool +func (p *TSRawDataQueryReq) GetJdbcQuery() bool { if !p.IsSetJdbcQuery() { - return TSFastLastDataQueryForOnePrefixPathReq_JdbcQuery_DEFAULT + return TSRawDataQueryReq_JdbcQuery_DEFAULT } return *p.JdbcQuery } -var TSFastLastDataQueryForOnePrefixPathReq_Timeout_DEFAULT int64 -func (p *TSFastLastDataQueryForOnePrefixPathReq) GetTimeout() int64 { +var TSRawDataQueryReq_Timeout_DEFAULT int64 +func (p *TSRawDataQueryReq) GetTimeout() int64 { if !p.IsSetTimeout() { - return TSFastLastDataQueryForOnePrefixPathReq_Timeout_DEFAULT + return TSRawDataQueryReq_Timeout_DEFAULT } return *p.Timeout } -func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetFetchSize() bool { +var TSRawDataQueryReq_LegalPathNodes_DEFAULT bool +func (p *TSRawDataQueryReq) GetLegalPathNodes() bool { + if !p.IsSetLegalPathNodes() { + return TSRawDataQueryReq_LegalPathNodes_DEFAULT + } +return *p.LegalPathNodes +} +func (p *TSRawDataQueryReq) IsSetFetchSize() bool { return p.FetchSize != nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetEnableRedirectQuery() bool { +func (p *TSRawDataQueryReq) IsSetEnableRedirectQuery() bool { return p.EnableRedirectQuery != nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetJdbcQuery() bool { +func (p *TSRawDataQueryReq) IsSetJdbcQuery() bool { return p.JdbcQuery != nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetTimeout() bool { +func (p *TSRawDataQueryReq) IsSetTimeout() bool { return p.Timeout != nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) IsSetLegalPathNodes() bool { + return p.LegalPathNodes != nil +} + +func (p *TSRawDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixes bool = false; + var issetPaths bool = false; + var issetStartTime bool = false; + var issetEndTime bool = false; var issetStatementId bool = false; for { @@ -12414,7 +12211,7 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixes = true + issetPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -12435,34 +12232,36 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetStatementId = true + issetStartTime = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.I64 { if err := p.ReadField5(ctx, iprot); err != nil { return err } + issetEndTime = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.I64 { if err := p.ReadField6(ctx, iprot); err != nil { return err } + issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.BOOL { if err := p.ReadField7(ctx, iprot); err != nil { return err } @@ -12471,6 +12270,36 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot return err } } + case 8: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField8(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 9: + if fieldTypeId == thrift.I64 { + if err := p.ReadField9(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 10: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField10(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -12486,8 +12315,14 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixes{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Prefixes is not set")); + if !issetPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); + } + if !issetStartTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")); + } + if !issetEndTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field EndTime is not set")); } if !issetStatementId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); @@ -12495,7 +12330,7 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -12504,21 +12339,21 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField1(ctx context.Context return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.Prefixes = tSlice + p.Paths = tSlice for i := 0; i < size; i ++ { -var _elem146 string +var _elem142 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem146 = v + _elem142 = v } - p.Prefixes = append(p.Prefixes, _elem146) + p.Paths = append(p.Paths, _elem142) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -12526,7 +12361,7 @@ var _elem146 string return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { @@ -12535,44 +12370,71 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField3(ctx context.Context return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) +} else { + p.StartTime = v +} + return nil +} + +func (p *TSRawDataQueryReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) +} else { + p.EndTime = v +} + return nil +} + +func (p *TSRawDataQueryReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { p.StatementId = v } return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) + return thrift.PrependError("error reading field 7: ", err) } else { p.EnableRedirectQuery = &v } return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) + return thrift.PrependError("error reading field 8: ", err) } else { p.JdbcQuery = &v } return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSRawDataQueryReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) + return thrift.PrependError("error reading field 9: ", err) } else { p.Timeout = &v } return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSFastLastDataQueryForOnePrefixPathReq"); err != nil { +func (p *TSRawDataQueryReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 10: ", err) +} else { + p.LegalPathNodes = &v +} + return nil +} + +func (p *TSRawDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSRawDataQueryReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -12582,6 +12444,9 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Write(ctx context.Context, opro if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -12590,7 +12455,7 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Write(ctx context.Context, opro return nil } -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSRawDataQueryReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -12600,13 +12465,13 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField1(ctx context.Context return err } -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixes", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixes: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Prefixes)); err != nil { +func (p *TSRawDataQueryReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Prefixes { + for _, v := range p.Paths { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -12614,11 +12479,11 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField2(ctx context.Context return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } return err } -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSRawDataQueryReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetFetchSize() { if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } @@ -12630,63 +12495,95 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField3(ctx context.Context return err } -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:statementId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statementId (4) field write error: ", p), err) } +func (p *TSRawDataQueryReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:startTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.startTime (4) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:statementId: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:startTime: ", p), err) } return err } -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetEnableRedirectQuery() { - if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:enableRedirectQuery: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:enableRedirectQuery: ", p), err) } - } - return err -} +func (p *TSRawDataQueryReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "endTime", thrift.I64, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:endTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.EndTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.endTime (5) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:endTime: ", p), err) } + return err +} -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSRawDataQueryReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:statementId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementId (6) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:statementId: ", p), err) } + return err +} + +func (p *TSRawDataQueryReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetEnableRedirectQuery() { + if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:enableRedirectQuery: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (7) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:enableRedirectQuery: ", p), err) } + } + return err +} + +func (p *TSRawDataQueryReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJdbcQuery() { - if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:jdbcQuery: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:jdbcQuery: ", p), err) } if err := oprot.WriteBool(ctx, bool(*p.JdbcQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (6) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (8) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:jdbcQuery: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:jdbcQuery: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSRawDataQueryReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:timeout: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:timeout: ", p), err) } if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (7) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.timeout (9) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:timeout: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:timeout: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOnePrefixPathReq) Equals(other *TSFastLastDataQueryForOnePrefixPathReq) bool { +func (p *TSRawDataQueryReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetLegalPathNodes() { + if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 10); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:legalPathNodes: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (10) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 10:legalPathNodes: ", p), err) } + } + return err +} + +func (p *TSRawDataQueryReq) Equals(other *TSRawDataQueryReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.Prefixes) != len(other.Prefixes) { return false } - for i, _tgt := range p.Prefixes { - _src147 := other.Prefixes[i] - if _tgt != _src147 { return false } + if len(p.Paths) != len(other.Paths) { return false } + for i, _tgt := range p.Paths { + _src143 := other.Paths[i] + if _tgt != _src143 { return false } } if p.FetchSize != other.FetchSize { if p.FetchSize == nil || other.FetchSize == nil { @@ -12694,6 +12591,8 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Equals(other *TSFastLastDataQue } if (*p.FetchSize) != (*other.FetchSize) { return false } } + if p.StartTime != other.StartTime { return false } + if p.EndTime != other.EndTime { return false } if p.StatementId != other.StatementId { return false } if p.EnableRedirectQuery != other.EnableRedirectQuery { if p.EnableRedirectQuery == nil || other.EnableRedirectQuery == nil { @@ -12713,128 +12612,127 @@ func (p *TSFastLastDataQueryForOnePrefixPathReq) Equals(other *TSFastLastDataQue } if (*p.Timeout) != (*other.Timeout) { return false } } + if p.LegalPathNodes != other.LegalPathNodes { + if p.LegalPathNodes == nil || other.LegalPathNodes == nil { + return false + } + if (*p.LegalPathNodes) != (*other.LegalPathNodes) { return false } + } return true } -func (p *TSFastLastDataQueryForOnePrefixPathReq) String() string { +func (p *TSRawDataQueryReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSFastLastDataQueryForOnePrefixPathReq(%+v)", *p) + return fmt.Sprintf("TSRawDataQueryReq(%+v)", *p) } // Attributes: // - SessionId -// - Db -// - DeviceId -// - Sensors +// - Paths // - FetchSize +// - Time // - StatementId // - EnableRedirectQuery // - JdbcQuery // - Timeout // - LegalPathNodes -type TSFastLastDataQueryForOneDeviceReq struct { +type TSLastDataQueryReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Db string `thrift:"db,2,required" db:"db" json:"db"` - DeviceId string `thrift:"deviceId,3,required" db:"deviceId" json:"deviceId"` - Sensors []string `thrift:"sensors,4,required" db:"sensors" json:"sensors"` - FetchSize *int32 `thrift:"fetchSize,5" db:"fetchSize" json:"fetchSize,omitempty"` - StatementId int64 `thrift:"statementId,6,required" db:"statementId" json:"statementId"` - EnableRedirectQuery *bool `thrift:"enableRedirectQuery,7" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` - JdbcQuery *bool `thrift:"jdbcQuery,8" db:"jdbcQuery" json:"jdbcQuery,omitempty"` - Timeout *int64 `thrift:"timeout,9" db:"timeout" json:"timeout,omitempty"` - LegalPathNodes *bool `thrift:"legalPathNodes,10" db:"legalPathNodes" json:"legalPathNodes,omitempty"` + Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` + FetchSize *int32 `thrift:"fetchSize,3" db:"fetchSize" json:"fetchSize,omitempty"` + Time int64 `thrift:"time,4,required" db:"time" json:"time"` + StatementId int64 `thrift:"statementId,5,required" db:"statementId" json:"statementId"` + EnableRedirectQuery *bool `thrift:"enableRedirectQuery,6" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` + JdbcQuery *bool `thrift:"jdbcQuery,7" db:"jdbcQuery" json:"jdbcQuery,omitempty"` + Timeout *int64 `thrift:"timeout,8" db:"timeout" json:"timeout,omitempty"` + LegalPathNodes *bool `thrift:"legalPathNodes,9" db:"legalPathNodes" json:"legalPathNodes,omitempty"` } -func NewTSFastLastDataQueryForOneDeviceReq() *TSFastLastDataQueryForOneDeviceReq { - return &TSFastLastDataQueryForOneDeviceReq{} +func NewTSLastDataQueryReq() *TSLastDataQueryReq { + return &TSLastDataQueryReq{} } -func (p *TSFastLastDataQueryForOneDeviceReq) GetSessionId() int64 { +func (p *TSLastDataQueryReq) GetSessionId() int64 { return p.SessionId } -func (p *TSFastLastDataQueryForOneDeviceReq) GetDb() string { - return p.Db -} - -func (p *TSFastLastDataQueryForOneDeviceReq) GetDeviceId() string { - return p.DeviceId -} - -func (p *TSFastLastDataQueryForOneDeviceReq) GetSensors() []string { - return p.Sensors +func (p *TSLastDataQueryReq) GetPaths() []string { + return p.Paths } -var TSFastLastDataQueryForOneDeviceReq_FetchSize_DEFAULT int32 -func (p *TSFastLastDataQueryForOneDeviceReq) GetFetchSize() int32 { +var TSLastDataQueryReq_FetchSize_DEFAULT int32 +func (p *TSLastDataQueryReq) GetFetchSize() int32 { if !p.IsSetFetchSize() { - return TSFastLastDataQueryForOneDeviceReq_FetchSize_DEFAULT + return TSLastDataQueryReq_FetchSize_DEFAULT } return *p.FetchSize } -func (p *TSFastLastDataQueryForOneDeviceReq) GetStatementId() int64 { +func (p *TSLastDataQueryReq) GetTime() int64 { + return p.Time +} + +func (p *TSLastDataQueryReq) GetStatementId() int64 { return p.StatementId } -var TSFastLastDataQueryForOneDeviceReq_EnableRedirectQuery_DEFAULT bool -func (p *TSFastLastDataQueryForOneDeviceReq) GetEnableRedirectQuery() bool { +var TSLastDataQueryReq_EnableRedirectQuery_DEFAULT bool +func (p *TSLastDataQueryReq) GetEnableRedirectQuery() bool { if !p.IsSetEnableRedirectQuery() { - return TSFastLastDataQueryForOneDeviceReq_EnableRedirectQuery_DEFAULT + return TSLastDataQueryReq_EnableRedirectQuery_DEFAULT } return *p.EnableRedirectQuery } -var TSFastLastDataQueryForOneDeviceReq_JdbcQuery_DEFAULT bool -func (p *TSFastLastDataQueryForOneDeviceReq) GetJdbcQuery() bool { +var TSLastDataQueryReq_JdbcQuery_DEFAULT bool +func (p *TSLastDataQueryReq) GetJdbcQuery() bool { if !p.IsSetJdbcQuery() { - return TSFastLastDataQueryForOneDeviceReq_JdbcQuery_DEFAULT + return TSLastDataQueryReq_JdbcQuery_DEFAULT } return *p.JdbcQuery } -var TSFastLastDataQueryForOneDeviceReq_Timeout_DEFAULT int64 -func (p *TSFastLastDataQueryForOneDeviceReq) GetTimeout() int64 { +var TSLastDataQueryReq_Timeout_DEFAULT int64 +func (p *TSLastDataQueryReq) GetTimeout() int64 { if !p.IsSetTimeout() { - return TSFastLastDataQueryForOneDeviceReq_Timeout_DEFAULT + return TSLastDataQueryReq_Timeout_DEFAULT } return *p.Timeout } -var TSFastLastDataQueryForOneDeviceReq_LegalPathNodes_DEFAULT bool -func (p *TSFastLastDataQueryForOneDeviceReq) GetLegalPathNodes() bool { +var TSLastDataQueryReq_LegalPathNodes_DEFAULT bool +func (p *TSLastDataQueryReq) GetLegalPathNodes() bool { if !p.IsSetLegalPathNodes() { - return TSFastLastDataQueryForOneDeviceReq_LegalPathNodes_DEFAULT + return TSLastDataQueryReq_LegalPathNodes_DEFAULT } return *p.LegalPathNodes } -func (p *TSFastLastDataQueryForOneDeviceReq) IsSetFetchSize() bool { +func (p *TSLastDataQueryReq) IsSetFetchSize() bool { return p.FetchSize != nil } -func (p *TSFastLastDataQueryForOneDeviceReq) IsSetEnableRedirectQuery() bool { +func (p *TSLastDataQueryReq) IsSetEnableRedirectQuery() bool { return p.EnableRedirectQuery != nil } -func (p *TSFastLastDataQueryForOneDeviceReq) IsSetJdbcQuery() bool { +func (p *TSLastDataQueryReq) IsSetJdbcQuery() bool { return p.JdbcQuery != nil } -func (p *TSFastLastDataQueryForOneDeviceReq) IsSetTimeout() bool { +func (p *TSLastDataQueryReq) IsSetTimeout() bool { return p.Timeout != nil } -func (p *TSFastLastDataQueryForOneDeviceReq) IsSetLegalPathNodes() bool { +func (p *TSLastDataQueryReq) IsSetLegalPathNodes() bool { return p.LegalPathNodes != nil } -func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetDb bool = false; - var issetDeviceId bool = false; - var issetSensors bool = false; + var issetPaths bool = false; + var issetTime bool = false; var issetStatementId bool = false; for { @@ -12856,54 +12754,53 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thr } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetDb = true + issetPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I32 { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetDeviceId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetSensors = true + issetTime = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.I64 { if err := p.ReadField5(ctx, iprot); err != nil { return err } + issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.BOOL { if err := p.ReadField6(ctx, iprot); err != nil { return err } - issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -12920,7 +12817,7 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thr } } case 8: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.I64 { if err := p.ReadField8(ctx, iprot); err != nil { return err } @@ -12930,18 +12827,8 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thr } } case 9: - if fieldTypeId == thrift.I64 { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 10: if fieldTypeId == thrift.BOOL { - if err := p.ReadField10(ctx, iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { @@ -12964,14 +12851,11 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thr if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetDb{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Db is not set")); - } - if !issetDeviceId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DeviceId is not set")); + if !issetPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); } - if !issetSensors{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Sensors is not set")); + if !issetTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Time is not set")); } if !issetStatementId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); @@ -12979,7 +12863,7 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thr return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -12988,39 +12872,21 @@ func (p *TSFastLastDataQueryForOneDeviceReq) ReadField1(ctx context.Context, ip return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Db = v -} - return nil -} - -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.DeviceId = v -} - return nil -} - -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.Sensors = tSlice + p.Paths = tSlice for i := 0; i < size; i ++ { -var _elem148 string +var _elem144 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem148 = v + _elem144 = v } - p.Sensors = append(p.Sensors, _elem148) + p.Paths = append(p.Paths, _elem144) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -13028,62 +12894,71 @@ var _elem148 string return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) + return thrift.PrependError("error reading field 3: ", err) } else { p.FetchSize = &v } return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) + return thrift.PrependError("error reading field 4: ", err) +} else { + p.Time = v +} + return nil +} + +func (p *TSLastDataQueryReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) } else { p.StatementId = v } return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) + return thrift.PrependError("error reading field 6: ", err) } else { p.EnableRedirectQuery = &v } return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) + return thrift.PrependError("error reading field 7: ", err) } else { p.JdbcQuery = &v } return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) + return thrift.PrependError("error reading field 8: ", err) } else { p.Timeout = &v } return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSLastDataQueryReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 10: ", err) + return thrift.PrependError("error reading field 9: ", err) } else { p.LegalPathNodes = &v } return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSFastLastDataQueryForOneDeviceReq"); err != nil { +func (p *TSLastDataQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSLastDataQueryReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -13095,7 +12970,6 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Write(ctx context.Context, oprot th if err := p.writeField7(ctx, oprot); err != nil { return err } if err := p.writeField8(ctx, oprot); err != nil { return err } if err := p.writeField9(ctx, oprot); err != nil { return err } - if err := p.writeField10(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -13104,7 +12978,7 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Write(ctx context.Context, oprot th return nil } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSLastDataQueryReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -13114,33 +12988,13 @@ func (p *TSFastLastDataQueryForOneDeviceReq) writeField1(ctx context.Context, op return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "db", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:db: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Db)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.db (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:db: ", p), err) } - return err -} - -func (p *TSFastLastDataQueryForOneDeviceReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "deviceId", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:deviceId: ", p), err) } - if err := oprot.WriteString(ctx, string(p.DeviceId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.deviceId (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:deviceId: ", p), err) } - return err -} - -func (p *TSFastLastDataQueryForOneDeviceReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sensors", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:sensors: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Sensors)); err != nil { +func (p *TSLastDataQueryReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Sensors { + for _, v := range p.Paths { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -13148,93 +13002,101 @@ func (p *TSFastLastDataQueryForOneDeviceReq) writeField4(ctx context.Context, op return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:sensors: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSLastDataQueryReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetFetchSize() { - if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:fetchSize: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fetchSize (5) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.fetchSize (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:fetchSize: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:fetchSize: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:statementId: ", p), err) } +func (p *TSLastDataQueryReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "time", thrift.I64, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:time: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.Time)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.time (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:time: ", p), err) } + return err +} + +func (p *TSLastDataQueryReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:statementId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statementId (6) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.statementId (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:statementId: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:statementId: ", p), err) } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSLastDataQueryReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetEnableRedirectQuery() { - if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:enableRedirectQuery: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:enableRedirectQuery: ", p), err) } if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (7) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:enableRedirectQuery: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:enableRedirectQuery: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSLastDataQueryReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJdbcQuery() { - if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:jdbcQuery: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:jdbcQuery: ", p), err) } if err := oprot.WriteBool(ctx, bool(*p.JdbcQuery)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (8) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (7) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:jdbcQuery: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:jdbcQuery: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSLastDataQueryReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:timeout: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:timeout: ", p), err) } if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (9) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.timeout (8) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:timeout: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:timeout: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSLastDataQueryReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetLegalPathNodes() { - if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:legalPathNodes: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:legalPathNodes: ", p), err) } if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (10) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (9) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:legalPathNodes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:legalPathNodes: ", p), err) } } return err } -func (p *TSFastLastDataQueryForOneDeviceReq) Equals(other *TSFastLastDataQueryForOneDeviceReq) bool { +func (p *TSLastDataQueryReq) Equals(other *TSLastDataQueryReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.Db != other.Db { return false } - if p.DeviceId != other.DeviceId { return false } - if len(p.Sensors) != len(other.Sensors) { return false } - for i, _tgt := range p.Sensors { - _src149 := other.Sensors[i] - if _tgt != _src149 { return false } + if len(p.Paths) != len(other.Paths) { return false } + for i, _tgt := range p.Paths { + _src145 := other.Paths[i] + if _tgt != _src145 { return false } } if p.FetchSize != other.FetchSize { if p.FetchSize == nil || other.FetchSize == nil { @@ -13242,6 +13104,7 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Equals(other *TSFastLastDataQueryFo } if (*p.FetchSize) != (*other.FetchSize) { return false } } + if p.Time != other.Time { return false } if p.StatementId != other.StatementId { return false } if p.EnableRedirectQuery != other.EnableRedirectQuery { if p.EnableRedirectQuery == nil || other.EnableRedirectQuery == nil { @@ -13270,145 +13133,99 @@ func (p *TSFastLastDataQueryForOneDeviceReq) Equals(other *TSFastLastDataQueryFo return true } -func (p *TSFastLastDataQueryForOneDeviceReq) String() string { +func (p *TSLastDataQueryReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSFastLastDataQueryForOneDeviceReq(%+v)", *p) + return fmt.Sprintf("TSLastDataQueryReq(%+v)", *p) } // Attributes: // - SessionId -// - StatementId -// - Paths -// - Aggregations -// - StartTime -// - EndTime -// - Interval -// - SlidingStep +// - Prefixes // - FetchSize +// - StatementId +// - EnableRedirectQuery +// - JdbcQuery // - Timeout -// - LegalPathNodes -type TSAggregationQueryReq struct { +type TSFastLastDataQueryForOnePrefixPathReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - StatementId int64 `thrift:"statementId,2,required" db:"statementId" json:"statementId"` - Paths []string `thrift:"paths,3,required" db:"paths" json:"paths"` - Aggregations []common.TAggregationType `thrift:"aggregations,4,required" db:"aggregations" json:"aggregations"` - StartTime *int64 `thrift:"startTime,5" db:"startTime" json:"startTime,omitempty"` - EndTime *int64 `thrift:"endTime,6" db:"endTime" json:"endTime,omitempty"` - Interval *int64 `thrift:"interval,7" db:"interval" json:"interval,omitempty"` - SlidingStep *int64 `thrift:"slidingStep,8" db:"slidingStep" json:"slidingStep,omitempty"` - FetchSize *int32 `thrift:"fetchSize,9" db:"fetchSize" json:"fetchSize,omitempty"` - Timeout *int64 `thrift:"timeout,10" db:"timeout" json:"timeout,omitempty"` - LegalPathNodes *bool `thrift:"legalPathNodes,11" db:"legalPathNodes" json:"legalPathNodes,omitempty"` + Prefixes []string `thrift:"prefixes,2,required" db:"prefixes" json:"prefixes"` + FetchSize *int32 `thrift:"fetchSize,3" db:"fetchSize" json:"fetchSize,omitempty"` + StatementId int64 `thrift:"statementId,4,required" db:"statementId" json:"statementId"` + EnableRedirectQuery *bool `thrift:"enableRedirectQuery,5" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` + JdbcQuery *bool `thrift:"jdbcQuery,6" db:"jdbcQuery" json:"jdbcQuery,omitempty"` + Timeout *int64 `thrift:"timeout,7" db:"timeout" json:"timeout,omitempty"` } -func NewTSAggregationQueryReq() *TSAggregationQueryReq { - return &TSAggregationQueryReq{} +func NewTSFastLastDataQueryForOnePrefixPathReq() *TSFastLastDataQueryForOnePrefixPathReq { + return &TSFastLastDataQueryForOnePrefixPathReq{} } -func (p *TSAggregationQueryReq) GetSessionId() int64 { +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetSessionId() int64 { return p.SessionId } -func (p *TSAggregationQueryReq) GetStatementId() int64 { - return p.StatementId -} - -func (p *TSAggregationQueryReq) GetPaths() []string { - return p.Paths -} - -func (p *TSAggregationQueryReq) GetAggregations() []common.TAggregationType { - return p.Aggregations -} -var TSAggregationQueryReq_StartTime_DEFAULT int64 -func (p *TSAggregationQueryReq) GetStartTime() int64 { - if !p.IsSetStartTime() { - return TSAggregationQueryReq_StartTime_DEFAULT - } -return *p.StartTime +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetPrefixes() []string { + return p.Prefixes } -var TSAggregationQueryReq_EndTime_DEFAULT int64 -func (p *TSAggregationQueryReq) GetEndTime() int64 { - if !p.IsSetEndTime() { - return TSAggregationQueryReq_EndTime_DEFAULT +var TSFastLastDataQueryForOnePrefixPathReq_FetchSize_DEFAULT int32 +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetFetchSize() int32 { + if !p.IsSetFetchSize() { + return TSFastLastDataQueryForOnePrefixPathReq_FetchSize_DEFAULT } -return *p.EndTime +return *p.FetchSize } -var TSAggregationQueryReq_Interval_DEFAULT int64 -func (p *TSAggregationQueryReq) GetInterval() int64 { - if !p.IsSetInterval() { - return TSAggregationQueryReq_Interval_DEFAULT - } -return *p.Interval + +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetStatementId() int64 { + return p.StatementId } -var TSAggregationQueryReq_SlidingStep_DEFAULT int64 -func (p *TSAggregationQueryReq) GetSlidingStep() int64 { - if !p.IsSetSlidingStep() { - return TSAggregationQueryReq_SlidingStep_DEFAULT +var TSFastLastDataQueryForOnePrefixPathReq_EnableRedirectQuery_DEFAULT bool +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetEnableRedirectQuery() bool { + if !p.IsSetEnableRedirectQuery() { + return TSFastLastDataQueryForOnePrefixPathReq_EnableRedirectQuery_DEFAULT } -return *p.SlidingStep +return *p.EnableRedirectQuery } -var TSAggregationQueryReq_FetchSize_DEFAULT int32 -func (p *TSAggregationQueryReq) GetFetchSize() int32 { - if !p.IsSetFetchSize() { - return TSAggregationQueryReq_FetchSize_DEFAULT +var TSFastLastDataQueryForOnePrefixPathReq_JdbcQuery_DEFAULT bool +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetJdbcQuery() bool { + if !p.IsSetJdbcQuery() { + return TSFastLastDataQueryForOnePrefixPathReq_JdbcQuery_DEFAULT } -return *p.FetchSize +return *p.JdbcQuery } -var TSAggregationQueryReq_Timeout_DEFAULT int64 -func (p *TSAggregationQueryReq) GetTimeout() int64 { +var TSFastLastDataQueryForOnePrefixPathReq_Timeout_DEFAULT int64 +func (p *TSFastLastDataQueryForOnePrefixPathReq) GetTimeout() int64 { if !p.IsSetTimeout() { - return TSAggregationQueryReq_Timeout_DEFAULT + return TSFastLastDataQueryForOnePrefixPathReq_Timeout_DEFAULT } return *p.Timeout } -var TSAggregationQueryReq_LegalPathNodes_DEFAULT bool -func (p *TSAggregationQueryReq) GetLegalPathNodes() bool { - if !p.IsSetLegalPathNodes() { - return TSAggregationQueryReq_LegalPathNodes_DEFAULT - } -return *p.LegalPathNodes -} -func (p *TSAggregationQueryReq) IsSetStartTime() bool { - return p.StartTime != nil -} - -func (p *TSAggregationQueryReq) IsSetEndTime() bool { - return p.EndTime != nil -} - -func (p *TSAggregationQueryReq) IsSetInterval() bool { - return p.Interval != nil +func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetFetchSize() bool { + return p.FetchSize != nil } -func (p *TSAggregationQueryReq) IsSetSlidingStep() bool { - return p.SlidingStep != nil +func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetEnableRedirectQuery() bool { + return p.EnableRedirectQuery != nil } -func (p *TSAggregationQueryReq) IsSetFetchSize() bool { - return p.FetchSize != nil +func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetJdbcQuery() bool { + return p.JdbcQuery != nil } -func (p *TSAggregationQueryReq) IsSetTimeout() bool { +func (p *TSFastLastDataQueryForOnePrefixPathReq) IsSetTimeout() bool { return p.Timeout != nil } -func (p *TSAggregationQueryReq) IsSetLegalPathNodes() bool { - return p.LegalPathNodes != nil -} - -func (p *TSAggregationQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOnePrefixPathReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; + var issetPrefixes bool = false; var issetStatementId bool = false; - var issetPaths bool = false; - var issetAggregations bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -13429,40 +13246,39 @@ func (p *TSAggregationQueryReq) Read(ctx context.Context, iprot thrift.TProtocol } } case 2: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetStatementId = true + issetPrefixes = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I32 { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetAggregations = true + issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.BOOL { if err := p.ReadField5(ctx, iprot); err != nil { return err } @@ -13472,7 +13288,7 @@ func (p *TSAggregationQueryReq) Read(ctx context.Context, iprot thrift.TProtocol } } case 6: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.BOOL { if err := p.ReadField6(ctx, iprot); err != nil { return err } @@ -13491,46 +13307,6 @@ func (p *TSAggregationQueryReq) Read(ctx context.Context, iprot thrift.TProtocol return err } } - case 8: - if fieldTypeId == thrift.I64 { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.I32 { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 10: - if fieldTypeId == thrift.I64 { - if err := p.ReadField10(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 11: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField11(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -13546,19 +13322,16 @@ func (p *TSAggregationQueryReq) Read(ctx context.Context, iprot thrift.TProtocol if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } + if !issetPrefixes{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Prefixes is not set")); + } if !issetStatementId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); } - if !issetPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); - } - if !issetAggregations{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Aggregations is not set")); - } return nil } -func (p *TSAggregationQueryReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -13567,53 +13340,21 @@ func (p *TSAggregationQueryReq) ReadField1(ctx context.Context, iprot thrift.TP return nil } -func (p *TSAggregationQueryReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.StatementId = v -} - return nil -} - -func (p *TSAggregationQueryReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.Paths = tSlice + p.Prefixes = tSlice for i := 0; i < size; i ++ { -var _elem150 string +var _elem146 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem150 = v -} - p.Paths = append(p.Paths, _elem150) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSAggregationQueryReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]common.TAggregationType, 0, size) - p.Aggregations = tSlice - for i := 0; i < size; i ++ { -var _elem151 common.TAggregationType - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - temp := common.TAggregationType(v) - _elem151 = temp + _elem146 = v } - p.Aggregations = append(p.Aggregations, _elem151) + p.Prefixes = append(p.Prefixes, _elem146) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -13621,71 +13362,53 @@ var _elem151 common.TAggregationType return nil } -func (p *TSAggregationQueryReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) -} else { - p.StartTime = &v -} - return nil -} - -func (p *TSAggregationQueryReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) } else { - p.EndTime = &v + p.FetchSize = &v } return nil } -func (p *TSAggregationQueryReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) + return thrift.PrependError("error reading field 4: ", err) } else { - p.Interval = &v + p.StatementId = v } return nil } -func (p *TSAggregationQueryReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) } else { - p.SlidingStep = &v + p.EnableRedirectQuery = &v } return nil } -func (p *TSAggregationQueryReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { - p.FetchSize = &v + p.JdbcQuery = &v } return nil } -func (p *TSAggregationQueryReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOnePrefixPathReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 10: ", err) + return thrift.PrependError("error reading field 7: ", err) } else { p.Timeout = &v } return nil } -func (p *TSAggregationQueryReq) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 11: ", err) -} else { - p.LegalPathNodes = &v -} - return nil -} - -func (p *TSAggregationQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSAggregationQueryReq"); err != nil { +func (p *TSFastLastDataQueryForOnePrefixPathReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSFastLastDataQueryForOnePrefixPathReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -13695,10 +13418,6 @@ func (p *TSAggregationQueryReq) Write(ctx context.Context, oprot thrift.TProtoco if err := p.writeField5(ctx, oprot); err != nil { return err } if err := p.writeField6(ctx, oprot); err != nil { return err } if err := p.writeField7(ctx, oprot); err != nil { return err } - if err := p.writeField8(ctx, oprot); err != nil { return err } - if err := p.writeField9(ctx, oprot); err != nil { return err } - if err := p.writeField10(ctx, oprot); err != nil { return err } - if err := p.writeField11(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -13707,7 +13426,7 @@ func (p *TSAggregationQueryReq) Write(ctx context.Context, oprot thrift.TProtoco return nil } -func (p *TSAggregationQueryReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -13717,23 +13436,13 @@ func (p *TSAggregationQueryReq) writeField1(ctx context.Context, oprot thrift.TP return err } -func (p *TSAggregationQueryReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statementId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.statementId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statementId: ", p), err) } - return err -} - -func (p *TSAggregationQueryReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:paths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixes", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Prefixes)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Paths { + for _, v := range p.Prefixes { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -13741,159 +13450,98 @@ func (p *TSAggregationQueryReq) writeField3(ctx context.Context, oprot thrift.TP return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:paths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixes: ", p), err) } return err } -func (p *TSAggregationQueryReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "aggregations", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:aggregations: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Aggregations)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Aggregations { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetFetchSize() { + if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:fetchSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.fetchSize (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:fetchSize: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:aggregations: ", p), err) } return err } -func (p *TSAggregationQueryReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetStartTime() { - if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:startTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.StartTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.startTime (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:startTime: ", p), err) } - } - return err -} - -func (p *TSAggregationQueryReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetEndTime() { - if err := oprot.WriteFieldBegin(ctx, "endTime", thrift.I64, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:endTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.EndTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.endTime (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:endTime: ", p), err) } - } - return err -} - -func (p *TSAggregationQueryReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetInterval() { - if err := oprot.WriteFieldBegin(ctx, "interval", thrift.I64, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:interval: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.Interval)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.interval (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:interval: ", p), err) } - } +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:statementId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementId (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:statementId: ", p), err) } return err } -func (p *TSAggregationQueryReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSlidingStep() { - if err := oprot.WriteFieldBegin(ctx, "slidingStep", thrift.I64, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:slidingStep: ", p), err) } - if err := oprot.WriteI64(ctx, int64(*p.SlidingStep)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.slidingStep (8) field write error: ", p), err) } +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetEnableRedirectQuery() { + if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:enableRedirectQuery: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (5) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:slidingStep: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:enableRedirectQuery: ", p), err) } } return err } -func (p *TSAggregationQueryReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetFetchSize() { - if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:fetchSize: ", p), err) } - if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fetchSize (9) field write error: ", p), err) } +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetJdbcQuery() { + if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:jdbcQuery: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.JdbcQuery)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:fetchSize: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:jdbcQuery: ", p), err) } } return err } -func (p *TSAggregationQueryReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSFastLastDataQueryForOnePrefixPathReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTimeout() { - if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:timeout: ", p), err) } + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:timeout: ", p), err) } if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timeout (10) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:timeout: ", p), err) } - } - return err -} - -func (p *TSAggregationQueryReq) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetLegalPathNodes() { - if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 11); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:legalPathNodes: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (11) field write error: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T.timeout (7) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 11:legalPathNodes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:timeout: ", p), err) } } return err } -func (p *TSAggregationQueryReq) Equals(other *TSAggregationQueryReq) bool { +func (p *TSFastLastDataQueryForOnePrefixPathReq) Equals(other *TSFastLastDataQueryForOnePrefixPathReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.StatementId != other.StatementId { return false } - if len(p.Paths) != len(other.Paths) { return false } - for i, _tgt := range p.Paths { - _src152 := other.Paths[i] - if _tgt != _src152 { return false } - } - if len(p.Aggregations) != len(other.Aggregations) { return false } - for i, _tgt := range p.Aggregations { - _src153 := other.Aggregations[i] - if _tgt != _src153 { return false } - } - if p.StartTime != other.StartTime { - if p.StartTime == nil || other.StartTime == nil { - return false - } - if (*p.StartTime) != (*other.StartTime) { return false } - } - if p.EndTime != other.EndTime { - if p.EndTime == nil || other.EndTime == nil { - return false - } - if (*p.EndTime) != (*other.EndTime) { return false } + if len(p.Prefixes) != len(other.Prefixes) { return false } + for i, _tgt := range p.Prefixes { + _src147 := other.Prefixes[i] + if _tgt != _src147 { return false } } - if p.Interval != other.Interval { - if p.Interval == nil || other.Interval == nil { + if p.FetchSize != other.FetchSize { + if p.FetchSize == nil || other.FetchSize == nil { return false } - if (*p.Interval) != (*other.Interval) { return false } + if (*p.FetchSize) != (*other.FetchSize) { return false } } - if p.SlidingStep != other.SlidingStep { - if p.SlidingStep == nil || other.SlidingStep == nil { + if p.StatementId != other.StatementId { return false } + if p.EnableRedirectQuery != other.EnableRedirectQuery { + if p.EnableRedirectQuery == nil || other.EnableRedirectQuery == nil { return false } - if (*p.SlidingStep) != (*other.SlidingStep) { return false } + if (*p.EnableRedirectQuery) != (*other.EnableRedirectQuery) { return false } } - if p.FetchSize != other.FetchSize { - if p.FetchSize == nil || other.FetchSize == nil { + if p.JdbcQuery != other.JdbcQuery { + if p.JdbcQuery == nil || other.JdbcQuery == nil { return false } - if (*p.FetchSize) != (*other.FetchSize) { return false } + if (*p.JdbcQuery) != (*other.JdbcQuery) { return false } } if p.Timeout != other.Timeout { if p.Timeout == nil || other.Timeout == nil { @@ -13901,114 +13549,129 @@ func (p *TSAggregationQueryReq) Equals(other *TSAggregationQueryReq) bool { } if (*p.Timeout) != (*other.Timeout) { return false } } - if p.LegalPathNodes != other.LegalPathNodes { - if p.LegalPathNodes == nil || other.LegalPathNodes == nil { - return false - } - if (*p.LegalPathNodes) != (*other.LegalPathNodes) { return false } - } return true } -func (p *TSAggregationQueryReq) String() string { +func (p *TSFastLastDataQueryForOnePrefixPathReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSAggregationQueryReq(%+v)", *p) + return fmt.Sprintf("TSFastLastDataQueryForOnePrefixPathReq(%+v)", *p) } // Attributes: // - SessionId -// - Paths -// - DataTypes -// - Encodings -// - Compressors -// - PropsList -// - TagsList -// - AttributesList -// - MeasurementAliasList -type TSCreateMultiTimeseriesReq struct { +// - Db +// - DeviceId +// - Sensors +// - FetchSize +// - StatementId +// - EnableRedirectQuery +// - JdbcQuery +// - Timeout +// - LegalPathNodes +type TSFastLastDataQueryForOneDeviceReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` - DataTypes []int32 `thrift:"dataTypes,3,required" db:"dataTypes" json:"dataTypes"` - Encodings []int32 `thrift:"encodings,4,required" db:"encodings" json:"encodings"` - Compressors []int32 `thrift:"compressors,5,required" db:"compressors" json:"compressors"` - PropsList []map[string]string `thrift:"propsList,6" db:"propsList" json:"propsList,omitempty"` - TagsList []map[string]string `thrift:"tagsList,7" db:"tagsList" json:"tagsList,omitempty"` - AttributesList []map[string]string `thrift:"attributesList,8" db:"attributesList" json:"attributesList,omitempty"` - MeasurementAliasList []string `thrift:"measurementAliasList,9" db:"measurementAliasList" json:"measurementAliasList,omitempty"` + Db string `thrift:"db,2,required" db:"db" json:"db"` + DeviceId string `thrift:"deviceId,3,required" db:"deviceId" json:"deviceId"` + Sensors []string `thrift:"sensors,4,required" db:"sensors" json:"sensors"` + FetchSize *int32 `thrift:"fetchSize,5" db:"fetchSize" json:"fetchSize,omitempty"` + StatementId int64 `thrift:"statementId,6,required" db:"statementId" json:"statementId"` + EnableRedirectQuery *bool `thrift:"enableRedirectQuery,7" db:"enableRedirectQuery" json:"enableRedirectQuery,omitempty"` + JdbcQuery *bool `thrift:"jdbcQuery,8" db:"jdbcQuery" json:"jdbcQuery,omitempty"` + Timeout *int64 `thrift:"timeout,9" db:"timeout" json:"timeout,omitempty"` + LegalPathNodes *bool `thrift:"legalPathNodes,10" db:"legalPathNodes" json:"legalPathNodes,omitempty"` } -func NewTSCreateMultiTimeseriesReq() *TSCreateMultiTimeseriesReq { - return &TSCreateMultiTimeseriesReq{} +func NewTSFastLastDataQueryForOneDeviceReq() *TSFastLastDataQueryForOneDeviceReq { + return &TSFastLastDataQueryForOneDeviceReq{} } -func (p *TSCreateMultiTimeseriesReq) GetSessionId() int64 { +func (p *TSFastLastDataQueryForOneDeviceReq) GetSessionId() int64 { return p.SessionId } -func (p *TSCreateMultiTimeseriesReq) GetPaths() []string { - return p.Paths +func (p *TSFastLastDataQueryForOneDeviceReq) GetDb() string { + return p.Db } -func (p *TSCreateMultiTimeseriesReq) GetDataTypes() []int32 { - return p.DataTypes +func (p *TSFastLastDataQueryForOneDeviceReq) GetDeviceId() string { + return p.DeviceId } -func (p *TSCreateMultiTimeseriesReq) GetEncodings() []int32 { - return p.Encodings +func (p *TSFastLastDataQueryForOneDeviceReq) GetSensors() []string { + return p.Sensors } - -func (p *TSCreateMultiTimeseriesReq) GetCompressors() []int32 { - return p.Compressors +var TSFastLastDataQueryForOneDeviceReq_FetchSize_DEFAULT int32 +func (p *TSFastLastDataQueryForOneDeviceReq) GetFetchSize() int32 { + if !p.IsSetFetchSize() { + return TSFastLastDataQueryForOneDeviceReq_FetchSize_DEFAULT + } +return *p.FetchSize } -var TSCreateMultiTimeseriesReq_PropsList_DEFAULT []map[string]string -func (p *TSCreateMultiTimeseriesReq) GetPropsList() []map[string]string { - return p.PropsList +func (p *TSFastLastDataQueryForOneDeviceReq) GetStatementId() int64 { + return p.StatementId } -var TSCreateMultiTimeseriesReq_TagsList_DEFAULT []map[string]string - -func (p *TSCreateMultiTimeseriesReq) GetTagsList() []map[string]string { - return p.TagsList +var TSFastLastDataQueryForOneDeviceReq_EnableRedirectQuery_DEFAULT bool +func (p *TSFastLastDataQueryForOneDeviceReq) GetEnableRedirectQuery() bool { + if !p.IsSetEnableRedirectQuery() { + return TSFastLastDataQueryForOneDeviceReq_EnableRedirectQuery_DEFAULT + } +return *p.EnableRedirectQuery } -var TSCreateMultiTimeseriesReq_AttributesList_DEFAULT []map[string]string - -func (p *TSCreateMultiTimeseriesReq) GetAttributesList() []map[string]string { - return p.AttributesList +var TSFastLastDataQueryForOneDeviceReq_JdbcQuery_DEFAULT bool +func (p *TSFastLastDataQueryForOneDeviceReq) GetJdbcQuery() bool { + if !p.IsSetJdbcQuery() { + return TSFastLastDataQueryForOneDeviceReq_JdbcQuery_DEFAULT + } +return *p.JdbcQuery } -var TSCreateMultiTimeseriesReq_MeasurementAliasList_DEFAULT []string - -func (p *TSCreateMultiTimeseriesReq) GetMeasurementAliasList() []string { - return p.MeasurementAliasList +var TSFastLastDataQueryForOneDeviceReq_Timeout_DEFAULT int64 +func (p *TSFastLastDataQueryForOneDeviceReq) GetTimeout() int64 { + if !p.IsSetTimeout() { + return TSFastLastDataQueryForOneDeviceReq_Timeout_DEFAULT + } +return *p.Timeout } -func (p *TSCreateMultiTimeseriesReq) IsSetPropsList() bool { - return p.PropsList != nil +var TSFastLastDataQueryForOneDeviceReq_LegalPathNodes_DEFAULT bool +func (p *TSFastLastDataQueryForOneDeviceReq) GetLegalPathNodes() bool { + if !p.IsSetLegalPathNodes() { + return TSFastLastDataQueryForOneDeviceReq_LegalPathNodes_DEFAULT + } +return *p.LegalPathNodes +} +func (p *TSFastLastDataQueryForOneDeviceReq) IsSetFetchSize() bool { + return p.FetchSize != nil } -func (p *TSCreateMultiTimeseriesReq) IsSetTagsList() bool { - return p.TagsList != nil +func (p *TSFastLastDataQueryForOneDeviceReq) IsSetEnableRedirectQuery() bool { + return p.EnableRedirectQuery != nil } -func (p *TSCreateMultiTimeseriesReq) IsSetAttributesList() bool { - return p.AttributesList != nil +func (p *TSFastLastDataQueryForOneDeviceReq) IsSetJdbcQuery() bool { + return p.JdbcQuery != nil } -func (p *TSCreateMultiTimeseriesReq) IsSetMeasurementAliasList() bool { - return p.MeasurementAliasList != nil +func (p *TSFastLastDataQueryForOneDeviceReq) IsSetTimeout() bool { + return p.Timeout != nil } -func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOneDeviceReq) IsSetLegalPathNodes() bool { + return p.LegalPathNodes != nil +} + +func (p *TSFastLastDataQueryForOneDeviceReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPaths bool = false; - var issetDataTypes bool = false; - var issetEncodings bool = false; - var issetCompressors bool = false; + var issetDb bool = false; + var issetDeviceId bool = false; + var issetSensors bool = false; + var issetStatementId bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -14029,22 +13692,22 @@ func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TPro } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPaths = true + issetDb = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetDataTypes = true + issetDeviceId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -14055,35 +13718,35 @@ func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TPro if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetEncodings = true + issetSensors = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I32 { if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetCompressors = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField6(ctx, iprot); err != nil { return err } + issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.BOOL { if err := p.ReadField7(ctx, iprot); err != nil { return err } @@ -14093,7 +13756,7 @@ func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TPro } } case 8: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.BOOL { if err := p.ReadField8(ctx, iprot); err != nil { return err } @@ -14103,7 +13766,7 @@ func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TPro } } case 9: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField9(ctx, iprot); err != nil { return err } @@ -14112,6 +13775,16 @@ func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TPro return err } } + case 10: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField10(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -14127,22 +13800,22 @@ func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TPro if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPaths{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); + if !issetDb{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Db is not set")); } - if !issetDataTypes{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataTypes is not set")); + if !issetDeviceId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DeviceId is not set")); } - if !issetEncodings{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); + if !issetSensors{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Sensors is not set")); } - if !issetCompressors{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressors is not set")); + if !issetStatementId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -14151,65 +13824,39 @@ func (p *TSCreateMultiTimeseriesReq) ReadField1(ctx context.Context, iprot thri return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.Paths = tSlice - for i := 0; i < size; i ++ { -var _elem154 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - _elem154 = v + p.Db = v } - p.Paths = append(p.Paths, _elem154) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.DataTypes = tSlice - for i := 0; i < size; i ++ { -var _elem155 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) } else { - _elem155 = v + p.DeviceId = v } - p.DataTypes = append(p.DataTypes, _elem155) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]int32, 0, size) - p.Encodings = tSlice + tSlice := make([]string, 0, size) + p.Sensors = tSlice for i := 0; i < size; i ++ { -var _elem156 int32 - if v, err := iprot.ReadI32(ctx); err != nil { +var _elem148 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem156 = v + _elem148 = v } - p.Encodings = append(p.Encodings, _elem156) + p.Sensors = append(p.Sensors, _elem148) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -14217,172 +13864,62 @@ var _elem156 int32 return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.Compressors = tSlice - for i := 0; i < size; i ++ { -var _elem157 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) } else { - _elem157 = v + p.FetchSize = &v } - p.Compressors = append(p.Compressors, _elem157) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]map[string]string, 0, size) - p.PropsList = tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem158 := tMap - for i := 0; i < size; i ++ { -var _key159 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key159 = v -} -var _val160 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { - _val160 = v + p.StatementId = v } - _elem158[_key159] = _val160 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.PropsList = append(p.PropsList, _elem158) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]map[string]string, 0, size) - p.TagsList = tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem161 := tMap - for i := 0; i < size; i ++ { -var _key162 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) } else { - _key162 = v + p.EnableRedirectQuery = &v } -var _val163 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) + return nil +} + +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 8: ", err) } else { - _val163 = v + p.JdbcQuery = &v } - _elem161[_key162] = _val163 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.TagsList = append(p.TagsList, _elem161) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]map[string]string, 0, size) - p.AttributesList = tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin(ctx) - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem164 := tMap - for i := 0; i < size; i ++ { -var _key165 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 9: ", err) } else { - _key165 = v + p.Timeout = &v } -var _val166 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _val166 = v -} - _elem164[_key165] = _val166 - } - if err := iprot.ReadMapEnd(ctx); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.AttributesList = append(p.AttributesList, _elem164) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.MeasurementAliasList = tSlice - for i := 0; i < size; i ++ { -var _elem167 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 10: ", err) } else { - _elem167 = v + p.LegalPathNodes = &v } - p.MeasurementAliasList = append(p.MeasurementAliasList, _elem167) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TSCreateMultiTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSCreateMultiTimeseriesReq"); err != nil { +func (p *TSFastLastDataQueryForOneDeviceReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSFastLastDataQueryForOneDeviceReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -14394,6 +13931,7 @@ func (p *TSCreateMultiTimeseriesReq) Write(ctx context.Context, oprot thrift.TPr if err := p.writeField7(ctx, oprot); err != nil { return err } if err := p.writeField8(ctx, oprot); err != nil { return err } if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -14402,7 +13940,7 @@ func (p *TSCreateMultiTimeseriesReq) Write(ctx context.Context, oprot thrift.TPr return nil } -func (p *TSCreateMultiTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSFastLastDataQueryForOneDeviceReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -14412,349 +13950,301 @@ func (p *TSCreateMultiTimeseriesReq) writeField1(ctx context.Context, oprot thri return err } -func (p *TSCreateMultiTimeseriesReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Paths { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSFastLastDataQueryForOneDeviceReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "db", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:db: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Db)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.db (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:db: ", p), err) } return err } -func (p *TSCreateMultiTimeseriesReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "dataTypes", thrift.LIST, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:dataTypes: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.DataTypes)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.DataTypes { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSFastLastDataQueryForOneDeviceReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "deviceId", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:deviceId: ", p), err) } + if err := oprot.WriteString(ctx, string(p.DeviceId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.deviceId (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:dataTypes: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:deviceId: ", p), err) } return err } -func (p *TSCreateMultiTimeseriesReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:encodings: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { +func (p *TSFastLastDataQueryForOneDeviceReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sensors", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:sensors: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Sensors)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.Encodings { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { + for _, v := range p.Sensors { + if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:encodings: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:sensors: ", p), err) } return err } -func (p *TSCreateMultiTimeseriesReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "compressors", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:compressors: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Compressors)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Compressors { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSFastLastDataQueryForOneDeviceReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetFetchSize() { + if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:fetchSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.fetchSize (5) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:fetchSize: ", p), err) } } + return err +} + +func (p *TSFastLastDataQueryForOneDeviceReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:statementId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementId (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:compressors: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:statementId: ", p), err) } return err } -func (p *TSCreateMultiTimeseriesReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetPropsList() { - if err := oprot.WriteFieldBegin(ctx, "propsList", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:propsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.PropsList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.PropsList { - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSFastLastDataQueryForOneDeviceReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetEnableRedirectQuery() { + if err := oprot.WriteFieldBegin(ctx, "enableRedirectQuery", thrift.BOOL, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:enableRedirectQuery: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.EnableRedirectQuery)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.enableRedirectQuery (7) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:propsList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:enableRedirectQuery: ", p), err) } } return err } -func (p *TSCreateMultiTimeseriesReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTagsList() { - if err := oprot.WriteFieldBegin(ctx, "tagsList", thrift.LIST, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:tagsList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.TagsList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.TagsList { - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSFastLastDataQueryForOneDeviceReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetJdbcQuery() { + if err := oprot.WriteFieldBegin(ctx, "jdbcQuery", thrift.BOOL, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:jdbcQuery: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.JdbcQuery)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.jdbcQuery (8) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:tagsList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:jdbcQuery: ", p), err) } } return err } -func (p *TSCreateMultiTimeseriesReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetAttributesList() { - if err := oprot.WriteFieldBegin(ctx, "attributesList", thrift.LIST, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:attributesList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.AttributesList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.AttributesList { - if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(ctx, string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(ctx); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSFastLastDataQueryForOneDeviceReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTimeout() { + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:timeout: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeout (9) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:attributesList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:timeout: ", p), err) } } return err } -func (p *TSCreateMultiTimeseriesReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMeasurementAliasList() { - if err := oprot.WriteFieldBegin(ctx, "measurementAliasList", thrift.LIST, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:measurementAliasList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MeasurementAliasList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.MeasurementAliasList { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSFastLastDataQueryForOneDeviceReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetLegalPathNodes() { + if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 10); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:legalPathNodes: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (10) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:measurementAliasList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 10:legalPathNodes: ", p), err) } } return err } -func (p *TSCreateMultiTimeseriesReq) Equals(other *TSCreateMultiTimeseriesReq) bool { +func (p *TSFastLastDataQueryForOneDeviceReq) Equals(other *TSFastLastDataQueryForOneDeviceReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.Paths) != len(other.Paths) { return false } - for i, _tgt := range p.Paths { - _src168 := other.Paths[i] - if _tgt != _src168 { return false } + if p.Db != other.Db { return false } + if p.DeviceId != other.DeviceId { return false } + if len(p.Sensors) != len(other.Sensors) { return false } + for i, _tgt := range p.Sensors { + _src149 := other.Sensors[i] + if _tgt != _src149 { return false } } - if len(p.DataTypes) != len(other.DataTypes) { return false } - for i, _tgt := range p.DataTypes { - _src169 := other.DataTypes[i] - if _tgt != _src169 { return false } - } - if len(p.Encodings) != len(other.Encodings) { return false } - for i, _tgt := range p.Encodings { - _src170 := other.Encodings[i] - if _tgt != _src170 { return false } - } - if len(p.Compressors) != len(other.Compressors) { return false } - for i, _tgt := range p.Compressors { - _src171 := other.Compressors[i] - if _tgt != _src171 { return false } + if p.FetchSize != other.FetchSize { + if p.FetchSize == nil || other.FetchSize == nil { + return false + } + if (*p.FetchSize) != (*other.FetchSize) { return false } } - if len(p.PropsList) != len(other.PropsList) { return false } - for i, _tgt := range p.PropsList { - _src172 := other.PropsList[i] - if len(_tgt) != len(_src172) { return false } - for k, _tgt := range _tgt { - _src173 := _src172[k] - if _tgt != _src173 { return false } + if p.StatementId != other.StatementId { return false } + if p.EnableRedirectQuery != other.EnableRedirectQuery { + if p.EnableRedirectQuery == nil || other.EnableRedirectQuery == nil { + return false } + if (*p.EnableRedirectQuery) != (*other.EnableRedirectQuery) { return false } } - if len(p.TagsList) != len(other.TagsList) { return false } - for i, _tgt := range p.TagsList { - _src174 := other.TagsList[i] - if len(_tgt) != len(_src174) { return false } - for k, _tgt := range _tgt { - _src175 := _src174[k] - if _tgt != _src175 { return false } + if p.JdbcQuery != other.JdbcQuery { + if p.JdbcQuery == nil || other.JdbcQuery == nil { + return false } + if (*p.JdbcQuery) != (*other.JdbcQuery) { return false } } - if len(p.AttributesList) != len(other.AttributesList) { return false } - for i, _tgt := range p.AttributesList { - _src176 := other.AttributesList[i] - if len(_tgt) != len(_src176) { return false } - for k, _tgt := range _tgt { - _src177 := _src176[k] - if _tgt != _src177 { return false } + if p.Timeout != other.Timeout { + if p.Timeout == nil || other.Timeout == nil { + return false } + if (*p.Timeout) != (*other.Timeout) { return false } } - if len(p.MeasurementAliasList) != len(other.MeasurementAliasList) { return false } - for i, _tgt := range p.MeasurementAliasList { - _src178 := other.MeasurementAliasList[i] - if _tgt != _src178 { return false } + if p.LegalPathNodes != other.LegalPathNodes { + if p.LegalPathNodes == nil || other.LegalPathNodes == nil { + return false + } + if (*p.LegalPathNodes) != (*other.LegalPathNodes) { return false } } return true } -func (p *TSCreateMultiTimeseriesReq) String() string { +func (p *TSFastLastDataQueryForOneDeviceReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSCreateMultiTimeseriesReq(%+v)", *p) + return fmt.Sprintf("TSFastLastDataQueryForOneDeviceReq(%+v)", *p) } // Attributes: -// - Version -// - SupportedTimeAggregationOperations -// - TimestampPrecision -// - MaxConcurrentClientNum -// - ThriftMaxFrameSize -// - IsReadOnly -// - BuildInfo -// - Logo -type ServerProperties struct { - Version string `thrift:"version,1,required" db:"version" json:"version"` - SupportedTimeAggregationOperations []string `thrift:"supportedTimeAggregationOperations,2,required" db:"supportedTimeAggregationOperations" json:"supportedTimeAggregationOperations"` - TimestampPrecision string `thrift:"timestampPrecision,3,required" db:"timestampPrecision" json:"timestampPrecision"` - MaxConcurrentClientNum int32 `thrift:"maxConcurrentClientNum,4" db:"maxConcurrentClientNum" json:"maxConcurrentClientNum"` - ThriftMaxFrameSize *int32 `thrift:"thriftMaxFrameSize,5" db:"thriftMaxFrameSize" json:"thriftMaxFrameSize,omitempty"` - IsReadOnly *bool `thrift:"isReadOnly,6" db:"isReadOnly" json:"isReadOnly,omitempty"` - BuildInfo *string `thrift:"buildInfo,7" db:"buildInfo" json:"buildInfo,omitempty"` - Logo *string `thrift:"logo,8" db:"logo" json:"logo,omitempty"` +// - SessionId +// - StatementId +// - Paths +// - Aggregations +// - StartTime +// - EndTime +// - Interval +// - SlidingStep +// - FetchSize +// - Timeout +// - LegalPathNodes +type TSAggregationQueryReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + StatementId int64 `thrift:"statementId,2,required" db:"statementId" json:"statementId"` + Paths []string `thrift:"paths,3,required" db:"paths" json:"paths"` + Aggregations []common.TAggregationType `thrift:"aggregations,4,required" db:"aggregations" json:"aggregations"` + StartTime *int64 `thrift:"startTime,5" db:"startTime" json:"startTime,omitempty"` + EndTime *int64 `thrift:"endTime,6" db:"endTime" json:"endTime,omitempty"` + Interval *int64 `thrift:"interval,7" db:"interval" json:"interval,omitempty"` + SlidingStep *int64 `thrift:"slidingStep,8" db:"slidingStep" json:"slidingStep,omitempty"` + FetchSize *int32 `thrift:"fetchSize,9" db:"fetchSize" json:"fetchSize,omitempty"` + Timeout *int64 `thrift:"timeout,10" db:"timeout" json:"timeout,omitempty"` + LegalPathNodes *bool `thrift:"legalPathNodes,11" db:"legalPathNodes" json:"legalPathNodes,omitempty"` } -func NewServerProperties() *ServerProperties { - return &ServerProperties{} +func NewTSAggregationQueryReq() *TSAggregationQueryReq { + return &TSAggregationQueryReq{} } -func (p *ServerProperties) GetVersion() string { - return p.Version +func (p *TSAggregationQueryReq) GetSessionId() int64 { + return p.SessionId } -func (p *ServerProperties) GetSupportedTimeAggregationOperations() []string { - return p.SupportedTimeAggregationOperations +func (p *TSAggregationQueryReq) GetStatementId() int64 { + return p.StatementId } -func (p *ServerProperties) GetTimestampPrecision() string { - return p.TimestampPrecision +func (p *TSAggregationQueryReq) GetPaths() []string { + return p.Paths } -func (p *ServerProperties) GetMaxConcurrentClientNum() int32 { - return p.MaxConcurrentClientNum +func (p *TSAggregationQueryReq) GetAggregations() []common.TAggregationType { + return p.Aggregations } -var ServerProperties_ThriftMaxFrameSize_DEFAULT int32 -func (p *ServerProperties) GetThriftMaxFrameSize() int32 { - if !p.IsSetThriftMaxFrameSize() { - return ServerProperties_ThriftMaxFrameSize_DEFAULT +var TSAggregationQueryReq_StartTime_DEFAULT int64 +func (p *TSAggregationQueryReq) GetStartTime() int64 { + if !p.IsSetStartTime() { + return TSAggregationQueryReq_StartTime_DEFAULT } -return *p.ThriftMaxFrameSize +return *p.StartTime } -var ServerProperties_IsReadOnly_DEFAULT bool -func (p *ServerProperties) GetIsReadOnly() bool { - if !p.IsSetIsReadOnly() { - return ServerProperties_IsReadOnly_DEFAULT +var TSAggregationQueryReq_EndTime_DEFAULT int64 +func (p *TSAggregationQueryReq) GetEndTime() int64 { + if !p.IsSetEndTime() { + return TSAggregationQueryReq_EndTime_DEFAULT } -return *p.IsReadOnly +return *p.EndTime } -var ServerProperties_BuildInfo_DEFAULT string -func (p *ServerProperties) GetBuildInfo() string { - if !p.IsSetBuildInfo() { - return ServerProperties_BuildInfo_DEFAULT +var TSAggregationQueryReq_Interval_DEFAULT int64 +func (p *TSAggregationQueryReq) GetInterval() int64 { + if !p.IsSetInterval() { + return TSAggregationQueryReq_Interval_DEFAULT } -return *p.BuildInfo +return *p.Interval } -var ServerProperties_Logo_DEFAULT string -func (p *ServerProperties) GetLogo() string { - if !p.IsSetLogo() { - return ServerProperties_Logo_DEFAULT +var TSAggregationQueryReq_SlidingStep_DEFAULT int64 +func (p *TSAggregationQueryReq) GetSlidingStep() int64 { + if !p.IsSetSlidingStep() { + return TSAggregationQueryReq_SlidingStep_DEFAULT } -return *p.Logo +return *p.SlidingStep } -func (p *ServerProperties) IsSetThriftMaxFrameSize() bool { - return p.ThriftMaxFrameSize != nil +var TSAggregationQueryReq_FetchSize_DEFAULT int32 +func (p *TSAggregationQueryReq) GetFetchSize() int32 { + if !p.IsSetFetchSize() { + return TSAggregationQueryReq_FetchSize_DEFAULT + } +return *p.FetchSize +} +var TSAggregationQueryReq_Timeout_DEFAULT int64 +func (p *TSAggregationQueryReq) GetTimeout() int64 { + if !p.IsSetTimeout() { + return TSAggregationQueryReq_Timeout_DEFAULT + } +return *p.Timeout +} +var TSAggregationQueryReq_LegalPathNodes_DEFAULT bool +func (p *TSAggregationQueryReq) GetLegalPathNodes() bool { + if !p.IsSetLegalPathNodes() { + return TSAggregationQueryReq_LegalPathNodes_DEFAULT + } +return *p.LegalPathNodes +} +func (p *TSAggregationQueryReq) IsSetStartTime() bool { + return p.StartTime != nil } -func (p *ServerProperties) IsSetIsReadOnly() bool { - return p.IsReadOnly != nil +func (p *TSAggregationQueryReq) IsSetEndTime() bool { + return p.EndTime != nil } -func (p *ServerProperties) IsSetBuildInfo() bool { - return p.BuildInfo != nil +func (p *TSAggregationQueryReq) IsSetInterval() bool { + return p.Interval != nil } -func (p *ServerProperties) IsSetLogo() bool { - return p.Logo != nil +func (p *TSAggregationQueryReq) IsSetSlidingStep() bool { + return p.SlidingStep != nil } -func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSAggregationQueryReq) IsSetFetchSize() bool { + return p.FetchSize != nil +} + +func (p *TSAggregationQueryReq) IsSetTimeout() bool { + return p.Timeout != nil +} + +func (p *TSAggregationQueryReq) IsSetLegalPathNodes() bool { + return p.LegalPathNodes != nil +} + +func (p *TSAggregationQueryReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetVersion bool = false; - var issetSupportedTimeAggregationOperations bool = false; - var issetTimestampPrecision bool = false; + var issetSessionId bool = false; + var issetStatementId bool = false; + var issetPaths bool = false; + var issetAggregations bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -14764,50 +14254,51 @@ func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) err if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetVersion = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.I64 { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetSupportedTimeAggregationOperations = true + issetStatementId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetTimestampPrecision = true + issetPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.LIST { if err := p.ReadField4(ctx, iprot); err != nil { return err } + issetAggregations = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.I64 { if err := p.ReadField5(ctx, iprot); err != nil { return err } @@ -14817,7 +14308,7 @@ func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) err } } case 6: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.I64 { if err := p.ReadField6(ctx, iprot); err != nil { return err } @@ -14827,7 +14318,7 @@ func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) err } } case 7: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I64 { if err := p.ReadField7(ctx, iprot); err != nil { return err } @@ -14837,7 +14328,7 @@ func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) err } } case 8: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I64 { if err := p.ReadField8(ctx, iprot); err != nil { return err } @@ -14846,54 +14337,96 @@ func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) err return err } } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } + case 9: + if fieldTypeId == thrift.I32 { + if err := p.ReadField9(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 10: + if fieldTypeId == thrift.I64 { + if err := p.ReadField10(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 11: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField11(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetVersion{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetSupportedTimeAggregationOperations{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SupportedTimeAggregationOperations is not set")); + if !issetStatementId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StatementId is not set")); } - if !issetTimestampPrecision{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimestampPrecision is not set")); + if !issetPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); + } + if !issetAggregations{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Aggregations is not set")); } return nil } -func (p *ServerProperties) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TSAggregationQueryReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - p.Version = v + p.SessionId = v } return nil } -func (p *ServerProperties) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSAggregationQueryReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.StatementId = v +} + return nil +} + +func (p *TSAggregationQueryReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]string, 0, size) - p.SupportedTimeAggregationOperations = tSlice + p.Paths = tSlice for i := 0; i < size; i ++ { -var _elem179 string +var _elem150 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem179 = v + _elem150 = v } - p.SupportedTimeAggregationOperations = append(p.SupportedTimeAggregationOperations, _elem179) + p.Paths = append(p.Paths, _elem150) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -14901,62 +14434,94 @@ var _elem179 string return nil } -func (p *ServerProperties) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) +func (p *TSAggregationQueryReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]common.TAggregationType, 0, size) + p.Aggregations = tSlice + for i := 0; i < size; i ++ { +var _elem151 common.TAggregationType + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.TimestampPrecision = v + temp := common.TAggregationType(v) + _elem151 = temp } + p.Aggregations = append(p.Aggregations, _elem151) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *ServerProperties) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) +func (p *TSAggregationQueryReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) } else { - p.MaxConcurrentClientNum = v + p.StartTime = &v } return nil } -func (p *ServerProperties) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) +func (p *TSAggregationQueryReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) } else { - p.ThriftMaxFrameSize = &v + p.EndTime = &v } return nil } -func (p *ServerProperties) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) +func (p *TSAggregationQueryReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) } else { - p.IsReadOnly = &v + p.Interval = &v } return nil } -func (p *ServerProperties) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) +func (p *TSAggregationQueryReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 8: ", err) } else { - p.BuildInfo = &v + p.SlidingStep = &v } return nil } -func (p *ServerProperties) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) +func (p *TSAggregationQueryReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 9: ", err) } else { - p.Logo = &v + p.FetchSize = &v } return nil } -func (p *ServerProperties) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "ServerProperties"); err != nil { +func (p *TSAggregationQueryReq) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 10: ", err) +} else { + p.Timeout = &v +} + return nil +} + +func (p *TSAggregationQueryReq) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 11: ", err) +} else { + p.LegalPathNodes = &v +} + return nil +} + +func (p *TSAggregationQueryReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSAggregationQueryReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -14967,6 +14532,9 @@ func (p *ServerProperties) Write(ctx context.Context, oprot thrift.TProtocol) er if err := p.writeField6(ctx, oprot); err != nil { return err } if err := p.writeField7(ctx, oprot); err != nil { return err } if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -14975,23 +14543,33 @@ func (p *ServerProperties) Write(ctx context.Context, oprot thrift.TProtocol) er return nil } -func (p *ServerProperties) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "version", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Version)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } +func (p *TSAggregationQueryReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *ServerProperties) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "supportedTimeAggregationOperations", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:supportedTimeAggregationOperations: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.SupportedTimeAggregationOperations)); err != nil { +func (p *TSAggregationQueryReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statementId", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statementId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StatementId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statementId (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statementId: ", p), err) } + return err +} + +func (p *TSAggregationQueryReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:paths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { return thrift.PrependError("error writing list begin: ", err) } - for _, v := range p.SupportedTimeAggregationOperations { + for _, v := range p.Paths { if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } @@ -14999,160 +14577,274 @@ func (p *ServerProperties) writeField2(ctx context.Context, oprot thrift.TProtoc return thrift.PrependError("error writing list end: ", err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:supportedTimeAggregationOperations: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:paths: ", p), err) } return err } -func (p *ServerProperties) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestampPrecision", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:timestampPrecision: ", p), err) } - if err := oprot.WriteString(ctx, string(p.TimestampPrecision)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestampPrecision (3) field write error: ", p), err) } +func (p *TSAggregationQueryReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "aggregations", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:aggregations: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Aggregations)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Aggregations { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:timestampPrecision: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:aggregations: ", p), err) } return err } -func (p *ServerProperties) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "maxConcurrentClientNum", thrift.I32, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:maxConcurrentClientNum: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.MaxConcurrentClientNum)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.maxConcurrentClientNum (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:maxConcurrentClientNum: ", p), err) } +func (p *TSAggregationQueryReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetStartTime() { + if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:startTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.StartTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.startTime (5) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:startTime: ", p), err) } + } return err } -func (p *ServerProperties) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetThriftMaxFrameSize() { - if err := oprot.WriteFieldBegin(ctx, "thriftMaxFrameSize", thrift.I32, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:thriftMaxFrameSize: ", p), err) } - if err := oprot.WriteI32(ctx, int32(*p.ThriftMaxFrameSize)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.thriftMaxFrameSize (5) field write error: ", p), err) } +func (p *TSAggregationQueryReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetEndTime() { + if err := oprot.WriteFieldBegin(ctx, "endTime", thrift.I64, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:endTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.EndTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.endTime (6) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:thriftMaxFrameSize: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:endTime: ", p), err) } } return err } -func (p *ServerProperties) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIsReadOnly() { - if err := oprot.WriteFieldBegin(ctx, "isReadOnly", thrift.BOOL, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isReadOnly: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.IsReadOnly)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isReadOnly (6) field write error: ", p), err) } +func (p *TSAggregationQueryReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetInterval() { + if err := oprot.WriteFieldBegin(ctx, "interval", thrift.I64, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:interval: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.Interval)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.interval (7) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isReadOnly: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:interval: ", p), err) } } return err } -func (p *ServerProperties) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetBuildInfo() { - if err := oprot.WriteFieldBegin(ctx, "buildInfo", thrift.STRING, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:buildInfo: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.BuildInfo)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.buildInfo (7) field write error: ", p), err) } +func (p *TSAggregationQueryReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetSlidingStep() { + if err := oprot.WriteFieldBegin(ctx, "slidingStep", thrift.I64, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:slidingStep: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.SlidingStep)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.slidingStep (8) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:buildInfo: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:slidingStep: ", p), err) } } return err } -func (p *ServerProperties) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetLogo() { - if err := oprot.WriteFieldBegin(ctx, "logo", thrift.STRING, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:logo: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.Logo)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.logo (8) field write error: ", p), err) } +func (p *TSAggregationQueryReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetFetchSize() { + if err := oprot.WriteFieldBegin(ctx, "fetchSize", thrift.I32, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:fetchSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.FetchSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.fetchSize (9) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:logo: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:fetchSize: ", p), err) } } return err } -func (p *ServerProperties) Equals(other *ServerProperties) bool { +func (p *TSAggregationQueryReq) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTimeout() { + if err := oprot.WriteFieldBegin(ctx, "timeout", thrift.I64, 10); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:timeout: ", p), err) } + if err := oprot.WriteI64(ctx, int64(*p.Timeout)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timeout (10) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 10:timeout: ", p), err) } + } + return err +} + +func (p *TSAggregationQueryReq) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetLegalPathNodes() { + if err := oprot.WriteFieldBegin(ctx, "legalPathNodes", thrift.BOOL, 11); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:legalPathNodes: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.LegalPathNodes)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.legalPathNodes (11) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 11:legalPathNodes: ", p), err) } + } + return err +} + +func (p *TSAggregationQueryReq) Equals(other *TSAggregationQueryReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.Version != other.Version { return false } - if len(p.SupportedTimeAggregationOperations) != len(other.SupportedTimeAggregationOperations) { return false } - for i, _tgt := range p.SupportedTimeAggregationOperations { - _src180 := other.SupportedTimeAggregationOperations[i] - if _tgt != _src180 { return false } + if p.SessionId != other.SessionId { return false } + if p.StatementId != other.StatementId { return false } + if len(p.Paths) != len(other.Paths) { return false } + for i, _tgt := range p.Paths { + _src152 := other.Paths[i] + if _tgt != _src152 { return false } } - if p.TimestampPrecision != other.TimestampPrecision { return false } - if p.MaxConcurrentClientNum != other.MaxConcurrentClientNum { return false } - if p.ThriftMaxFrameSize != other.ThriftMaxFrameSize { - if p.ThriftMaxFrameSize == nil || other.ThriftMaxFrameSize == nil { + if len(p.Aggregations) != len(other.Aggregations) { return false } + for i, _tgt := range p.Aggregations { + _src153 := other.Aggregations[i] + if _tgt != _src153 { return false } + } + if p.StartTime != other.StartTime { + if p.StartTime == nil || other.StartTime == nil { return false } - if (*p.ThriftMaxFrameSize) != (*other.ThriftMaxFrameSize) { return false } + if (*p.StartTime) != (*other.StartTime) { return false } } - if p.IsReadOnly != other.IsReadOnly { - if p.IsReadOnly == nil || other.IsReadOnly == nil { + if p.EndTime != other.EndTime { + if p.EndTime == nil || other.EndTime == nil { return false } - if (*p.IsReadOnly) != (*other.IsReadOnly) { return false } + if (*p.EndTime) != (*other.EndTime) { return false } } - if p.BuildInfo != other.BuildInfo { - if p.BuildInfo == nil || other.BuildInfo == nil { + if p.Interval != other.Interval { + if p.Interval == nil || other.Interval == nil { return false } - if (*p.BuildInfo) != (*other.BuildInfo) { return false } + if (*p.Interval) != (*other.Interval) { return false } } - if p.Logo != other.Logo { - if p.Logo == nil || other.Logo == nil { + if p.SlidingStep != other.SlidingStep { + if p.SlidingStep == nil || other.SlidingStep == nil { return false } - if (*p.Logo) != (*other.Logo) { return false } + if (*p.SlidingStep) != (*other.SlidingStep) { return false } + } + if p.FetchSize != other.FetchSize { + if p.FetchSize == nil || other.FetchSize == nil { + return false + } + if (*p.FetchSize) != (*other.FetchSize) { return false } + } + if p.Timeout != other.Timeout { + if p.Timeout == nil || other.Timeout == nil { + return false + } + if (*p.Timeout) != (*other.Timeout) { return false } + } + if p.LegalPathNodes != other.LegalPathNodes { + if p.LegalPathNodes == nil || other.LegalPathNodes == nil { + return false + } + if (*p.LegalPathNodes) != (*other.LegalPathNodes) { return false } } return true } -func (p *ServerProperties) String() string { +func (p *TSAggregationQueryReq) String() string { if p == nil { return "" } - return fmt.Sprintf("ServerProperties(%+v)", *p) + return fmt.Sprintf("TSAggregationQueryReq(%+v)", *p) } // Attributes: // - SessionId -// - TemplateName -// - PrefixPath -type TSSetSchemaTemplateReq struct { +// - Paths +// - DataTypes +// - Encodings +// - Compressors +// - PropsList +// - TagsList +// - AttributesList +// - MeasurementAliasList +type TSCreateMultiTimeseriesReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - TemplateName string `thrift:"templateName,2,required" db:"templateName" json:"templateName"` - PrefixPath string `thrift:"prefixPath,3,required" db:"prefixPath" json:"prefixPath"` + Paths []string `thrift:"paths,2,required" db:"paths" json:"paths"` + DataTypes []int32 `thrift:"dataTypes,3,required" db:"dataTypes" json:"dataTypes"` + Encodings []int32 `thrift:"encodings,4,required" db:"encodings" json:"encodings"` + Compressors []int32 `thrift:"compressors,5,required" db:"compressors" json:"compressors"` + PropsList []map[string]string `thrift:"propsList,6" db:"propsList" json:"propsList,omitempty"` + TagsList []map[string]string `thrift:"tagsList,7" db:"tagsList" json:"tagsList,omitempty"` + AttributesList []map[string]string `thrift:"attributesList,8" db:"attributesList" json:"attributesList,omitempty"` + MeasurementAliasList []string `thrift:"measurementAliasList,9" db:"measurementAliasList" json:"measurementAliasList,omitempty"` } -func NewTSSetSchemaTemplateReq() *TSSetSchemaTemplateReq { - return &TSSetSchemaTemplateReq{} +func NewTSCreateMultiTimeseriesReq() *TSCreateMultiTimeseriesReq { + return &TSCreateMultiTimeseriesReq{} } -func (p *TSSetSchemaTemplateReq) GetSessionId() int64 { +func (p *TSCreateMultiTimeseriesReq) GetSessionId() int64 { return p.SessionId } -func (p *TSSetSchemaTemplateReq) GetTemplateName() string { - return p.TemplateName +func (p *TSCreateMultiTimeseriesReq) GetPaths() []string { + return p.Paths } -func (p *TSSetSchemaTemplateReq) GetPrefixPath() string { - return p.PrefixPath +func (p *TSCreateMultiTimeseriesReq) GetDataTypes() []int32 { + return p.DataTypes } -func (p *TSSetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + +func (p *TSCreateMultiTimeseriesReq) GetEncodings() []int32 { + return p.Encodings +} + +func (p *TSCreateMultiTimeseriesReq) GetCompressors() []int32 { + return p.Compressors +} +var TSCreateMultiTimeseriesReq_PropsList_DEFAULT []map[string]string + +func (p *TSCreateMultiTimeseriesReq) GetPropsList() []map[string]string { + return p.PropsList +} +var TSCreateMultiTimeseriesReq_TagsList_DEFAULT []map[string]string + +func (p *TSCreateMultiTimeseriesReq) GetTagsList() []map[string]string { + return p.TagsList +} +var TSCreateMultiTimeseriesReq_AttributesList_DEFAULT []map[string]string + +func (p *TSCreateMultiTimeseriesReq) GetAttributesList() []map[string]string { + return p.AttributesList +} +var TSCreateMultiTimeseriesReq_MeasurementAliasList_DEFAULT []string + +func (p *TSCreateMultiTimeseriesReq) GetMeasurementAliasList() []string { + return p.MeasurementAliasList +} +func (p *TSCreateMultiTimeseriesReq) IsSetPropsList() bool { + return p.PropsList != nil +} + +func (p *TSCreateMultiTimeseriesReq) IsSetTagsList() bool { + return p.TagsList != nil +} + +func (p *TSCreateMultiTimeseriesReq) IsSetAttributesList() bool { + return p.AttributesList != nil +} + +func (p *TSCreateMultiTimeseriesReq) IsSetMeasurementAliasList() bool { + return p.MeasurementAliasList != nil +} + +func (p *TSCreateMultiTimeseriesReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetTemplateName bool = false; - var issetPrefixPath bool = false; + var issetPaths bool = false; + var issetDataTypes bool = false; + var issetEncodings bool = false; + var issetCompressors bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -15173,212 +14865,84 @@ func (p *TSSetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtoco } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetTemplateName = true + issetPaths = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetPrefixPath = true + issetDataTypes = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err + case 4: + if fieldTypeId == thrift.LIST { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + issetEncodings = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetSessionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); - } - if !issetTemplateName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TemplateName is not set")); - } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); - } - return nil -} - -func (p *TSSetSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.SessionId = v -} - return nil -} - -func (p *TSSetSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.TemplateName = v -} - return nil -} - -func (p *TSSetSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.PrefixPath = v -} - return nil -} - -func (p *TSSetSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSSetSchemaTemplateReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil -} - -func (p *TSSetSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } - return err -} - -func (p *TSSetSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "templateName", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:templateName: ", p), err) } - if err := oprot.WriteString(ctx, string(p.TemplateName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.templateName (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:templateName: ", p), err) } - return err -} - -func (p *TSSetSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:prefixPath: ", p), err) } - return err -} - -func (p *TSSetSchemaTemplateReq) Equals(other *TSSetSchemaTemplateReq) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.SessionId != other.SessionId { return false } - if p.TemplateName != other.TemplateName { return false } - if p.PrefixPath != other.PrefixPath { return false } - return true -} - -func (p *TSSetSchemaTemplateReq) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TSSetSchemaTemplateReq(%+v)", *p) -} - -// Attributes: -// - SessionId -// - Name -// - SerializedTemplate -type TSCreateSchemaTemplateReq struct { - SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Name string `thrift:"name,2,required" db:"name" json:"name"` - SerializedTemplate []byte `thrift:"serializedTemplate,3,required" db:"serializedTemplate" json:"serializedTemplate"` -} - -func NewTSCreateSchemaTemplateReq() *TSCreateSchemaTemplateReq { - return &TSCreateSchemaTemplateReq{} -} - - -func (p *TSCreateSchemaTemplateReq) GetSessionId() int64 { - return p.SessionId -} - -func (p *TSCreateSchemaTemplateReq) GetName() string { - return p.Name -} - -func (p *TSCreateSchemaTemplateReq) GetSerializedTemplate() []byte { - return p.SerializedTemplate -} -func (p *TSCreateSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetSessionId bool = false; - var issetName bool = false; - var issetSerializedTemplate bool = false; - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { + case 5: + if fieldTypeId == thrift.LIST { + if err := p.ReadField5(ctx, iprot); err != nil { return err } - issetSessionId = true + issetCompressors = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(ctx, iprot); err != nil { + case 6: + if fieldTypeId == thrift.LIST { + if err := p.ReadField6(ctx, iprot); err != nil { return err } - issetName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { + case 7: + if fieldTypeId == thrift.LIST { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 8: + if fieldTypeId == thrift.LIST { + if err := p.ReadField8(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 9: + if fieldTypeId == thrift.LIST { + if err := p.ReadField9(ctx, iprot); err != nil { return err } - issetSerializedTemplate = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -15399,16 +14963,22 @@ func (p *TSCreateSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProt if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); + if !issetPaths{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Paths is not set")); } - if !issetSerializedTemplate{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SerializedTemplate is not set")); + if !issetDataTypes{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataTypes is not set")); + } + if !issetEncodings{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); + } + if !issetCompressors{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressors is not set")); } return nil } -func (p *TSCreateSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateMultiTimeseriesReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -15417,580 +14987,610 @@ func (p *TSCreateSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrif return nil } -func (p *TSCreateSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *TSCreateMultiTimeseriesReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.Paths = tSlice + for i := 0; i < size; i ++ { +var _elem154 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.Name = v + _elem154 = v } + p.Paths = append(p.Paths, _elem154) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSCreateSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) +func (p *TSCreateMultiTimeseriesReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.DataTypes = tSlice + for i := 0; i < size; i ++ { +var _elem155 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.SerializedTemplate = v + _elem155 = v } + p.DataTypes = append(p.DataTypes, _elem155) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSCreateSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSCreateSchemaTemplateReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } +func (p *TSCreateMultiTimeseriesReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + tSlice := make([]int32, 0, size) + p.Encodings = tSlice + for i := 0; i < size; i ++ { +var _elem156 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem156 = v } - -func (p *TSCreateSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } - return err + p.Encodings = append(p.Encodings, _elem156) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } -func (p *TSCreateSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } - return err +func (p *TSCreateMultiTimeseriesReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.Compressors = tSlice + for i := 0; i < size; i ++ { +var _elem157 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem157 = v } - -func (p *TSCreateSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "serializedTemplate", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:serializedTemplate: ", p), err) } - if err := oprot.WriteBinary(ctx, p.SerializedTemplate); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.serializedTemplate (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:serializedTemplate: ", p), err) } - return err + p.Compressors = append(p.Compressors, _elem157) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } -func (p *TSCreateSchemaTemplateReq) Equals(other *TSCreateSchemaTemplateReq) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false +func (p *TSCreateMultiTimeseriesReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) } - if p.SessionId != other.SessionId { return false } - if p.Name != other.Name { return false } - if bytes.Compare(p.SerializedTemplate, other.SerializedTemplate) != 0 { return false } - return true + tSlice := make([]map[string]string, 0, size) + p.PropsList = tSlice + for i := 0; i < size; i ++ { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem158 := tMap + for i := 0; i < size; i ++ { +var _key159 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _key159 = v } - -func (p *TSCreateSchemaTemplateReq) String() string { - if p == nil { - return "" +var _val160 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _val160 = v +} + _elem158[_key159] = _val160 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.PropsList = append(p.PropsList, _elem158) } - return fmt.Sprintf("TSCreateSchemaTemplateReq(%+v)", *p) + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } -// Attributes: -// - SessionId -// - Name -// - IsAligned -// - Measurements -// - DataTypes -// - Encodings -// - Compressors -type TSAppendSchemaTemplateReq struct { - SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Name string `thrift:"name,2,required" db:"name" json:"name"` - IsAligned bool `thrift:"isAligned,3,required" db:"isAligned" json:"isAligned"` - Measurements []string `thrift:"measurements,4,required" db:"measurements" json:"measurements"` - DataTypes []int32 `thrift:"dataTypes,5,required" db:"dataTypes" json:"dataTypes"` - Encodings []int32 `thrift:"encodings,6,required" db:"encodings" json:"encodings"` - Compressors []int32 `thrift:"compressors,7,required" db:"compressors" json:"compressors"` +func (p *TSCreateMultiTimeseriesReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]map[string]string, 0, size) + p.TagsList = tSlice + for i := 0; i < size; i ++ { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem161 := tMap + for i := 0; i < size; i ++ { +var _key162 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _key162 = v } - -func NewTSAppendSchemaTemplateReq() *TSAppendSchemaTemplateReq { - return &TSAppendSchemaTemplateReq{} +var _val163 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _val163 = v } - - -func (p *TSAppendSchemaTemplateReq) GetSessionId() int64 { - return p.SessionId + _elem161[_key162] = _val163 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.TagsList = append(p.TagsList, _elem161) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } -func (p *TSAppendSchemaTemplateReq) GetName() string { - return p.Name +func (p *TSCreateMultiTimeseriesReq) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]map[string]string, 0, size) + p.AttributesList = tSlice + for i := 0; i < size; i ++ { + _, _, size, err := iprot.ReadMapBegin(ctx) + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem164 := tMap + for i := 0; i < size; i ++ { +var _key165 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _key165 = v } - -func (p *TSAppendSchemaTemplateReq) GetIsAligned() bool { - return p.IsAligned +var _val166 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _val166 = v } - -func (p *TSAppendSchemaTemplateReq) GetMeasurements() []string { - return p.Measurements + _elem164[_key165] = _val166 + } + if err := iprot.ReadMapEnd(ctx); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.AttributesList = append(p.AttributesList, _elem164) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } -func (p *TSAppendSchemaTemplateReq) GetDataTypes() []int32 { - return p.DataTypes +func (p *TSCreateMultiTimeseriesReq) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.MeasurementAliasList = tSlice + for i := 0; i < size; i ++ { +var _elem167 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem167 = v } - -func (p *TSAppendSchemaTemplateReq) GetEncodings() []int32 { - return p.Encodings + p.MeasurementAliasList = append(p.MeasurementAliasList, _elem167) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } -func (p *TSAppendSchemaTemplateReq) GetCompressors() []int32 { - return p.Compressors -} -func (p *TSAppendSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) +func (p *TSCreateMultiTimeseriesReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSCreateMultiTimeseriesReq"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} - var issetSessionId bool = false; - var issetName bool = false; - var issetIsAligned bool = false; - var issetMeasurements bool = false; - var issetDataTypes bool = false; - var issetEncodings bool = false; - var issetCompressors bool = false; +func (p *TSCreateMultiTimeseriesReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } + return err +} - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetSessionId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetName = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetIsAligned = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.LIST { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetMeasurements = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.LIST { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - issetDataTypes = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.LIST { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - issetEncodings = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.LIST { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - issetCompressors = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetSessionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); - } - if !issetName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); - } - if !issetIsAligned{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAligned is not set")); - } - if !issetMeasurements{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); - } - if !issetDataTypes{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataTypes is not set")); +func (p *TSCreateMultiTimeseriesReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "paths", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:paths: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Paths)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } - if !issetEncodings{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); + for _, v := range p.Paths { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if !issetCompressors{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressors is not set")); + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - return nil -} - -func (p *TSAppendSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.SessionId = v -} - return nil -} - -func (p *TSAppendSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Name = v -} - return nil -} - -func (p *TSAppendSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.IsAligned = v -} - return nil + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:paths: ", p), err) } + return err } -func (p *TSAppendSchemaTemplateReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "dataTypes", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:dataTypes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.DataTypes)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } - tSlice := make([]string, 0, size) - p.Measurements = tSlice - for i := 0; i < size; i ++ { -var _elem181 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem181 = v -} - p.Measurements = append(p.Measurements, _elem181) + for _, v := range p.DataTypes { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - return nil + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:dataTypes: ", p), err) } + return err } -func (p *TSAppendSchemaTemplateReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:encodings: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } - tSlice := make([]int32, 0, size) - p.DataTypes = tSlice - for i := 0; i < size; i ++ { -var _elem182 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem182 = v -} - p.DataTypes = append(p.DataTypes, _elem182) + for _, v := range p.Encodings { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - return nil + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:encodings: ", p), err) } + return err } -func (p *TSAppendSchemaTemplateReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "compressors", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:compressors: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Compressors)); err != nil { + return thrift.PrependError("error writing list begin: ", err) } - tSlice := make([]int32, 0, size) - p.Encodings = tSlice - for i := 0; i < size; i ++ { -var _elem183 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem183 = v -} - p.Encodings = append(p.Encodings, _elem183) + for _, v := range p.Compressors { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } - return nil -} - -func (p *TSAppendSchemaTemplateReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]int32, 0, size) - p.Compressors = tSlice - for i := 0; i < size; i ++ { -var _elem184 int32 - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem184 = v -} - p.Compressors = append(p.Compressors, _elem184) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSAppendSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSAppendSchemaTemplateReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - if err := p.writeField6(ctx, oprot); err != nil { return err } - if err := p.writeField7(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil -} - -func (p *TSAppendSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } - return err -} - -func (p *TSAppendSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } - return err -} - -func (p *TSAppendSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:isAligned: ", p), err) } - if err := oprot.WriteBool(ctx, bool(p.IsAligned)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.isAligned (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:isAligned: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:compressors: ", p), err) } return err } -func (p *TSAppendSchemaTemplateReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:measurements: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Measurements { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetPropsList() { + if err := oprot.WriteFieldBegin(ctx, "propsList", thrift.LIST, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:propsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.PropsList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.PropsList { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:propsList: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:measurements: ", p), err) } return err } -func (p *TSAppendSchemaTemplateReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "dataTypes", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:dataTypes: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.DataTypes)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.DataTypes { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetTagsList() { + if err := oprot.WriteFieldBegin(ctx, "tagsList", thrift.LIST, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:tagsList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.TagsList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.TagsList { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:tagsList: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:dataTypes: ", p), err) } return err } -func (p *TSAppendSchemaTemplateReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:encodings: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Encodings { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetAttributesList() { + if err := oprot.WriteFieldBegin(ctx, "attributesList", thrift.LIST, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:attributesList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.MAP, len(p.AttributesList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.AttributesList { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(ctx, string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteMapEnd(ctx); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:attributesList: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:encodings: ", p), err) } return err } -func (p *TSAppendSchemaTemplateReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "compressors", thrift.LIST, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:compressors: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Compressors)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Compressors { - if err := oprot.WriteI32(ctx, int32(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) +func (p *TSCreateMultiTimeseriesReq) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMeasurementAliasList() { + if err := oprot.WriteFieldBegin(ctx, "measurementAliasList", thrift.LIST, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:measurementAliasList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MeasurementAliasList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.MeasurementAliasList { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:measurementAliasList: ", p), err) } } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:compressors: ", p), err) } return err } -func (p *TSAppendSchemaTemplateReq) Equals(other *TSAppendSchemaTemplateReq) bool { +func (p *TSCreateMultiTimeseriesReq) Equals(other *TSCreateMultiTimeseriesReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.Name != other.Name { return false } - if p.IsAligned != other.IsAligned { return false } - if len(p.Measurements) != len(other.Measurements) { return false } - for i, _tgt := range p.Measurements { - _src185 := other.Measurements[i] - if _tgt != _src185 { return false } + if len(p.Paths) != len(other.Paths) { return false } + for i, _tgt := range p.Paths { + _src168 := other.Paths[i] + if _tgt != _src168 { return false } } if len(p.DataTypes) != len(other.DataTypes) { return false } for i, _tgt := range p.DataTypes { - _src186 := other.DataTypes[i] - if _tgt != _src186 { return false } + _src169 := other.DataTypes[i] + if _tgt != _src169 { return false } } if len(p.Encodings) != len(other.Encodings) { return false } for i, _tgt := range p.Encodings { - _src187 := other.Encodings[i] - if _tgt != _src187 { return false } + _src170 := other.Encodings[i] + if _tgt != _src170 { return false } } if len(p.Compressors) != len(other.Compressors) { return false } for i, _tgt := range p.Compressors { - _src188 := other.Compressors[i] - if _tgt != _src188 { return false } + _src171 := other.Compressors[i] + if _tgt != _src171 { return false } } - return true -} - -func (p *TSAppendSchemaTemplateReq) String() string { - if p == nil { - return "" + if len(p.PropsList) != len(other.PropsList) { return false } + for i, _tgt := range p.PropsList { + _src172 := other.PropsList[i] + if len(_tgt) != len(_src172) { return false } + for k, _tgt := range _tgt { + _src173 := _src172[k] + if _tgt != _src173 { return false } + } } - return fmt.Sprintf("TSAppendSchemaTemplateReq(%+v)", *p) + if len(p.TagsList) != len(other.TagsList) { return false } + for i, _tgt := range p.TagsList { + _src174 := other.TagsList[i] + if len(_tgt) != len(_src174) { return false } + for k, _tgt := range _tgt { + _src175 := _src174[k] + if _tgt != _src175 { return false } + } + } + if len(p.AttributesList) != len(other.AttributesList) { return false } + for i, _tgt := range p.AttributesList { + _src176 := other.AttributesList[i] + if len(_tgt) != len(_src176) { return false } + for k, _tgt := range _tgt { + _src177 := _src176[k] + if _tgt != _src177 { return false } + } + } + if len(p.MeasurementAliasList) != len(other.MeasurementAliasList) { return false } + for i, _tgt := range p.MeasurementAliasList { + _src178 := other.MeasurementAliasList[i] + if _tgt != _src178 { return false } + } + return true +} + +func (p *TSCreateMultiTimeseriesReq) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TSCreateMultiTimeseriesReq(%+v)", *p) } // Attributes: -// - SessionId -// - Name -// - Path -type TSPruneSchemaTemplateReq struct { - SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Name string `thrift:"name,2,required" db:"name" json:"name"` - Path string `thrift:"path,3,required" db:"path" json:"path"` +// - Version +// - SupportedTimeAggregationOperations +// - TimestampPrecision +// - MaxConcurrentClientNum +// - ThriftMaxFrameSize +// - IsReadOnly +// - BuildInfo +// - Logo +type ServerProperties struct { + Version string `thrift:"version,1,required" db:"version" json:"version"` + SupportedTimeAggregationOperations []string `thrift:"supportedTimeAggregationOperations,2,required" db:"supportedTimeAggregationOperations" json:"supportedTimeAggregationOperations"` + TimestampPrecision string `thrift:"timestampPrecision,3,required" db:"timestampPrecision" json:"timestampPrecision"` + MaxConcurrentClientNum int32 `thrift:"maxConcurrentClientNum,4" db:"maxConcurrentClientNum" json:"maxConcurrentClientNum"` + ThriftMaxFrameSize *int32 `thrift:"thriftMaxFrameSize,5" db:"thriftMaxFrameSize" json:"thriftMaxFrameSize,omitempty"` + IsReadOnly *bool `thrift:"isReadOnly,6" db:"isReadOnly" json:"isReadOnly,omitempty"` + BuildInfo *string `thrift:"buildInfo,7" db:"buildInfo" json:"buildInfo,omitempty"` + Logo *string `thrift:"logo,8" db:"logo" json:"logo,omitempty"` } -func NewTSPruneSchemaTemplateReq() *TSPruneSchemaTemplateReq { - return &TSPruneSchemaTemplateReq{} +func NewServerProperties() *ServerProperties { + return &ServerProperties{} } -func (p *TSPruneSchemaTemplateReq) GetSessionId() int64 { - return p.SessionId +func (p *ServerProperties) GetVersion() string { + return p.Version } -func (p *TSPruneSchemaTemplateReq) GetName() string { - return p.Name +func (p *ServerProperties) GetSupportedTimeAggregationOperations() []string { + return p.SupportedTimeAggregationOperations } -func (p *TSPruneSchemaTemplateReq) GetPath() string { - return p.Path +func (p *ServerProperties) GetTimestampPrecision() string { + return p.TimestampPrecision } -func (p *TSPruneSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + +func (p *ServerProperties) GetMaxConcurrentClientNum() int32 { + return p.MaxConcurrentClientNum +} +var ServerProperties_ThriftMaxFrameSize_DEFAULT int32 +func (p *ServerProperties) GetThriftMaxFrameSize() int32 { + if !p.IsSetThriftMaxFrameSize() { + return ServerProperties_ThriftMaxFrameSize_DEFAULT + } +return *p.ThriftMaxFrameSize +} +var ServerProperties_IsReadOnly_DEFAULT bool +func (p *ServerProperties) GetIsReadOnly() bool { + if !p.IsSetIsReadOnly() { + return ServerProperties_IsReadOnly_DEFAULT + } +return *p.IsReadOnly +} +var ServerProperties_BuildInfo_DEFAULT string +func (p *ServerProperties) GetBuildInfo() string { + if !p.IsSetBuildInfo() { + return ServerProperties_BuildInfo_DEFAULT + } +return *p.BuildInfo +} +var ServerProperties_Logo_DEFAULT string +func (p *ServerProperties) GetLogo() string { + if !p.IsSetLogo() { + return ServerProperties_Logo_DEFAULT + } +return *p.Logo +} +func (p *ServerProperties) IsSetThriftMaxFrameSize() bool { + return p.ThriftMaxFrameSize != nil +} + +func (p *ServerProperties) IsSetIsReadOnly() bool { + return p.IsReadOnly != nil +} + +func (p *ServerProperties) IsSetBuildInfo() bool { + return p.BuildInfo != nil +} + +func (p *ServerProperties) IsSetLogo() bool { + return p.Logo != nil +} + +func (p *ServerProperties) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetSessionId bool = false; - var issetName bool = false; - var issetPath bool = false; + var issetVersion bool = false; + var issetSupportedTimeAggregationOperations bool = false; + var issetTimestampPrecision bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -16000,22 +15600,22 @@ func (p *TSPruneSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProto if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.STRING { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetSessionId = true + issetVersion = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetName = true + issetSupportedTimeAggregationOperations = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -16026,7 +15626,57 @@ func (p *TSPruneSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProto if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetPath = true + issetTimestampPrecision = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.I32 { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.I32 { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 6: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField6(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 7: + if fieldTypeId == thrift.STRING { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 8: + if fieldTypeId == thrift.STRING { + if err := p.ReadField8(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -16044,156 +15694,301 @@ func (p *TSPruneSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProto if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetSessionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); + if !issetVersion{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); } - if !issetName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); + if !issetSupportedTimeAggregationOperations{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SupportedTimeAggregationOperations is not set")); } - if !issetPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Path is not set")); + if !issetTimestampPrecision{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TimestampPrecision is not set")); } return nil } -func (p *TSPruneSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { +func (p *ServerProperties) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - p.SessionId = v + p.Version = v } return nil } -func (p *TSPruneSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *ServerProperties) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.SupportedTimeAggregationOperations = tSlice + for i := 0; i < size; i ++ { +var _elem179 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.Name = v + _elem179 = v } + p.SupportedTimeAggregationOperations = append(p.SupportedTimeAggregationOperations, _elem179) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSPruneSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *ServerProperties) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.Path = v + p.TimestampPrecision = v } return nil } -func (p *TSPruneSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSPruneSchemaTemplateReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } +func (p *ServerProperties) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.MaxConcurrentClientNum = v +} return nil } -func (p *TSPruneSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } +func (p *ServerProperties) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 5: ", err) +} else { + p.ThriftMaxFrameSize = &v +} + return nil +} + +func (p *ServerProperties) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 6: ", err) +} else { + p.IsReadOnly = &v +} + return nil +} + +func (p *ServerProperties) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 7: ", err) +} else { + p.BuildInfo = &v +} + return nil +} + +func (p *ServerProperties) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 8: ", err) +} else { + p.Logo = &v +} + return nil +} + +func (p *ServerProperties) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ServerProperties"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *ServerProperties) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } return err } -func (p *TSPruneSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } +func (p *ServerProperties) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "supportedTimeAggregationOperations", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:supportedTimeAggregationOperations: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.SupportedTimeAggregationOperations)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.SupportedTimeAggregationOperations { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:supportedTimeAggregationOperations: ", p), err) } return err } -func (p *TSPruneSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "path", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:path: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Path)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.path (3) field write error: ", p), err) } +func (p *ServerProperties) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampPrecision", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:timestampPrecision: ", p), err) } + if err := oprot.WriteString(ctx, string(p.TimestampPrecision)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestampPrecision (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:path: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:timestampPrecision: ", p), err) } return err } -func (p *TSPruneSchemaTemplateReq) Equals(other *TSPruneSchemaTemplateReq) bool { +func (p *ServerProperties) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxConcurrentClientNum", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:maxConcurrentClientNum: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.MaxConcurrentClientNum)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.maxConcurrentClientNum (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:maxConcurrentClientNum: ", p), err) } + return err +} + +func (p *ServerProperties) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetThriftMaxFrameSize() { + if err := oprot.WriteFieldBegin(ctx, "thriftMaxFrameSize", thrift.I32, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:thriftMaxFrameSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.ThriftMaxFrameSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.thriftMaxFrameSize (5) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:thriftMaxFrameSize: ", p), err) } + } + return err +} + +func (p *ServerProperties) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsReadOnly() { + if err := oprot.WriteFieldBegin(ctx, "isReadOnly", thrift.BOOL, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:isReadOnly: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsReadOnly)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isReadOnly (6) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:isReadOnly: ", p), err) } + } + return err +} + +func (p *ServerProperties) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetBuildInfo() { + if err := oprot.WriteFieldBegin(ctx, "buildInfo", thrift.STRING, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:buildInfo: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.BuildInfo)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.buildInfo (7) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:buildInfo: ", p), err) } + } + return err +} + +func (p *ServerProperties) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetLogo() { + if err := oprot.WriteFieldBegin(ctx, "logo", thrift.STRING, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:logo: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.Logo)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.logo (8) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:logo: ", p), err) } + } + return err +} + +func (p *ServerProperties) Equals(other *ServerProperties) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.SessionId != other.SessionId { return false } - if p.Name != other.Name { return false } - if p.Path != other.Path { return false } + if p.Version != other.Version { return false } + if len(p.SupportedTimeAggregationOperations) != len(other.SupportedTimeAggregationOperations) { return false } + for i, _tgt := range p.SupportedTimeAggregationOperations { + _src180 := other.SupportedTimeAggregationOperations[i] + if _tgt != _src180 { return false } + } + if p.TimestampPrecision != other.TimestampPrecision { return false } + if p.MaxConcurrentClientNum != other.MaxConcurrentClientNum { return false } + if p.ThriftMaxFrameSize != other.ThriftMaxFrameSize { + if p.ThriftMaxFrameSize == nil || other.ThriftMaxFrameSize == nil { + return false + } + if (*p.ThriftMaxFrameSize) != (*other.ThriftMaxFrameSize) { return false } + } + if p.IsReadOnly != other.IsReadOnly { + if p.IsReadOnly == nil || other.IsReadOnly == nil { + return false + } + if (*p.IsReadOnly) != (*other.IsReadOnly) { return false } + } + if p.BuildInfo != other.BuildInfo { + if p.BuildInfo == nil || other.BuildInfo == nil { + return false + } + if (*p.BuildInfo) != (*other.BuildInfo) { return false } + } + if p.Logo != other.Logo { + if p.Logo == nil || other.Logo == nil { + return false + } + if (*p.Logo) != (*other.Logo) { return false } + } return true } -func (p *TSPruneSchemaTemplateReq) String() string { +func (p *ServerProperties) String() string { if p == nil { return "" } - return fmt.Sprintf("TSPruneSchemaTemplateReq(%+v)", *p) + return fmt.Sprintf("ServerProperties(%+v)", *p) } // Attributes: // - SessionId -// - Name -// - QueryType -// - Measurement -type TSQueryTemplateReq struct { +// - TemplateName +// - PrefixPath +type TSSetSchemaTemplateReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - Name string `thrift:"name,2,required" db:"name" json:"name"` - QueryType int32 `thrift:"queryType,3,required" db:"queryType" json:"queryType"` - Measurement *string `thrift:"measurement,4" db:"measurement" json:"measurement,omitempty"` + TemplateName string `thrift:"templateName,2,required" db:"templateName" json:"templateName"` + PrefixPath string `thrift:"prefixPath,3,required" db:"prefixPath" json:"prefixPath"` } -func NewTSQueryTemplateReq() *TSQueryTemplateReq { - return &TSQueryTemplateReq{} +func NewTSSetSchemaTemplateReq() *TSSetSchemaTemplateReq { + return &TSSetSchemaTemplateReq{} } -func (p *TSQueryTemplateReq) GetSessionId() int64 { +func (p *TSSetSchemaTemplateReq) GetSessionId() int64 { return p.SessionId } -func (p *TSQueryTemplateReq) GetName() string { - return p.Name +func (p *TSSetSchemaTemplateReq) GetTemplateName() string { + return p.TemplateName } -func (p *TSQueryTemplateReq) GetQueryType() int32 { - return p.QueryType -} -var TSQueryTemplateReq_Measurement_DEFAULT string -func (p *TSQueryTemplateReq) GetMeasurement() string { - if !p.IsSetMeasurement() { - return TSQueryTemplateReq_Measurement_DEFAULT - } -return *p.Measurement -} -func (p *TSQueryTemplateReq) IsSetMeasurement() bool { - return p.Measurement != nil +func (p *TSSetSchemaTemplateReq) GetPrefixPath() string { + return p.PrefixPath } - -func (p *TSQueryTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSSetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetName bool = false; - var issetQueryType bool = false; + var issetTemplateName bool = false; + var issetPrefixPath bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -16218,28 +16013,18 @@ func (p *TSQueryTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) e if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetName = true + issetTemplateName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.I32 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetQueryType = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(ctx, iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -16260,16 +16045,16 @@ func (p *TSQueryTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) e if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); - } - if !issetQueryType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field QueryType is not set")); + if !issetTemplateName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TemplateName is not set")); + } + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); } return nil } -func (p *TSQueryTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSSetSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -16278,41 +16063,31 @@ func (p *TSQueryTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProt return nil } -func (p *TSQueryTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSSetSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.Name = v -} - return nil -} - -func (p *TSQueryTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.QueryType = v + p.TemplateName = v } return nil } -func (p *TSQueryTemplateReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSSetSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) + return thrift.PrependError("error reading field 3: ", err) } else { - p.Measurement = &v + p.PrefixPath = v } return nil } -func (p *TSQueryTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSQueryTemplateReq"); err != nil { +func (p *TSSetSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSSetSchemaTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -16321,7 +16096,7 @@ func (p *TSQueryTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) return nil } -func (p *TSQueryTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSSetSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -16331,134 +16106,79 @@ func (p *TSQueryTemplateReq) writeField1(ctx context.Context, oprot thrift.TProt return err } -func (p *TSQueryTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } +func (p *TSSetSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "templateName", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:templateName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.TemplateName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.templateName (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:templateName: ", p), err) } return err } -func (p *TSQueryTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "queryType", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:queryType: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.QueryType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.queryType (3) field write error: ", p), err) } +func (p *TSSetSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:queryType: ", p), err) } - return err -} - -func (p *TSQueryTemplateReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMeasurement() { - if err := oprot.WriteFieldBegin(ctx, "measurement", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:measurement: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.Measurement)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.measurement (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:measurement: ", p), err) } - } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:prefixPath: ", p), err) } return err } -func (p *TSQueryTemplateReq) Equals(other *TSQueryTemplateReq) bool { +func (p *TSSetSchemaTemplateReq) Equals(other *TSSetSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.Name != other.Name { return false } - if p.QueryType != other.QueryType { return false } - if p.Measurement != other.Measurement { - if p.Measurement == nil || other.Measurement == nil { - return false - } - if (*p.Measurement) != (*other.Measurement) { return false } - } + if p.TemplateName != other.TemplateName { return false } + if p.PrefixPath != other.PrefixPath { return false } return true } -func (p *TSQueryTemplateReq) String() string { +func (p *TSSetSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSQueryTemplateReq(%+v)", *p) + return fmt.Sprintf("TSSetSchemaTemplateReq(%+v)", *p) } // Attributes: -// - Status -// - QueryType -// - Result_ -// - Count -// - Measurements -type TSQueryTemplateResp struct { - Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - QueryType int32 `thrift:"queryType,2,required" db:"queryType" json:"queryType"` - Result_ *bool `thrift:"result,3" db:"result" json:"result,omitempty"` - Count *int32 `thrift:"count,4" db:"count" json:"count,omitempty"` - Measurements []string `thrift:"measurements,5" db:"measurements" json:"measurements,omitempty"` -} - -func NewTSQueryTemplateResp() *TSQueryTemplateResp { - return &TSQueryTemplateResp{} -} - -var TSQueryTemplateResp_Status_DEFAULT *common.TSStatus -func (p *TSQueryTemplateResp) GetStatus() *common.TSStatus { - if !p.IsSetStatus() { - return TSQueryTemplateResp_Status_DEFAULT - } -return p.Status +// - SessionId +// - Name +// - SerializedTemplate +type TSCreateSchemaTemplateReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + Name string `thrift:"name,2,required" db:"name" json:"name"` + SerializedTemplate []byte `thrift:"serializedTemplate,3,required" db:"serializedTemplate" json:"serializedTemplate"` } -func (p *TSQueryTemplateResp) GetQueryType() int32 { - return p.QueryType -} -var TSQueryTemplateResp_Result__DEFAULT bool -func (p *TSQueryTemplateResp) GetResult_() bool { - if !p.IsSetResult_() { - return TSQueryTemplateResp_Result__DEFAULT - } -return *p.Result_ -} -var TSQueryTemplateResp_Count_DEFAULT int32 -func (p *TSQueryTemplateResp) GetCount() int32 { - if !p.IsSetCount() { - return TSQueryTemplateResp_Count_DEFAULT - } -return *p.Count +func NewTSCreateSchemaTemplateReq() *TSCreateSchemaTemplateReq { + return &TSCreateSchemaTemplateReq{} } -var TSQueryTemplateResp_Measurements_DEFAULT []string -func (p *TSQueryTemplateResp) GetMeasurements() []string { - return p.Measurements -} -func (p *TSQueryTemplateResp) IsSetStatus() bool { - return p.Status != nil -} -func (p *TSQueryTemplateResp) IsSetResult_() bool { - return p.Result_ != nil +func (p *TSCreateSchemaTemplateReq) GetSessionId() int64 { + return p.SessionId } -func (p *TSQueryTemplateResp) IsSetCount() bool { - return p.Count != nil +func (p *TSCreateSchemaTemplateReq) GetName() string { + return p.Name } -func (p *TSQueryTemplateResp) IsSetMeasurements() bool { - return p.Measurements != nil +func (p *TSCreateSchemaTemplateReq) GetSerializedTemplate() []byte { + return p.SerializedTemplate } - -func (p *TSQueryTemplateResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSCreateSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetStatus bool = false; - var issetQueryType bool = false; + var issetSessionId bool = false; + var issetName bool = false; + var issetSerializedTemplate bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -16468,52 +16188,33 @@ func (p *TSQueryTemplateResp) Read(ctx context.Context, iprot thrift.TProtocol) if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetStatus = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.I32 { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetQueryType = true + issetName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.STRING { if err := p.ReadField3(ctx, iprot); err != nil { return err } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I32 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.LIST { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } + issetSerializedTemplate = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -16531,223 +16232,171 @@ func (p *TSQueryTemplateResp) Read(ctx context.Context, iprot thrift.TProtocol) if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetQueryType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field QueryType is not set")); + if !issetName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); + } + if !issetSerializedTemplate{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SerializedTemplate is not set")); } return nil } -func (p *TSQueryTemplateResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Status = &common.TSStatus{} - if err := p.Status.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) - } +func (p *TSCreateSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.SessionId = v +} return nil } -func (p *TSQueryTemplateResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { +func (p *TSCreateSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.QueryType = v + p.Name = v } return nil } -func (p *TSQueryTemplateResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { +func (p *TSCreateSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.Result_ = &v + p.SerializedTemplate = v } return nil } -func (p *TSQueryTemplateResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - p.Count = &v -} +func (p *TSCreateSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSCreateSchemaTemplateReq"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TSQueryTemplateResp) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.Measurements = tSlice - for i := 0; i < size; i ++ { -var _elem189 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _elem189 = v -} - p.Measurements = append(p.Measurements, _elem189) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *TSQueryTemplateResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSQueryTemplateResp"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } - if err := p.writeField5(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil -} - -func (p *TSQueryTemplateResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } +func (p *TSCreateSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TSQueryTemplateResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "queryType", thrift.I32, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:queryType: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.QueryType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.queryType (2) field write error: ", p), err) } +func (p *TSCreateSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:queryType: ", p), err) } - return err -} - -func (p *TSQueryTemplateResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetResult_() { - if err := oprot.WriteFieldBegin(ctx, "result", thrift.BOOL, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:result: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.Result_)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.result (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:result: ", p), err) } - } - return err -} - -func (p *TSQueryTemplateResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetCount() { - if err := oprot.WriteFieldBegin(ctx, "count", thrift.I32, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:count: ", p), err) } - if err := oprot.WriteI32(ctx, int32(*p.Count)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.count (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:count: ", p), err) } - } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } return err } -func (p *TSQueryTemplateResp) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetMeasurements() { - if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:measurements: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Measurements { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:measurements: ", p), err) } - } +func (p *TSCreateSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serializedTemplate", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:serializedTemplate: ", p), err) } + if err := oprot.WriteBinary(ctx, p.SerializedTemplate); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.serializedTemplate (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:serializedTemplate: ", p), err) } return err } -func (p *TSQueryTemplateResp) Equals(other *TSQueryTemplateResp) bool { +func (p *TSCreateSchemaTemplateReq) Equals(other *TSCreateSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if !p.Status.Equals(other.Status) { return false } - if p.QueryType != other.QueryType { return false } - if p.Result_ != other.Result_ { - if p.Result_ == nil || other.Result_ == nil { - return false - } - if (*p.Result_) != (*other.Result_) { return false } - } - if p.Count != other.Count { - if p.Count == nil || other.Count == nil { - return false - } - if (*p.Count) != (*other.Count) { return false } - } - if len(p.Measurements) != len(other.Measurements) { return false } - for i, _tgt := range p.Measurements { - _src190 := other.Measurements[i] - if _tgt != _src190 { return false } - } + if p.SessionId != other.SessionId { return false } + if p.Name != other.Name { return false } + if bytes.Compare(p.SerializedTemplate, other.SerializedTemplate) != 0 { return false } return true } -func (p *TSQueryTemplateResp) String() string { +func (p *TSCreateSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSQueryTemplateResp(%+v)", *p) + return fmt.Sprintf("TSCreateSchemaTemplateReq(%+v)", *p) } // Attributes: // - SessionId -// - PrefixPath -// - TemplateName -type TSUnsetSchemaTemplateReq struct { +// - Name +// - IsAligned +// - Measurements +// - DataTypes +// - Encodings +// - Compressors +type TSAppendSchemaTemplateReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` - TemplateName string `thrift:"templateName,3,required" db:"templateName" json:"templateName"` + Name string `thrift:"name,2,required" db:"name" json:"name"` + IsAligned bool `thrift:"isAligned,3,required" db:"isAligned" json:"isAligned"` + Measurements []string `thrift:"measurements,4,required" db:"measurements" json:"measurements"` + DataTypes []int32 `thrift:"dataTypes,5,required" db:"dataTypes" json:"dataTypes"` + Encodings []int32 `thrift:"encodings,6,required" db:"encodings" json:"encodings"` + Compressors []int32 `thrift:"compressors,7,required" db:"compressors" json:"compressors"` } -func NewTSUnsetSchemaTemplateReq() *TSUnsetSchemaTemplateReq { - return &TSUnsetSchemaTemplateReq{} +func NewTSAppendSchemaTemplateReq() *TSAppendSchemaTemplateReq { + return &TSAppendSchemaTemplateReq{} } -func (p *TSUnsetSchemaTemplateReq) GetSessionId() int64 { +func (p *TSAppendSchemaTemplateReq) GetSessionId() int64 { return p.SessionId } -func (p *TSUnsetSchemaTemplateReq) GetPrefixPath() string { - return p.PrefixPath +func (p *TSAppendSchemaTemplateReq) GetName() string { + return p.Name } -func (p *TSUnsetSchemaTemplateReq) GetTemplateName() string { - return p.TemplateName +func (p *TSAppendSchemaTemplateReq) GetIsAligned() bool { + return p.IsAligned } -func (p *TSUnsetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + +func (p *TSAppendSchemaTemplateReq) GetMeasurements() []string { + return p.Measurements +} + +func (p *TSAppendSchemaTemplateReq) GetDataTypes() []int32 { + return p.DataTypes +} + +func (p *TSAppendSchemaTemplateReq) GetEncodings() []int32 { + return p.Encodings +} + +func (p *TSAppendSchemaTemplateReq) GetCompressors() []int32 { + return p.Compressors +} +func (p *TSAppendSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetPrefixPath bool = false; - var issetTemplateName bool = false; + var issetName bool = false; + var issetIsAligned bool = false; + var issetMeasurements bool = false; + var issetDataTypes bool = false; + var issetEncodings bool = false; + var issetCompressors bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -16772,18 +16421,62 @@ func (p *TSUnsetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProto if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetPrefixPath = true + issetName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.BOOL { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetTemplateName = true + issetIsAligned = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.LIST { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + issetMeasurements = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.LIST { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + issetDataTypes = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 6: + if fieldTypeId == thrift.LIST { + if err := p.ReadField6(ctx, iprot); err != nil { + return err + } + issetEncodings = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 7: + if fieldTypeId == thrift.LIST { + if err := p.ReadField7(ctx, iprot); err != nil { + return err + } + issetCompressors = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -16804,208 +16497,153 @@ func (p *TSUnsetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProto if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetPrefixPath{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); + if !issetName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); } - if !issetTemplateName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TemplateName is not set")); + if !issetIsAligned{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAligned is not set")); } - return nil -} - -func (p *TSUnsetSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.SessionId = v -} - return nil -} + if !issetMeasurements{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Measurements is not set")); + } + if !issetDataTypes{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataTypes is not set")); + } + if !issetEncodings{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); + } + if !issetCompressors{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compressors is not set")); + } + return nil +} -func (p *TSUnsetSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *TSAppendSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) } else { - p.PrefixPath = v + p.SessionId = v } return nil } -func (p *TSUnsetSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSAppendSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) + return thrift.PrependError("error reading field 2: ", err) } else { - p.TemplateName = v -} - return nil + p.Name = v } - -func (p *TSUnsetSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSUnsetSchemaTemplateReq"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { return err } - if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TSUnsetSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } - return err -} - -func (p *TSUnsetSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } - return err +func (p *TSAppendSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.IsAligned = v } - -func (p *TSUnsetSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "templateName", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:templateName: ", p), err) } - if err := oprot.WriteString(ctx, string(p.TemplateName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.templateName (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:templateName: ", p), err) } - return err + return nil } -func (p *TSUnsetSchemaTemplateReq) Equals(other *TSUnsetSchemaTemplateReq) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false +func (p *TSAppendSchemaTemplateReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) } - if p.SessionId != other.SessionId { return false } - if p.PrefixPath != other.PrefixPath { return false } - if p.TemplateName != other.TemplateName { return false } - return true + tSlice := make([]string, 0, size) + p.Measurements = tSlice + for i := 0; i < size; i ++ { +var _elem181 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem181 = v } - -func (p *TSUnsetSchemaTemplateReq) String() string { - if p == nil { - return "" + p.Measurements = append(p.Measurements, _elem181) } - return fmt.Sprintf("TSUnsetSchemaTemplateReq(%+v)", *p) -} - -// Attributes: -// - SessionId -// - TemplateName -type TSDropSchemaTemplateReq struct { - SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - TemplateName string `thrift:"templateName,2,required" db:"templateName" json:"templateName"` -} - -func NewTSDropSchemaTemplateReq() *TSDropSchemaTemplateReq { - return &TSDropSchemaTemplateReq{} -} - - -func (p *TSDropSchemaTemplateReq) GetSessionId() int64 { - return p.SessionId -} - -func (p *TSDropSchemaTemplateReq) GetTemplateName() string { - return p.TemplateName -} -func (p *TSDropSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) } + return nil +} - var issetSessionId bool = false; - var issetTemplateName bool = false; - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetSessionId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetTemplateName = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +func (p *TSAppendSchemaTemplateReq) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) } - if !issetSessionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); + tSlice := make([]int32, 0, size) + p.DataTypes = tSlice + for i := 0; i < size; i ++ { +var _elem182 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem182 = v +} + p.DataTypes = append(p.DataTypes, _elem182) } - if !issetTemplateName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TemplateName is not set")); + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *TSDropSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) +func (p *TSAppendSchemaTemplateReq) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.Encodings = tSlice + for i := 0; i < size; i ++ { +var _elem183 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.SessionId = v + _elem183 = v } + p.Encodings = append(p.Encodings, _elem183) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSDropSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *TSAppendSchemaTemplateReq) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.Compressors = tSlice + for i := 0; i < size; i ++ { +var _elem184 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.TemplateName = v + _elem184 = v } + p.Compressors = append(p.Compressors, _elem184) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TSDropSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSDropSchemaTemplateReq"); err != nil { +func (p *TSAppendSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSAppendSchemaTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -17014,7 +16652,7 @@ func (p *TSDropSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProto return nil } -func (p *TSDropSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSAppendSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -17024,61 +16662,171 @@ func (p *TSDropSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift. return err } -func (p *TSDropSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "templateName", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:templateName: ", p), err) } - if err := oprot.WriteString(ctx, string(p.TemplateName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.templateName (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:templateName: ", p), err) } - return err +func (p *TSAppendSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } + return err } -func (p *TSDropSchemaTemplateReq) Equals(other *TSDropSchemaTemplateReq) bool { +func (p *TSAppendSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:isAligned: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.IsAligned)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAligned (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:isAligned: ", p), err) } + return err +} + +func (p *TSAppendSchemaTemplateReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:measurements: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Measurements { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:measurements: ", p), err) } + return err +} + +func (p *TSAppendSchemaTemplateReq) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "dataTypes", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:dataTypes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.DataTypes)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.DataTypes { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:dataTypes: ", p), err) } + return err +} + +func (p *TSAppendSchemaTemplateReq) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:encodings: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Encodings { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:encodings: ", p), err) } + return err +} + +func (p *TSAppendSchemaTemplateReq) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "compressors", thrift.LIST, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:compressors: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Compressors)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Compressors { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:compressors: ", p), err) } + return err +} + +func (p *TSAppendSchemaTemplateReq) Equals(other *TSAppendSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if p.TemplateName != other.TemplateName { return false } + if p.Name != other.Name { return false } + if p.IsAligned != other.IsAligned { return false } + if len(p.Measurements) != len(other.Measurements) { return false } + for i, _tgt := range p.Measurements { + _src185 := other.Measurements[i] + if _tgt != _src185 { return false } + } + if len(p.DataTypes) != len(other.DataTypes) { return false } + for i, _tgt := range p.DataTypes { + _src186 := other.DataTypes[i] + if _tgt != _src186 { return false } + } + if len(p.Encodings) != len(other.Encodings) { return false } + for i, _tgt := range p.Encodings { + _src187 := other.Encodings[i] + if _tgt != _src187 { return false } + } + if len(p.Compressors) != len(other.Compressors) { return false } + for i, _tgt := range p.Compressors { + _src188 := other.Compressors[i] + if _tgt != _src188 { return false } + } return true } -func (p *TSDropSchemaTemplateReq) String() string { +func (p *TSAppendSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSDropSchemaTemplateReq(%+v)", *p) + return fmt.Sprintf("TSAppendSchemaTemplateReq(%+v)", *p) } // Attributes: // - SessionId -// - DevicePathList -type TCreateTimeseriesUsingSchemaTemplateReq struct { +// - Name +// - Path +type TSPruneSchemaTemplateReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` - DevicePathList []string `thrift:"devicePathList,2,required" db:"devicePathList" json:"devicePathList"` + Name string `thrift:"name,2,required" db:"name" json:"name"` + Path string `thrift:"path,3,required" db:"path" json:"path"` } -func NewTCreateTimeseriesUsingSchemaTemplateReq() *TCreateTimeseriesUsingSchemaTemplateReq { - return &TCreateTimeseriesUsingSchemaTemplateReq{} +func NewTSPruneSchemaTemplateReq() *TSPruneSchemaTemplateReq { + return &TSPruneSchemaTemplateReq{} } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) GetSessionId() int64 { +func (p *TSPruneSchemaTemplateReq) GetSessionId() int64 { return p.SessionId } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) GetDevicePathList() []string { - return p.DevicePathList +func (p *TSPruneSchemaTemplateReq) GetName() string { + return p.Name } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + +func (p *TSPruneSchemaTemplateReq) GetPath() string { + return p.Path +} +func (p *TSPruneSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSessionId bool = false; - var issetDevicePathList bool = false; + var issetName bool = false; + var issetPath bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -17099,11 +16847,22 @@ func (p *TCreateTimeseriesUsingSchemaTemplateReq) Read(ctx context.Context, ipro } } case 2: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetDevicePathList = true + issetName = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.STRING { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + issetPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17124,13 +16883,16 @@ func (p *TCreateTimeseriesUsingSchemaTemplateReq) Read(ctx context.Context, ipro if !issetSessionId{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetDevicePathList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DevicePathList is not set")); + if !issetName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); + } + if !issetPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Path is not set")); } return nil } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSPruneSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { @@ -17139,34 +16901,31 @@ func (p *TCreateTimeseriesUsingSchemaTemplateReq) ReadField1(ctx context.Contex return nil } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]string, 0, size) - p.DevicePathList = tSlice - for i := 0; i < size; i ++ { -var _elem191 string - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSPruneSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - _elem191 = v + p.Name = v } - p.DevicePathList = append(p.DevicePathList, _elem191) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TCreateTimeseriesUsingSchemaTemplateReq"); err != nil { +func (p *TSPruneSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.Path = v +} + return nil +} + +func (p *TSPruneSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSPruneSchemaTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -17175,7 +16934,7 @@ func (p *TCreateTimeseriesUsingSchemaTemplateReq) Write(ctx context.Context, opr return nil } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *TSPruneSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { @@ -17185,87 +16944,92 @@ func (p *TCreateTimeseriesUsingSchemaTemplateReq) writeField1(ctx context.Contex return err } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "devicePathList", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:devicePathList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.DevicePathList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.DevicePathList { - if err := oprot.WriteString(ctx, string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } +func (p *TSPruneSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:devicePathList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } return err } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) Equals(other *TCreateTimeseriesUsingSchemaTemplateReq) bool { +func (p *TSPruneSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "path", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:path: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Path)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.path (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:path: ", p), err) } + return err +} + +func (p *TSPruneSchemaTemplateReq) Equals(other *TSPruneSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } if p.SessionId != other.SessionId { return false } - if len(p.DevicePathList) != len(other.DevicePathList) { return false } - for i, _tgt := range p.DevicePathList { - _src192 := other.DevicePathList[i] - if _tgt != _src192 { return false } - } + if p.Name != other.Name { return false } + if p.Path != other.Path { return false } return true } -func (p *TCreateTimeseriesUsingSchemaTemplateReq) String() string { +func (p *TSPruneSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TCreateTimeseriesUsingSchemaTemplateReq(%+v)", *p) + return fmt.Sprintf("TSPruneSchemaTemplateReq(%+v)", *p) } // Attributes: -// - PipeName -// - CreateTime -// - Version -// - Database -type TSyncIdentityInfo struct { - PipeName string `thrift:"pipeName,1,required" db:"pipeName" json:"pipeName"` - CreateTime int64 `thrift:"createTime,2,required" db:"createTime" json:"createTime"` - Version string `thrift:"version,3,required" db:"version" json:"version"` - Database string `thrift:"database,4,required" db:"database" json:"database"` +// - SessionId +// - Name +// - QueryType +// - Measurement +type TSQueryTemplateReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + Name string `thrift:"name,2,required" db:"name" json:"name"` + QueryType int32 `thrift:"queryType,3,required" db:"queryType" json:"queryType"` + Measurement *string `thrift:"measurement,4" db:"measurement" json:"measurement,omitempty"` } -func NewTSyncIdentityInfo() *TSyncIdentityInfo { - return &TSyncIdentityInfo{} +func NewTSQueryTemplateReq() *TSQueryTemplateReq { + return &TSQueryTemplateReq{} } -func (p *TSyncIdentityInfo) GetPipeName() string { - return p.PipeName +func (p *TSQueryTemplateReq) GetSessionId() int64 { + return p.SessionId } -func (p *TSyncIdentityInfo) GetCreateTime() int64 { - return p.CreateTime +func (p *TSQueryTemplateReq) GetName() string { + return p.Name } -func (p *TSyncIdentityInfo) GetVersion() string { - return p.Version +func (p *TSQueryTemplateReq) GetQueryType() int32 { + return p.QueryType } - -func (p *TSyncIdentityInfo) GetDatabase() string { - return p.Database +var TSQueryTemplateReq_Measurement_DEFAULT string +func (p *TSQueryTemplateReq) GetMeasurement() string { + if !p.IsSetMeasurement() { + return TSQueryTemplateReq_Measurement_DEFAULT + } +return *p.Measurement } -func (p *TSyncIdentityInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSQueryTemplateReq) IsSetMeasurement() bool { + return p.Measurement != nil +} + +func (p *TSQueryTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetPipeName bool = false; - var issetCreateTime bool = false; - var issetVersion bool = false; - var issetDatabase bool = false; + var issetSessionId bool = false; + var issetName bool = false; + var issetQueryType bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -17275,33 +17039,33 @@ func (p *TSyncIdentityInfo) Read(ctx context.Context, iprot thrift.TProtocol) er if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetPipeName = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetCreateTime = true + issetName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.I32 { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetVersion = true + issetQueryType = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17312,7 +17076,6 @@ func (p *TSyncIdentityInfo) Read(ctx context.Context, iprot thrift.TProtocol) er if err := p.ReadField4(ctx, iprot); err != nil { return err } - issetDatabase = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17330,59 +17093,56 @@ func (p *TSyncIdentityInfo) Read(ctx context.Context, iprot thrift.TProtocol) er if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetPipeName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PipeName is not set")); - } - if !issetCreateTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CreateTime is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetVersion{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); + if !issetName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); } - if !issetDatabase{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Database is not set")); + if !issetQueryType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field QueryType is not set")); } return nil } -func (p *TSyncIdentityInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TSQueryTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - p.PipeName = v + p.SessionId = v } return nil } -func (p *TSyncIdentityInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { +func (p *TSQueryTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.CreateTime = v + p.Name = v } return nil } -func (p *TSyncIdentityInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TSQueryTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.Version = v + p.QueryType = v } return nil } -func (p *TSyncIdentityInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSQueryTemplateReq) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { - p.Database = v + p.Measurement = &v } return nil } -func (p *TSyncIdentityInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSyncIdentityInfo"); err != nil { +func (p *TSQueryTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSQueryTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -17397,93 +17157,144 @@ func (p *TSyncIdentityInfo) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TSyncIdentityInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "pipeName", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:pipeName: ", p), err) } - if err := oprot.WriteString(ctx, string(p.PipeName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.pipeName (1) field write error: ", p), err) } +func (p *TSQueryTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:pipeName: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TSyncIdentityInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "createTime", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:createTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.CreateTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.createTime (2) field write error: ", p), err) } +func (p *TSQueryTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:createTime: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } return err } -func (p *TSyncIdentityInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "version", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:version: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Version)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.version (3) field write error: ", p), err) } +func (p *TSQueryTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "queryType", thrift.I32, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:queryType: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.QueryType)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.queryType (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:version: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:queryType: ", p), err) } return err } -func (p *TSyncIdentityInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "database", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:database: ", p), err) } - if err := oprot.WriteString(ctx, string(p.Database)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.database (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:database: ", p), err) } +func (p *TSQueryTemplateReq) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMeasurement() { + if err := oprot.WriteFieldBegin(ctx, "measurement", thrift.STRING, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:measurement: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.Measurement)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.measurement (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:measurement: ", p), err) } + } return err } -func (p *TSyncIdentityInfo) Equals(other *TSyncIdentityInfo) bool { +func (p *TSQueryTemplateReq) Equals(other *TSQueryTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.PipeName != other.PipeName { return false } - if p.CreateTime != other.CreateTime { return false } - if p.Version != other.Version { return false } - if p.Database != other.Database { return false } + if p.SessionId != other.SessionId { return false } + if p.Name != other.Name { return false } + if p.QueryType != other.QueryType { return false } + if p.Measurement != other.Measurement { + if p.Measurement == nil || other.Measurement == nil { + return false + } + if (*p.Measurement) != (*other.Measurement) { return false } + } return true } -func (p *TSyncIdentityInfo) String() string { +func (p *TSQueryTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSyncIdentityInfo(%+v)", *p) + return fmt.Sprintf("TSQueryTemplateReq(%+v)", *p) } // Attributes: -// - FileName -// - StartIndex -type TSyncTransportMetaInfo struct { - FileName string `thrift:"fileName,1,required" db:"fileName" json:"fileName"` - StartIndex int64 `thrift:"startIndex,2,required" db:"startIndex" json:"startIndex"` +// - Status +// - QueryType +// - Result_ +// - Count +// - Measurements +type TSQueryTemplateResp struct { + Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` + QueryType int32 `thrift:"queryType,2,required" db:"queryType" json:"queryType"` + Result_ *bool `thrift:"result,3" db:"result" json:"result,omitempty"` + Count *int32 `thrift:"count,4" db:"count" json:"count,omitempty"` + Measurements []string `thrift:"measurements,5" db:"measurements" json:"measurements,omitempty"` } -func NewTSyncTransportMetaInfo() *TSyncTransportMetaInfo { - return &TSyncTransportMetaInfo{} +func NewTSQueryTemplateResp() *TSQueryTemplateResp { + return &TSQueryTemplateResp{} } +var TSQueryTemplateResp_Status_DEFAULT *common.TSStatus +func (p *TSQueryTemplateResp) GetStatus() *common.TSStatus { + if !p.IsSetStatus() { + return TSQueryTemplateResp_Status_DEFAULT + } +return p.Status +} -func (p *TSyncTransportMetaInfo) GetFileName() string { - return p.FileName +func (p *TSQueryTemplateResp) GetQueryType() int32 { + return p.QueryType +} +var TSQueryTemplateResp_Result__DEFAULT bool +func (p *TSQueryTemplateResp) GetResult_() bool { + if !p.IsSetResult_() { + return TSQueryTemplateResp_Result__DEFAULT + } +return *p.Result_ +} +var TSQueryTemplateResp_Count_DEFAULT int32 +func (p *TSQueryTemplateResp) GetCount() int32 { + if !p.IsSetCount() { + return TSQueryTemplateResp_Count_DEFAULT + } +return *p.Count } +var TSQueryTemplateResp_Measurements_DEFAULT []string -func (p *TSyncTransportMetaInfo) GetStartIndex() int64 { - return p.StartIndex +func (p *TSQueryTemplateResp) GetMeasurements() []string { + return p.Measurements } -func (p *TSyncTransportMetaInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSQueryTemplateResp) IsSetStatus() bool { + return p.Status != nil +} + +func (p *TSQueryTemplateResp) IsSetResult_() bool { + return p.Result_ != nil +} + +func (p *TSQueryTemplateResp) IsSetCount() bool { + return p.Count != nil +} + +func (p *TSQueryTemplateResp) IsSetMeasurements() bool { + return p.Measurements != nil +} + +func (p *TSQueryTemplateResp) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetFileName bool = false; - var issetStartIndex bool = false; + var issetStatus bool = false; + var issetQueryType bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -17493,28 +17304,58 @@ func (p *TSyncTransportMetaInfo) Read(ctx context.Context, iprot thrift.TProtoco if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.STRUCT { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetFileName = true + issetStatus = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.I32 { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetStartIndex = true + issetQueryType = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - default: + case 3: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.I32 { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 5: + if fieldTypeId == thrift.LIST { + if err := p.ReadField5(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } @@ -17526,39 +17367,81 @@ func (p *TSyncTransportMetaInfo) Read(ctx context.Context, iprot thrift.TProtoco if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetFileName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FileName is not set")); + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); } - if !issetStartIndex{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartIndex is not set")); + if !issetQueryType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field QueryType is not set")); } return nil } -func (p *TSyncTransportMetaInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) +func (p *TSQueryTemplateResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + } + return nil +} + +func (p *TSQueryTemplateResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - p.FileName = v + p.QueryType = v } return nil } -func (p *TSyncTransportMetaInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) +func (p *TSQueryTemplateResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) } else { - p.StartIndex = v + p.Result_ = &v } return nil } -func (p *TSyncTransportMetaInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSyncTransportMetaInfo"); err != nil { +func (p *TSQueryTemplateResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.Count = &v +} + return nil +} + +func (p *TSQueryTemplateResp) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.Measurements = tSlice + for i := 0; i < size; i ++ { +var _elem189 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem189 = v +} + p.Measurements = append(p.Measurements, _elem189) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSQueryTemplateResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSQueryTemplateResp"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -17567,78 +17450,140 @@ func (p *TSyncTransportMetaInfo) Write(ctx context.Context, oprot thrift.TProtoc return nil } -func (p *TSyncTransportMetaInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "fileName", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fileName: ", p), err) } - if err := oprot.WriteString(ctx, string(p.FileName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fileName (1) field write error: ", p), err) } +func (p *TSQueryTemplateResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fileName: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } -func (p *TSyncTransportMetaInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "startIndex", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:startIndex: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.StartIndex)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.startIndex (2) field write error: ", p), err) } +func (p *TSQueryTemplateResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "queryType", thrift.I32, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:queryType: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.QueryType)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.queryType (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:startIndex: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:queryType: ", p), err) } return err } -func (p *TSyncTransportMetaInfo) Equals(other *TSyncTransportMetaInfo) bool { +func (p *TSQueryTemplateResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetResult_() { + if err := oprot.WriteFieldBegin(ctx, "result", thrift.BOOL, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:result: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.Result_)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.result (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:result: ", p), err) } + } + return err +} + +func (p *TSQueryTemplateResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetCount() { + if err := oprot.WriteFieldBegin(ctx, "count", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:count: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.Count)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.count (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:count: ", p), err) } + } + return err +} + +func (p *TSQueryTemplateResp) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetMeasurements() { + if err := oprot.WriteFieldBegin(ctx, "measurements", thrift.LIST, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:measurements: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Measurements)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Measurements { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:measurements: ", p), err) } + } + return err +} + +func (p *TSQueryTemplateResp) Equals(other *TSQueryTemplateResp) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.FileName != other.FileName { return false } - if p.StartIndex != other.StartIndex { return false } + if !p.Status.Equals(other.Status) { return false } + if p.QueryType != other.QueryType { return false } + if p.Result_ != other.Result_ { + if p.Result_ == nil || other.Result_ == nil { + return false + } + if (*p.Result_) != (*other.Result_) { return false } + } + if p.Count != other.Count { + if p.Count == nil || other.Count == nil { + return false + } + if (*p.Count) != (*other.Count) { return false } + } + if len(p.Measurements) != len(other.Measurements) { return false } + for i, _tgt := range p.Measurements { + _src190 := other.Measurements[i] + if _tgt != _src190 { return false } + } return true } -func (p *TSyncTransportMetaInfo) String() string { +func (p *TSQueryTemplateResp) String() string { if p == nil { return "" } - return fmt.Sprintf("TSyncTransportMetaInfo(%+v)", *p) + return fmt.Sprintf("TSQueryTemplateResp(%+v)", *p) } // Attributes: -// - Version -// - Type -// - Body -type TPipeTransferReq struct { - Version int8 `thrift:"version,1,required" db:"version" json:"version"` - Type int16 `thrift:"type,2,required" db:"type" json:"type"` - Body []byte `thrift:"body,3,required" db:"body" json:"body"` +// - SessionId +// - PrefixPath +// - TemplateName +type TSUnsetSchemaTemplateReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + PrefixPath string `thrift:"prefixPath,2,required" db:"prefixPath" json:"prefixPath"` + TemplateName string `thrift:"templateName,3,required" db:"templateName" json:"templateName"` } -func NewTPipeTransferReq() *TPipeTransferReq { - return &TPipeTransferReq{} +func NewTSUnsetSchemaTemplateReq() *TSUnsetSchemaTemplateReq { + return &TSUnsetSchemaTemplateReq{} } -func (p *TPipeTransferReq) GetVersion() int8 { - return p.Version +func (p *TSUnsetSchemaTemplateReq) GetSessionId() int64 { + return p.SessionId } -func (p *TPipeTransferReq) GetType() int16 { - return p.Type +func (p *TSUnsetSchemaTemplateReq) GetPrefixPath() string { + return p.PrefixPath } -func (p *TPipeTransferReq) GetBody() []byte { - return p.Body +func (p *TSUnsetSchemaTemplateReq) GetTemplateName() string { + return p.TemplateName } -func (p *TPipeTransferReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSUnsetSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetVersion bool = false; - var issetType bool = false; - var issetBody bool = false; + var issetSessionId bool = false; + var issetPrefixPath bool = false; + var issetTemplateName bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -17648,22 +17593,22 @@ func (p *TPipeTransferReq) Read(ctx context.Context, iprot thrift.TProtocol) err if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.BYTE { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetVersion = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.I16 { + if fieldTypeId == thrift.STRING { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetType = true + issetPrefixPath = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17674,7 +17619,7 @@ func (p *TPipeTransferReq) Read(ctx context.Context, iprot thrift.TProtocol) err if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetBody = true + issetTemplateName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17692,48 +17637,47 @@ func (p *TPipeTransferReq) Read(ctx context.Context, iprot thrift.TProtocol) err if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetVersion{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); - } - if !issetType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetBody{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Body is not set")); + if !issetPrefixPath{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PrefixPath is not set")); + } + if !issetTemplateName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TemplateName is not set")); } return nil } -func (p *TPipeTransferReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { +func (p *TSUnsetSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - temp := int8(v) - p.Version = temp + p.SessionId = v } return nil } -func (p *TPipeTransferReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(ctx); err != nil { +func (p *TSUnsetSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.Type = v + p.PrefixPath = v } return nil } -func (p *TPipeTransferReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { +func (p *TSUnsetSchemaTemplateReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.Body = v + p.TemplateName = v } return nil } -func (p *TPipeTransferReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TPipeTransferReq"); err != nil { +func (p *TSUnsetSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSUnsetSchemaTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -17747,93 +17691,82 @@ func (p *TPipeTransferReq) Write(ctx context.Context, oprot thrift.TProtocol) er return nil } -func (p *TPipeTransferReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "version", thrift.BYTE, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } - if err := oprot.WriteByte(ctx, int8(p.Version)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } +func (p *TSUnsetSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TPipeTransferReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "type", thrift.I16, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err) } - if err := oprot.WriteI16(ctx, int16(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err) } +func (p *TSUnsetSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "prefixPath", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prefixPath: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PrefixPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.prefixPath (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prefixPath: ", p), err) } return err } -func (p *TPipeTransferReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "body", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:body: ", p), err) } - if err := oprot.WriteBinary(ctx, p.Body); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.body (3) field write error: ", p), err) } +func (p *TSUnsetSchemaTemplateReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "templateName", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:templateName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.TemplateName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.templateName (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:body: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:templateName: ", p), err) } return err } -func (p *TPipeTransferReq) Equals(other *TPipeTransferReq) bool { +func (p *TSUnsetSchemaTemplateReq) Equals(other *TSUnsetSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.Version != other.Version { return false } - if p.Type != other.Type { return false } - if bytes.Compare(p.Body, other.Body) != 0 { return false } + if p.SessionId != other.SessionId { return false } + if p.PrefixPath != other.PrefixPath { return false } + if p.TemplateName != other.TemplateName { return false } return true } -func (p *TPipeTransferReq) String() string { +func (p *TSUnsetSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TPipeTransferReq(%+v)", *p) + return fmt.Sprintf("TSUnsetSchemaTemplateReq(%+v)", *p) } // Attributes: -// - Status -// - Body -type TPipeTransferResp struct { - Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - Body []byte `thrift:"body,2" db:"body" json:"body,omitempty"` +// - SessionId +// - TemplateName +type TSDropSchemaTemplateReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + TemplateName string `thrift:"templateName,2,required" db:"templateName" json:"templateName"` } -func NewTPipeTransferResp() *TPipeTransferResp { - return &TPipeTransferResp{} +func NewTSDropSchemaTemplateReq() *TSDropSchemaTemplateReq { + return &TSDropSchemaTemplateReq{} } -var TPipeTransferResp_Status_DEFAULT *common.TSStatus -func (p *TPipeTransferResp) GetStatus() *common.TSStatus { - if !p.IsSetStatus() { - return TPipeTransferResp_Status_DEFAULT - } -return p.Status -} -var TPipeTransferResp_Body_DEFAULT []byte -func (p *TPipeTransferResp) GetBody() []byte { - return p.Body -} -func (p *TPipeTransferResp) IsSetStatus() bool { - return p.Status != nil +func (p *TSDropSchemaTemplateReq) GetSessionId() int64 { + return p.SessionId } -func (p *TPipeTransferResp) IsSetBody() bool { - return p.Body != nil +func (p *TSDropSchemaTemplateReq) GetTemplateName() string { + return p.TemplateName } - -func (p *TPipeTransferResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSDropSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetStatus bool = false; + var issetSessionId bool = false; + var issetTemplateName bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -17843,11 +17776,11 @@ func (p *TPipeTransferResp) Read(ctx context.Context, iprot thrift.TProtocol) er if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetStatus = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17858,6 +17791,7 @@ func (p *TPipeTransferResp) Read(ctx context.Context, iprot thrift.TProtocol) er if err := p.ReadField2(ctx, iprot); err != nil { return err } + issetTemplateName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -17875,31 +17809,35 @@ func (p *TPipeTransferResp) Read(ctx context.Context, iprot thrift.TProtocol) er if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); + } + if !issetTemplateName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TemplateName is not set")); } return nil } -func (p *TPipeTransferResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Status = &common.TSStatus{} - if err := p.Status.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) - } +func (p *TSDropSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.SessionId = v +} return nil } -func (p *TPipeTransferResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { +func (p *TSDropSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.Body = v + p.TemplateName = v } return nil } -func (p *TPipeTransferResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TPipeTransferResp"); err != nil { +func (p *TSDropSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSDropSchemaTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -17912,85 +17850,71 @@ func (p *TPipeTransferResp) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TPipeTransferResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } +func (p *TSDropSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TPipeTransferResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetBody() { - if err := oprot.WriteFieldBegin(ctx, "body", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:body: ", p), err) } - if err := oprot.WriteBinary(ctx, p.Body); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.body (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:body: ", p), err) } - } +func (p *TSDropSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "templateName", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:templateName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.TemplateName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.templateName (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:templateName: ", p), err) } return err } -func (p *TPipeTransferResp) Equals(other *TPipeTransferResp) bool { +func (p *TSDropSchemaTemplateReq) Equals(other *TSDropSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if !p.Status.Equals(other.Status) { return false } - if bytes.Compare(p.Body, other.Body) != 0 { return false } + if p.SessionId != other.SessionId { return false } + if p.TemplateName != other.TemplateName { return false } return true } -func (p *TPipeTransferResp) String() string { +func (p *TSDropSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TPipeTransferResp(%+v)", *p) + return fmt.Sprintf("TSDropSchemaTemplateReq(%+v)", *p) } // Attributes: -// - Version -// - Type -// - Body -type TPipeSubscribeReq struct { - Version int8 `thrift:"version,1,required" db:"version" json:"version"` - Type int16 `thrift:"type,2,required" db:"type" json:"type"` - Body []byte `thrift:"body,3" db:"body" json:"body,omitempty"` +// - SessionId +// - DevicePathList +type TCreateTimeseriesUsingSchemaTemplateReq struct { + SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` + DevicePathList []string `thrift:"devicePathList,2,required" db:"devicePathList" json:"devicePathList"` } -func NewTPipeSubscribeReq() *TPipeSubscribeReq { - return &TPipeSubscribeReq{} +func NewTCreateTimeseriesUsingSchemaTemplateReq() *TCreateTimeseriesUsingSchemaTemplateReq { + return &TCreateTimeseriesUsingSchemaTemplateReq{} } -func (p *TPipeSubscribeReq) GetVersion() int8 { - return p.Version -} - -func (p *TPipeSubscribeReq) GetType() int16 { - return p.Type +func (p *TCreateTimeseriesUsingSchemaTemplateReq) GetSessionId() int64 { + return p.SessionId } -var TPipeSubscribeReq_Body_DEFAULT []byte -func (p *TPipeSubscribeReq) GetBody() []byte { - return p.Body -} -func (p *TPipeSubscribeReq) IsSetBody() bool { - return p.Body != nil +func (p *TCreateTimeseriesUsingSchemaTemplateReq) GetDevicePathList() []string { + return p.DevicePathList } - -func (p *TPipeSubscribeReq) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TCreateTimeseriesUsingSchemaTemplateReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetVersion bool = false; - var issetType bool = false; + var issetSessionId bool = false; + var issetDevicePathList bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -18000,32 +17924,22 @@ func (p *TPipeSubscribeReq) Read(ctx context.Context, iprot thrift.TProtocol) er if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.BYTE { + if fieldTypeId == thrift.I64 { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetVersion = true + issetSessionId = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.I16 { + if fieldTypeId == thrift.LIST { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetType = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } + issetDevicePathList = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -18043,50 +17957,52 @@ func (p *TPipeSubscribeReq) Read(ctx context.Context, iprot thrift.TProtocol) er if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetVersion{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); + if !issetSessionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SessionId is not set")); } - if !issetType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + if !issetDevicePathList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DevicePathList is not set")); } return nil } -func (p *TPipeSubscribeReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { +func (p *TCreateTimeseriesUsingSchemaTemplateReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - temp := int8(v) - p.Version = temp -} - return nil -} - -func (p *TPipeSubscribeReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Type = v + p.SessionId = v } return nil } -func (p *TPipeSubscribeReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) +func (p *TCreateTimeseriesUsingSchemaTemplateReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.DevicePathList = tSlice + for i := 0; i < size; i ++ { +var _elem191 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) } else { - p.Body = v + _elem191 = v } + p.DevicePathList = append(p.DevicePathList, _elem191) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } return nil } -func (p *TPipeSubscribeReq) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TPipeSubscribeReq"); err != nil { +func (p *TCreateTimeseriesUsingSchemaTemplateReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TCreateTimeseriesUsingSchemaTemplateReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -18095,109 +18011,97 @@ func (p *TPipeSubscribeReq) Write(ctx context.Context, oprot thrift.TProtocol) e return nil } -func (p *TPipeSubscribeReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "version", thrift.BYTE, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } - if err := oprot.WriteByte(ctx, int8(p.Version)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } - return err -} - -func (p *TPipeSubscribeReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "type", thrift.I16, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err) } - if err := oprot.WriteI16(ctx, int16(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err) } +func (p *TCreateTimeseriesUsingSchemaTemplateReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "sessionId", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sessionId: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.SessionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sessionId (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sessionId: ", p), err) } return err } -func (p *TPipeSubscribeReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetBody() { - if err := oprot.WriteFieldBegin(ctx, "body", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:body: ", p), err) } - if err := oprot.WriteBinary(ctx, p.Body); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.body (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:body: ", p), err) } +func (p *TCreateTimeseriesUsingSchemaTemplateReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "devicePathList", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:devicePathList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.DevicePathList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.DevicePathList { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:devicePathList: ", p), err) } return err } -func (p *TPipeSubscribeReq) Equals(other *TPipeSubscribeReq) bool { +func (p *TCreateTimeseriesUsingSchemaTemplateReq) Equals(other *TCreateTimeseriesUsingSchemaTemplateReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.Version != other.Version { return false } - if p.Type != other.Type { return false } - if bytes.Compare(p.Body, other.Body) != 0 { return false } + if p.SessionId != other.SessionId { return false } + if len(p.DevicePathList) != len(other.DevicePathList) { return false } + for i, _tgt := range p.DevicePathList { + _src192 := other.DevicePathList[i] + if _tgt != _src192 { return false } + } return true } -func (p *TPipeSubscribeReq) String() string { +func (p *TCreateTimeseriesUsingSchemaTemplateReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TPipeSubscribeReq(%+v)", *p) + return fmt.Sprintf("TCreateTimeseriesUsingSchemaTemplateReq(%+v)", *p) } // Attributes: -// - Status +// - PipeName +// - CreateTime // - Version -// - Type -// - Body -type TPipeSubscribeResp struct { - Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - Version int8 `thrift:"version,2,required" db:"version" json:"version"` - Type int16 `thrift:"type,3,required" db:"type" json:"type"` - Body [][]byte `thrift:"body,4" db:"body" json:"body,omitempty"` +// - Database +type TSyncIdentityInfo struct { + PipeName string `thrift:"pipeName,1,required" db:"pipeName" json:"pipeName"` + CreateTime int64 `thrift:"createTime,2,required" db:"createTime" json:"createTime"` + Version string `thrift:"version,3,required" db:"version" json:"version"` + Database string `thrift:"database,4,required" db:"database" json:"database"` } -func NewTPipeSubscribeResp() *TPipeSubscribeResp { - return &TPipeSubscribeResp{} +func NewTSyncIdentityInfo() *TSyncIdentityInfo { + return &TSyncIdentityInfo{} } -var TPipeSubscribeResp_Status_DEFAULT *common.TSStatus -func (p *TPipeSubscribeResp) GetStatus() *common.TSStatus { - if !p.IsSetStatus() { - return TPipeSubscribeResp_Status_DEFAULT - } -return p.Status -} -func (p *TPipeSubscribeResp) GetVersion() int8 { - return p.Version +func (p *TSyncIdentityInfo) GetPipeName() string { + return p.PipeName } -func (p *TPipeSubscribeResp) GetType() int16 { - return p.Type +func (p *TSyncIdentityInfo) GetCreateTime() int64 { + return p.CreateTime } -var TPipeSubscribeResp_Body_DEFAULT [][]byte -func (p *TPipeSubscribeResp) GetBody() [][]byte { - return p.Body -} -func (p *TPipeSubscribeResp) IsSetStatus() bool { - return p.Status != nil +func (p *TSyncIdentityInfo) GetVersion() string { + return p.Version } -func (p *TPipeSubscribeResp) IsSetBody() bool { - return p.Body != nil +func (p *TSyncIdentityInfo) GetDatabase() string { + return p.Database } - -func (p *TPipeSubscribeResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSyncIdentityInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetStatus bool = false; + var issetPipeName bool = false; + var issetCreateTime bool = false; var issetVersion bool = false; - var issetType bool = false; + var issetDatabase bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -18207,43 +18111,44 @@ func (p *TPipeSubscribeResp) Read(ctx context.Context, iprot thrift.TProtocol) e if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.STRING { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetStatus = true + issetPipeName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.BYTE { + if fieldTypeId == thrift.I64 { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetVersion = true + issetCreateTime = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: - if fieldTypeId == thrift.I16 { + if fieldTypeId == thrift.STRING { if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetType = true + issetVersion = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRING { if err := p.ReadField4(ctx, iprot); err != nil { return err } + issetDatabase = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -18261,69 +18166,59 @@ func (p *TPipeSubscribeResp) Read(ctx context.Context, iprot thrift.TProtocol) e if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + if !issetPipeName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PipeName is not set")); + } + if !issetCreateTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CreateTime is not set")); } if !issetVersion{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); } - if !issetType{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + if !issetDatabase{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Database is not set")); } return nil } -func (p *TPipeSubscribeResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Status = &common.TSStatus{} - if err := p.Status.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) - } +func (p *TSyncIdentityInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.PipeName = v +} return nil } -func (p *TPipeSubscribeResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadByte(ctx); err != nil { +func (p *TSyncIdentityInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - temp := int8(v) - p.Version = temp + p.CreateTime = v } return nil } -func (p *TPipeSubscribeResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(ctx); err != nil { +func (p *TSyncIdentityInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.Type = v + p.Version = v } return nil } -func (p *TPipeSubscribeResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([][]byte, 0, size) - p.Body = tSlice - for i := 0; i < size; i ++ { -var _elem193 []byte - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 0: ", err) +func (p *TSyncIdentityInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) } else { - _elem193 = v + p.Database = v } - p.Body = append(p.Body, _elem193) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } return nil } -func (p *TPipeSubscribeResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TPipeSubscribeResp"); err != nil { +func (p *TSyncIdentityInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSyncIdentityInfo"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -18338,147 +18233,93 @@ func (p *TPipeSubscribeResp) Write(ctx context.Context, oprot thrift.TProtocol) return nil } -func (p *TPipeSubscribeResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } +func (p *TSyncIdentityInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "pipeName", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:pipeName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.PipeName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.pipeName (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:pipeName: ", p), err) } return err } -func (p *TPipeSubscribeResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "version", thrift.BYTE, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:version: ", p), err) } - if err := oprot.WriteByte(ctx, int8(p.Version)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.version (2) field write error: ", p), err) } +func (p *TSyncIdentityInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "createTime", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:createTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.CreateTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.createTime (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:version: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:createTime: ", p), err) } return err } -func (p *TPipeSubscribeResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "type", thrift.I16, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:type: ", p), err) } - if err := oprot.WriteI16(ctx, int16(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.type (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:type: ", p), err) } +func (p *TSyncIdentityInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:version: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:version: ", p), err) } return err } -func (p *TPipeSubscribeResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetBody() { - if err := oprot.WriteFieldBegin(ctx, "body", thrift.LIST, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:body: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Body)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Body { - if err := oprot.WriteBinary(ctx, v); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:body: ", p), err) } - } +func (p *TSyncIdentityInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "database", thrift.STRING, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:database: ", p), err) } + if err := oprot.WriteString(ctx, string(p.Database)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.database (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:database: ", p), err) } return err } -func (p *TPipeSubscribeResp) Equals(other *TPipeSubscribeResp) bool { +func (p *TSyncIdentityInfo) Equals(other *TSyncIdentityInfo) bool { if p == other { return true } else if p == nil || other == nil { return false } - if !p.Status.Equals(other.Status) { return false } + if p.PipeName != other.PipeName { return false } + if p.CreateTime != other.CreateTime { return false } if p.Version != other.Version { return false } - if p.Type != other.Type { return false } - if len(p.Body) != len(other.Body) { return false } - for i, _tgt := range p.Body { - _src194 := other.Body[i] - if bytes.Compare(_tgt, _src194) != 0 { return false } - } + if p.Database != other.Database { return false } return true } -func (p *TPipeSubscribeResp) String() string { +func (p *TSyncIdentityInfo) String() string { if p == nil { return "" } - return fmt.Sprintf("TPipeSubscribeResp(%+v)", *p) + return fmt.Sprintf("TSyncIdentityInfo(%+v)", *p) } // Attributes: -// - Status -// - EnableOperationSync -// - SecondaryAddress -// - SecondaryPort -type TSBackupConfigurationResp struct { - Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` - EnableOperationSync *bool `thrift:"enableOperationSync,2" db:"enableOperationSync" json:"enableOperationSync,omitempty"` - SecondaryAddress *string `thrift:"secondaryAddress,3" db:"secondaryAddress" json:"secondaryAddress,omitempty"` - SecondaryPort *int32 `thrift:"secondaryPort,4" db:"secondaryPort" json:"secondaryPort,omitempty"` -} - -func NewTSBackupConfigurationResp() *TSBackupConfigurationResp { - return &TSBackupConfigurationResp{} +// - FileName +// - StartIndex +type TSyncTransportMetaInfo struct { + FileName string `thrift:"fileName,1,required" db:"fileName" json:"fileName"` + StartIndex int64 `thrift:"startIndex,2,required" db:"startIndex" json:"startIndex"` } -var TSBackupConfigurationResp_Status_DEFAULT *common.TSStatus -func (p *TSBackupConfigurationResp) GetStatus() *common.TSStatus { - if !p.IsSetStatus() { - return TSBackupConfigurationResp_Status_DEFAULT - } -return p.Status -} -var TSBackupConfigurationResp_EnableOperationSync_DEFAULT bool -func (p *TSBackupConfigurationResp) GetEnableOperationSync() bool { - if !p.IsSetEnableOperationSync() { - return TSBackupConfigurationResp_EnableOperationSync_DEFAULT - } -return *p.EnableOperationSync -} -var TSBackupConfigurationResp_SecondaryAddress_DEFAULT string -func (p *TSBackupConfigurationResp) GetSecondaryAddress() string { - if !p.IsSetSecondaryAddress() { - return TSBackupConfigurationResp_SecondaryAddress_DEFAULT - } -return *p.SecondaryAddress -} -var TSBackupConfigurationResp_SecondaryPort_DEFAULT int32 -func (p *TSBackupConfigurationResp) GetSecondaryPort() int32 { - if !p.IsSetSecondaryPort() { - return TSBackupConfigurationResp_SecondaryPort_DEFAULT - } -return *p.SecondaryPort -} -func (p *TSBackupConfigurationResp) IsSetStatus() bool { - return p.Status != nil +func NewTSyncTransportMetaInfo() *TSyncTransportMetaInfo { + return &TSyncTransportMetaInfo{} } -func (p *TSBackupConfigurationResp) IsSetEnableOperationSync() bool { - return p.EnableOperationSync != nil -} -func (p *TSBackupConfigurationResp) IsSetSecondaryAddress() bool { - return p.SecondaryAddress != nil +func (p *TSyncTransportMetaInfo) GetFileName() string { + return p.FileName } -func (p *TSBackupConfigurationResp) IsSetSecondaryPort() bool { - return p.SecondaryPort != nil +func (p *TSyncTransportMetaInfo) GetStartIndex() int64 { + return p.StartIndex } - -func (p *TSBackupConfigurationResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSyncTransportMetaInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetStatus bool = false; + var issetFileName bool = false; + var issetStartIndex bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -18488,41 +18329,22 @@ func (p *TSBackupConfigurationResp) Read(ctx context.Context, iprot thrift.TProt if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.STRING { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetStatus = true + issetFileName = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.BOOL { + if fieldTypeId == thrift.I64 { if err := p.ReadField2(ctx, iprot); err != nil { return err } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I32 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } + issetStartIndex = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -18540,55 +18362,39 @@ func (p *TSBackupConfigurationResp) Read(ctx context.Context, iprot thrift.TProt if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetStatus{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + if !issetFileName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FileName is not set")); } - return nil -} - -func (p *TSBackupConfigurationResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Status = &common.TSStatus{} - if err := p.Status.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + if !issetStartIndex{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartIndex is not set")); } return nil } -func (p *TSBackupConfigurationResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.EnableOperationSync = &v -} - return nil -} - -func (p *TSBackupConfigurationResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TSyncTransportMetaInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) + return thrift.PrependError("error reading field 1: ", err) } else { - p.SecondaryAddress = &v + p.FileName = v } return nil } -func (p *TSBackupConfigurationResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) +func (p *TSyncTransportMetaInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) } else { - p.SecondaryPort = &v + p.StartIndex = v } return nil } -func (p *TSBackupConfigurationResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSBackupConfigurationResp"); err != nil { +func (p *TSyncTransportMetaInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSyncTransportMetaInfo"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } - if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -18597,129 +18403,78 @@ func (p *TSBackupConfigurationResp) Write(ctx context.Context, oprot thrift.TPro return nil } -func (p *TSBackupConfigurationResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } +func (p *TSyncTransportMetaInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "fileName", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fileName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.FileName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.fileName (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } - return err -} - -func (p *TSBackupConfigurationResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetEnableOperationSync() { - if err := oprot.WriteFieldBegin(ctx, "enableOperationSync", thrift.BOOL, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:enableOperationSync: ", p), err) } - if err := oprot.WriteBool(ctx, bool(*p.EnableOperationSync)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.enableOperationSync (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:enableOperationSync: ", p), err) } - } - return err -} - -func (p *TSBackupConfigurationResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSecondaryAddress() { - if err := oprot.WriteFieldBegin(ctx, "secondaryAddress", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:secondaryAddress: ", p), err) } - if err := oprot.WriteString(ctx, string(*p.SecondaryAddress)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.secondaryAddress (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:secondaryAddress: ", p), err) } - } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fileName: ", p), err) } return err } -func (p *TSBackupConfigurationResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSecondaryPort() { - if err := oprot.WriteFieldBegin(ctx, "secondaryPort", thrift.I32, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:secondaryPort: ", p), err) } - if err := oprot.WriteI32(ctx, int32(*p.SecondaryPort)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.secondaryPort (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:secondaryPort: ", p), err) } - } +func (p *TSyncTransportMetaInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "startIndex", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:startIndex: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.StartIndex)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.startIndex (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:startIndex: ", p), err) } return err } -func (p *TSBackupConfigurationResp) Equals(other *TSBackupConfigurationResp) bool { +func (p *TSyncTransportMetaInfo) Equals(other *TSyncTransportMetaInfo) bool { if p == other { return true } else if p == nil || other == nil { return false } - if !p.Status.Equals(other.Status) { return false } - if p.EnableOperationSync != other.EnableOperationSync { - if p.EnableOperationSync == nil || other.EnableOperationSync == nil { - return false - } - if (*p.EnableOperationSync) != (*other.EnableOperationSync) { return false } + if p.FileName != other.FileName { return false } + if p.StartIndex != other.StartIndex { return false } + return true +} + +func (p *TSyncTransportMetaInfo) String() string { + if p == nil { + return "" } - if p.SecondaryAddress != other.SecondaryAddress { - if p.SecondaryAddress == nil || other.SecondaryAddress == nil { - return false - } - if (*p.SecondaryAddress) != (*other.SecondaryAddress) { return false } - } - if p.SecondaryPort != other.SecondaryPort { - if p.SecondaryPort == nil || other.SecondaryPort == nil { - return false - } - if (*p.SecondaryPort) != (*other.SecondaryPort) { return false } - } - return true -} - -func (p *TSBackupConfigurationResp) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TSBackupConfigurationResp(%+v)", *p) + return fmt.Sprintf("TSyncTransportMetaInfo(%+v)", *p) } // Attributes: -// - UserName -// - LogInTime -// - ConnectionId +// - Version // - Type -type TSConnectionInfo struct { - UserName string `thrift:"userName,1,required" db:"userName" json:"userName"` - LogInTime int64 `thrift:"logInTime,2,required" db:"logInTime" json:"logInTime"` - ConnectionId string `thrift:"connectionId,3,required" db:"connectionId" json:"connectionId"` - Type TSConnectionType `thrift:"type,4,required" db:"type" json:"type"` +// - Body +type TPipeTransferReq struct { + Version int8 `thrift:"version,1,required" db:"version" json:"version"` + Type int16 `thrift:"type,2,required" db:"type" json:"type"` + Body []byte `thrift:"body,3,required" db:"body" json:"body"` } -func NewTSConnectionInfo() *TSConnectionInfo { - return &TSConnectionInfo{} +func NewTPipeTransferReq() *TPipeTransferReq { + return &TPipeTransferReq{} } -func (p *TSConnectionInfo) GetUserName() string { - return p.UserName -} - -func (p *TSConnectionInfo) GetLogInTime() int64 { - return p.LogInTime +func (p *TPipeTransferReq) GetVersion() int8 { + return p.Version } -func (p *TSConnectionInfo) GetConnectionId() string { - return p.ConnectionId +func (p *TPipeTransferReq) GetType() int16 { + return p.Type } -func (p *TSConnectionInfo) GetType() TSConnectionType { - return p.Type +func (p *TPipeTransferReq) GetBody() []byte { + return p.Body } -func (p *TSConnectionInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TPipeTransferReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetUserName bool = false; - var issetLogInTime bool = false; - var issetConnectionId bool = false; + var issetVersion bool = false; var issetType bool = false; + var issetBody bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -18729,22 +18484,22 @@ func (p *TSConnectionInfo) Read(ctx context.Context, iprot thrift.TProtocol) err if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.BYTE { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetUserName = true + issetVersion = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: - if fieldTypeId == thrift.I64 { + if fieldTypeId == thrift.I16 { if err := p.ReadField2(ctx, iprot); err != nil { return err } - issetLogInTime = true + issetType = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -18755,18 +18510,7 @@ func (p *TSConnectionInfo) Read(ctx context.Context, iprot thrift.TProtocol) err if err := p.ReadField3(ctx, iprot); err != nil { return err } - issetConnectionId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I32 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetType = true + issetBody = true } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -18784,66 +18528,53 @@ func (p *TSConnectionInfo) Read(ctx context.Context, iprot thrift.TProtocol) err if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetUserName{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field UserName is not set")); - } - if !issetLogInTime{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field LogInTime is not set")); - } - if !issetConnectionId{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ConnectionId is not set")); + if !issetVersion{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); } if !issetType{ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); } + if !issetBody{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Body is not set")); + } return nil } -func (p *TSConnectionInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TPipeTransferReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadByte(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - p.UserName = v + temp := int8(v) + p.Version = temp } return nil } -func (p *TSConnectionInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { +func (p *TPipeTransferReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI16(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.LogInTime = v + p.Type = v } return nil } -func (p *TSConnectionInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { +func (p *TPipeTransferReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.ConnectionId = v -} - return nil -} - -func (p *TSConnectionInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - temp := TSConnectionType(v) - p.Type = temp + p.Body = v } return nil } -func (p *TSConnectionInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSConnectionInfo"); err != nil { +func (p *TPipeTransferReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TPipeTransferReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } if err := p.writeField3(ctx, oprot); err != nil { return err } - if err := p.writeField4(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -18852,86 +18583,93 @@ func (p *TSConnectionInfo) Write(ctx context.Context, oprot thrift.TProtocol) er return nil } -func (p *TSConnectionInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "userName", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:userName: ", p), err) } - if err := oprot.WriteString(ctx, string(p.UserName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.userName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:userName: ", p), err) } - return err -} - -func (p *TSConnectionInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "logInTime", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:logInTime: ", p), err) } - if err := oprot.WriteI64(ctx, int64(p.LogInTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.logInTime (2) field write error: ", p), err) } +func (p *TPipeTransferReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.BYTE, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } + if err := oprot.WriteByte(ctx, int8(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:logInTime: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } return err } -func (p *TSConnectionInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "connectionId", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:connectionId: ", p), err) } - if err := oprot.WriteString(ctx, string(p.ConnectionId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.connectionId (3) field write error: ", p), err) } +func (p *TPipeTransferReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "type", thrift.I16, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err) } + if err := oprot.WriteI16(ctx, int16(p.Type)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:connectionId: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err) } return err } -func (p *TSConnectionInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:type: ", p), err) } - if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.type (4) field write error: ", p), err) } +func (p *TPipeTransferReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "body", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:body: ", p), err) } + if err := oprot.WriteBinary(ctx, p.Body); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.body (3) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:type: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:body: ", p), err) } return err } -func (p *TSConnectionInfo) Equals(other *TSConnectionInfo) bool { +func (p *TPipeTransferReq) Equals(other *TPipeTransferReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if p.UserName != other.UserName { return false } - if p.LogInTime != other.LogInTime { return false } - if p.ConnectionId != other.ConnectionId { return false } + if p.Version != other.Version { return false } if p.Type != other.Type { return false } + if bytes.Compare(p.Body, other.Body) != 0 { return false } return true } -func (p *TSConnectionInfo) String() string { +func (p *TPipeTransferReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSConnectionInfo(%+v)", *p) + return fmt.Sprintf("TPipeTransferReq(%+v)", *p) } // Attributes: -// - ConnectionInfoList -type TSConnectionInfoResp struct { - ConnectionInfoList []*TSConnectionInfo `thrift:"connectionInfoList,1,required" db:"connectionInfoList" json:"connectionInfoList"` +// - Status +// - Body +type TPipeTransferResp struct { + Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` + Body []byte `thrift:"body,2" db:"body" json:"body,omitempty"` } -func NewTSConnectionInfoResp() *TSConnectionInfoResp { - return &TSConnectionInfoResp{} +func NewTPipeTransferResp() *TPipeTransferResp { + return &TPipeTransferResp{} } +var TPipeTransferResp_Status_DEFAULT *common.TSStatus +func (p *TPipeTransferResp) GetStatus() *common.TSStatus { + if !p.IsSetStatus() { + return TPipeTransferResp_Status_DEFAULT + } +return p.Status +} +var TPipeTransferResp_Body_DEFAULT []byte -func (p *TSConnectionInfoResp) GetConnectionInfoList() []*TSConnectionInfo { - return p.ConnectionInfoList +func (p *TPipeTransferResp) GetBody() []byte { + return p.Body } -func (p *TSConnectionInfoResp) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *TPipeTransferResp) IsSetStatus() bool { + return p.Status != nil +} + +func (p *TPipeTransferResp) IsSetBody() bool { + return p.Body != nil +} + +func (p *TPipeTransferResp) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - var issetConnectionInfoList bool = false; + var issetStatus bool = false; for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) @@ -18941,11 +18679,21 @@ func (p *TSConnectionInfoResp) Read(ctx context.Context, iprot thrift.TProtocol) if fieldTypeId == thrift.STOP { break; } switch fieldId { case 1: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRUCT { if err := p.ReadField1(ctx, iprot); err != nil { return err } - issetConnectionInfoList = true + issetStatus = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRING { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } } else { if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -18963,37 +18711,35 @@ func (p *TSConnectionInfoResp) Read(ctx context.Context, iprot thrift.TProtocol) if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if !issetConnectionInfoList{ - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ConnectionInfoList is not set")); + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); } return nil } -func (p *TSConnectionInfoResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*TSConnectionInfo, 0, size) - p.ConnectionInfoList = tSlice - for i := 0; i < size; i ++ { - _elem195 := &TSConnectionInfo{} - if err := _elem195.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem195), err) - } - p.ConnectionInfoList = append(p.ConnectionInfoList, _elem195) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) +func (p *TPipeTransferResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) } return nil } -func (p *TSConnectionInfoResp) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "TSConnectionInfoResp"); err != nil { +func (p *TPipeTransferResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.Body = v +} + return nil +} + +func (p *TPipeTransferResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TPipeTransferResp"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -19002,54 +18748,1144 @@ func (p *TSConnectionInfoResp) Write(ctx context.Context, oprot thrift.TProtocol return nil } -func (p *TSConnectionInfoResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "connectionInfoList", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:connectionInfoList: ", p), err) } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.ConnectionInfoList)); err != nil { - return thrift.PrependError("error writing list begin: ", err) +func (p *TPipeTransferResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) } - for _, v := range p.ConnectionInfoList { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return err +} + +func (p *TPipeTransferResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetBody() { + if err := oprot.WriteFieldBegin(ctx, "body", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:body: ", p), err) } + if err := oprot.WriteBinary(ctx, p.Body); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.body (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:body: ", p), err) } + } + return err +} + +func (p *TPipeTransferResp) Equals(other *TPipeTransferResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Status.Equals(other.Status) { return false } + if bytes.Compare(p.Body, other.Body) != 0 { return false } + return true +} + +func (p *TPipeTransferResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TPipeTransferResp(%+v)", *p) +} + +// Attributes: +// - Version +// - Type +// - Body +type TPipeSubscribeReq struct { + Version int8 `thrift:"version,1,required" db:"version" json:"version"` + Type int16 `thrift:"type,2,required" db:"type" json:"type"` + Body []byte `thrift:"body,3" db:"body" json:"body,omitempty"` +} + +func NewTPipeSubscribeReq() *TPipeSubscribeReq { + return &TPipeSubscribeReq{} +} + + +func (p *TPipeSubscribeReq) GetVersion() int8 { + return p.Version +} + +func (p *TPipeSubscribeReq) GetType() int16 { + return p.Type +} +var TPipeSubscribeReq_Body_DEFAULT []byte + +func (p *TPipeSubscribeReq) GetBody() []byte { + return p.Body +} +func (p *TPipeSubscribeReq) IsSetBody() bool { + return p.Body != nil +} + +func (p *TPipeSubscribeReq) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetVersion bool = false; + var issetType bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.BYTE { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetVersion = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.I16 { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetType = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.STRING { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err } } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetVersion{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); + } + if !issetType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + } + return nil +} + +func (p *TPipeSubscribeReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadByte(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + temp := int8(v) + p.Version = temp +} + return nil +} + +func (p *TPipeSubscribeReq) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI16(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.Type = v +} + return nil +} + +func (p *TPipeSubscribeReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.Body = v +} + return nil +} + +func (p *TPipeSubscribeReq) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TPipeSubscribeReq"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TPipeSubscribeReq) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.BYTE, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } + if err := oprot.WriteByte(ctx, int8(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:connectionInfoList: ", p), err) } + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } return err } -func (p *TSConnectionInfoResp) Equals(other *TSConnectionInfoResp) bool { +func (p *TPipeSubscribeReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "type", thrift.I16, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err) } + if err := oprot.WriteI16(ctx, int16(p.Type)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err) } + return err +} + +func (p *TPipeSubscribeReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetBody() { + if err := oprot.WriteFieldBegin(ctx, "body", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:body: ", p), err) } + if err := oprot.WriteBinary(ctx, p.Body); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.body (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:body: ", p), err) } + } + return err +} + +func (p *TPipeSubscribeReq) Equals(other *TPipeSubscribeReq) bool { if p == other { return true } else if p == nil || other == nil { return false } - if len(p.ConnectionInfoList) != len(other.ConnectionInfoList) { return false } - for i, _tgt := range p.ConnectionInfoList { - _src196 := other.ConnectionInfoList[i] - if !_tgt.Equals(_src196) { return false } - } + if p.Version != other.Version { return false } + if p.Type != other.Type { return false } + if bytes.Compare(p.Body, other.Body) != 0 { return false } return true } -func (p *TSConnectionInfoResp) String() string { +func (p *TPipeSubscribeReq) String() string { if p == nil { return "" } - return fmt.Sprintf("TSConnectionInfoResp(%+v)", *p) + return fmt.Sprintf("TPipeSubscribeReq(%+v)", *p) } -type IClientRPCService interface { - // Parameters: - // - Req - ExecuteQueryStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) - // Parameters: - // - Req - ExecuteUpdateStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) - // Parameters: +// Attributes: +// - Status +// - Version +// - Type +// - Body +type TPipeSubscribeResp struct { + Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` + Version int8 `thrift:"version,2,required" db:"version" json:"version"` + Type int16 `thrift:"type,3,required" db:"type" json:"type"` + Body [][]byte `thrift:"body,4" db:"body" json:"body,omitempty"` +} + +func NewTPipeSubscribeResp() *TPipeSubscribeResp { + return &TPipeSubscribeResp{} +} + +var TPipeSubscribeResp_Status_DEFAULT *common.TSStatus +func (p *TPipeSubscribeResp) GetStatus() *common.TSStatus { + if !p.IsSetStatus() { + return TPipeSubscribeResp_Status_DEFAULT + } +return p.Status +} + +func (p *TPipeSubscribeResp) GetVersion() int8 { + return p.Version +} + +func (p *TPipeSubscribeResp) GetType() int16 { + return p.Type +} +var TPipeSubscribeResp_Body_DEFAULT [][]byte + +func (p *TPipeSubscribeResp) GetBody() [][]byte { + return p.Body +} +func (p *TPipeSubscribeResp) IsSetStatus() bool { + return p.Status != nil +} + +func (p *TPipeSubscribeResp) IsSetBody() bool { + return p.Body != nil +} + +func (p *TPipeSubscribeResp) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetStatus bool = false; + var issetVersion bool = false; + var issetType bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetStatus = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.BYTE { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetVersion = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.I16 { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + issetType = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.LIST { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + } + if !issetVersion{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); + } + if !issetType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + } + return nil +} + +func (p *TPipeSubscribeResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + } + return nil +} + +func (p *TPipeSubscribeResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadByte(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + temp := int8(v) + p.Version = temp +} + return nil +} + +func (p *TPipeSubscribeResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI16(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.Type = v +} + return nil +} + +func (p *TPipeSubscribeResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([][]byte, 0, size) + p.Body = tSlice + for i := 0; i < size; i ++ { +var _elem193 []byte + if v, err := iprot.ReadBinary(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem193 = v +} + p.Body = append(p.Body, _elem193) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TPipeSubscribeResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TPipeSubscribeResp"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TPipeSubscribeResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return err +} + +func (p *TPipeSubscribeResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.BYTE, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:version: ", p), err) } + if err := oprot.WriteByte(ctx, int8(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:version: ", p), err) } + return err +} + +func (p *TPipeSubscribeResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "type", thrift.I16, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:type: ", p), err) } + if err := oprot.WriteI16(ctx, int16(p.Type)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.type (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:type: ", p), err) } + return err +} + +func (p *TPipeSubscribeResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetBody() { + if err := oprot.WriteFieldBegin(ctx, "body", thrift.LIST, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:body: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.Body)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Body { + if err := oprot.WriteBinary(ctx, v); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:body: ", p), err) } + } + return err +} + +func (p *TPipeSubscribeResp) Equals(other *TPipeSubscribeResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Status.Equals(other.Status) { return false } + if p.Version != other.Version { return false } + if p.Type != other.Type { return false } + if len(p.Body) != len(other.Body) { return false } + for i, _tgt := range p.Body { + _src194 := other.Body[i] + if bytes.Compare(_tgt, _src194) != 0 { return false } + } + return true +} + +func (p *TPipeSubscribeResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TPipeSubscribeResp(%+v)", *p) +} + +// Attributes: +// - Status +// - EnableOperationSync +// - SecondaryAddress +// - SecondaryPort +type TSBackupConfigurationResp struct { + Status *common.TSStatus `thrift:"status,1,required" db:"status" json:"status"` + EnableOperationSync *bool `thrift:"enableOperationSync,2" db:"enableOperationSync" json:"enableOperationSync,omitempty"` + SecondaryAddress *string `thrift:"secondaryAddress,3" db:"secondaryAddress" json:"secondaryAddress,omitempty"` + SecondaryPort *int32 `thrift:"secondaryPort,4" db:"secondaryPort" json:"secondaryPort,omitempty"` +} + +func NewTSBackupConfigurationResp() *TSBackupConfigurationResp { + return &TSBackupConfigurationResp{} +} + +var TSBackupConfigurationResp_Status_DEFAULT *common.TSStatus +func (p *TSBackupConfigurationResp) GetStatus() *common.TSStatus { + if !p.IsSetStatus() { + return TSBackupConfigurationResp_Status_DEFAULT + } +return p.Status +} +var TSBackupConfigurationResp_EnableOperationSync_DEFAULT bool +func (p *TSBackupConfigurationResp) GetEnableOperationSync() bool { + if !p.IsSetEnableOperationSync() { + return TSBackupConfigurationResp_EnableOperationSync_DEFAULT + } +return *p.EnableOperationSync +} +var TSBackupConfigurationResp_SecondaryAddress_DEFAULT string +func (p *TSBackupConfigurationResp) GetSecondaryAddress() string { + if !p.IsSetSecondaryAddress() { + return TSBackupConfigurationResp_SecondaryAddress_DEFAULT + } +return *p.SecondaryAddress +} +var TSBackupConfigurationResp_SecondaryPort_DEFAULT int32 +func (p *TSBackupConfigurationResp) GetSecondaryPort() int32 { + if !p.IsSetSecondaryPort() { + return TSBackupConfigurationResp_SecondaryPort_DEFAULT + } +return *p.SecondaryPort +} +func (p *TSBackupConfigurationResp) IsSetStatus() bool { + return p.Status != nil +} + +func (p *TSBackupConfigurationResp) IsSetEnableOperationSync() bool { + return p.EnableOperationSync != nil +} + +func (p *TSBackupConfigurationResp) IsSetSecondaryAddress() bool { + return p.SecondaryAddress != nil +} + +func (p *TSBackupConfigurationResp) IsSetSecondaryPort() bool { + return p.SecondaryPort != nil +} + +func (p *TSBackupConfigurationResp) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetStatus bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetStatus = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.STRING { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.I32 { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetStatus{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Status is not set")); + } + return nil +} + +func (p *TSBackupConfigurationResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Status = &common.TSStatus{} + if err := p.Status.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + } + return nil +} + +func (p *TSBackupConfigurationResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.EnableOperationSync = &v +} + return nil +} + +func (p *TSBackupConfigurationResp) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.SecondaryAddress = &v +} + return nil +} + +func (p *TSBackupConfigurationResp) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.SecondaryPort = &v +} + return nil +} + +func (p *TSBackupConfigurationResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSBackupConfigurationResp"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TSBackupConfigurationResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } + if err := p.Status.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } + return err +} + +func (p *TSBackupConfigurationResp) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetEnableOperationSync() { + if err := oprot.WriteFieldBegin(ctx, "enableOperationSync", thrift.BOOL, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:enableOperationSync: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.EnableOperationSync)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.enableOperationSync (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:enableOperationSync: ", p), err) } + } + return err +} + +func (p *TSBackupConfigurationResp) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetSecondaryAddress() { + if err := oprot.WriteFieldBegin(ctx, "secondaryAddress", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:secondaryAddress: ", p), err) } + if err := oprot.WriteString(ctx, string(*p.SecondaryAddress)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.secondaryAddress (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:secondaryAddress: ", p), err) } + } + return err +} + +func (p *TSBackupConfigurationResp) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetSecondaryPort() { + if err := oprot.WriteFieldBegin(ctx, "secondaryPort", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:secondaryPort: ", p), err) } + if err := oprot.WriteI32(ctx, int32(*p.SecondaryPort)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.secondaryPort (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:secondaryPort: ", p), err) } + } + return err +} + +func (p *TSBackupConfigurationResp) Equals(other *TSBackupConfigurationResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Status.Equals(other.Status) { return false } + if p.EnableOperationSync != other.EnableOperationSync { + if p.EnableOperationSync == nil || other.EnableOperationSync == nil { + return false + } + if (*p.EnableOperationSync) != (*other.EnableOperationSync) { return false } + } + if p.SecondaryAddress != other.SecondaryAddress { + if p.SecondaryAddress == nil || other.SecondaryAddress == nil { + return false + } + if (*p.SecondaryAddress) != (*other.SecondaryAddress) { return false } + } + if p.SecondaryPort != other.SecondaryPort { + if p.SecondaryPort == nil || other.SecondaryPort == nil { + return false + } + if (*p.SecondaryPort) != (*other.SecondaryPort) { return false } + } + return true +} + +func (p *TSBackupConfigurationResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TSBackupConfigurationResp(%+v)", *p) +} + +// Attributes: +// - UserName +// - LogInTime +// - ConnectionId +// - Type +type TSConnectionInfo struct { + UserName string `thrift:"userName,1,required" db:"userName" json:"userName"` + LogInTime int64 `thrift:"logInTime,2,required" db:"logInTime" json:"logInTime"` + ConnectionId string `thrift:"connectionId,3,required" db:"connectionId" json:"connectionId"` + Type TSConnectionType `thrift:"type,4,required" db:"type" json:"type"` +} + +func NewTSConnectionInfo() *TSConnectionInfo { + return &TSConnectionInfo{} +} + + +func (p *TSConnectionInfo) GetUserName() string { + return p.UserName +} + +func (p *TSConnectionInfo) GetLogInTime() int64 { + return p.LogInTime +} + +func (p *TSConnectionInfo) GetConnectionId() string { + return p.ConnectionId +} + +func (p *TSConnectionInfo) GetType() TSConnectionType { + return p.Type +} +func (p *TSConnectionInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetUserName bool = false; + var issetLogInTime bool = false; + var issetConnectionId bool = false; + var issetType bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetUserName = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.I64 { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetLogInTime = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.STRING { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + issetConnectionId = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.I32 { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + issetType = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetUserName{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field UserName is not set")); + } + if !issetLogInTime{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field LogInTime is not set")); + } + if !issetConnectionId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ConnectionId is not set")); + } + if !issetType{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); + } + return nil +} + +func (p *TSConnectionInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.UserName = v +} + return nil +} + +func (p *TSConnectionInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.LogInTime = v +} + return nil +} + +func (p *TSConnectionInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.ConnectionId = v +} + return nil +} + +func (p *TSConnectionInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + temp := TSConnectionType(v) + p.Type = temp +} + return nil +} + +func (p *TSConnectionInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSConnectionInfo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TSConnectionInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "userName", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:userName: ", p), err) } + if err := oprot.WriteString(ctx, string(p.UserName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.userName (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:userName: ", p), err) } + return err +} + +func (p *TSConnectionInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "logInTime", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:logInTime: ", p), err) } + if err := oprot.WriteI64(ctx, int64(p.LogInTime)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.logInTime (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:logInTime: ", p), err) } + return err +} + +func (p *TSConnectionInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "connectionId", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:connectionId: ", p), err) } + if err := oprot.WriteString(ctx, string(p.ConnectionId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.connectionId (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:connectionId: ", p), err) } + return err +} + +func (p *TSConnectionInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:type: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.type (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:type: ", p), err) } + return err +} + +func (p *TSConnectionInfo) Equals(other *TSConnectionInfo) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.UserName != other.UserName { return false } + if p.LogInTime != other.LogInTime { return false } + if p.ConnectionId != other.ConnectionId { return false } + if p.Type != other.Type { return false } + return true +} + +func (p *TSConnectionInfo) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TSConnectionInfo(%+v)", *p) +} + +// Attributes: +// - ConnectionInfoList +type TSConnectionInfoResp struct { + ConnectionInfoList []*TSConnectionInfo `thrift:"connectionInfoList,1,required" db:"connectionInfoList" json:"connectionInfoList"` +} + +func NewTSConnectionInfoResp() *TSConnectionInfoResp { + return &TSConnectionInfoResp{} +} + + +func (p *TSConnectionInfoResp) GetConnectionInfoList() []*TSConnectionInfo { + return p.ConnectionInfoList +} +func (p *TSConnectionInfoResp) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetConnectionInfoList bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.LIST { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetConnectionInfoList = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetConnectionInfoList{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ConnectionInfoList is not set")); + } + return nil +} + +func (p *TSConnectionInfoResp) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]*TSConnectionInfo, 0, size) + p.ConnectionInfoList = tSlice + for i := 0; i < size; i ++ { + _elem195 := &TSConnectionInfo{} + if err := _elem195.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem195), err) + } + p.ConnectionInfoList = append(p.ConnectionInfoList, _elem195) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *TSConnectionInfoResp) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TSConnectionInfoResp"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TSConnectionInfoResp) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "connectionInfoList", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:connectionInfoList: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.ConnectionInfoList)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.ConnectionInfoList { + if err := v.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:connectionInfoList: ", p), err) } + return err +} + +func (p *TSConnectionInfoResp) Equals(other *TSConnectionInfoResp) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.ConnectionInfoList) != len(other.ConnectionInfoList) { return false } + for i, _tgt := range p.ConnectionInfoList { + _src196 := other.ConnectionInfoList[i] + if !_tgt.Equals(_src196) { return false } + } + return true +} + +func (p *TSConnectionInfoResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TSConnectionInfoResp(%+v)", *p) +} + +type IClientRPCService interface { + // Parameters: + // - Req + ExecuteQueryStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) + // Parameters: + // - Req + ExecuteUpdateStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) + // Parameters: // - Req ExecuteStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) // Parameters: @@ -19101,6 +19937,15 @@ type IClientRPCService interface { // - Req CloseOperation(ctx context.Context, req *TSCloseOperationReq) (_r *common.TSStatus, _err error) // Parameters: + // - Req + PrepareStatement(ctx context.Context, req *TSPrepareReq) (_r *TSPrepareResp, _err error) + // Parameters: + // - Req + ExecutePreparedStatement(ctx context.Context, req *TSExecutePreparedReq) (_r *TSExecuteStatementResp, _err error) + // Parameters: + // - Req + DeallocatePreparedStatement(ctx context.Context, req *TSDeallocatePreparedReq) (_r *common.TSStatus, _err error) + // Parameters: // - SessionId GetTimeZone(ctx context.Context, sessionId int64) (_r *TSGetTimeZoneResp, _err error) // Parameters: @@ -19238,1143 +20083,1823 @@ type IClientRPCService interface { TestConnectionEmptyRPC(ctx context.Context) (_r *common.TSStatus, _err error) } -type IClientRPCServiceClient struct { - c thrift.TClient - meta thrift.ResponseMeta +type IClientRPCServiceClient struct { + c thrift.TClient + meta thrift.ResponseMeta +} + +func NewIClientRPCServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *IClientRPCServiceClient { + return &IClientRPCServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewIClientRPCServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *IClientRPCServiceClient { + return &IClientRPCServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewIClientRPCServiceClient(c thrift.TClient) *IClientRPCServiceClient { + return &IClientRPCServiceClient{ + c: c, + } +} + +func (p *IClientRPCServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *IClientRPCServiceClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *IClientRPCServiceClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteQueryStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { + var _args197 IClientRPCServiceExecuteQueryStatementV2Args + _args197.Req = req + var _result199 IClientRPCServiceExecuteQueryStatementV2Result + var _meta198 thrift.ResponseMeta + _meta198, _err = p.Client_().Call(ctx, "executeQueryStatementV2", &_args197, &_result199) + p.SetLastResponseMeta_(_meta198) + if _err != nil { + return + } + return _result199.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteUpdateStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { + var _args200 IClientRPCServiceExecuteUpdateStatementV2Args + _args200.Req = req + var _result202 IClientRPCServiceExecuteUpdateStatementV2Result + var _meta201 thrift.ResponseMeta + _meta201, _err = p.Client_().Call(ctx, "executeUpdateStatementV2", &_args200, &_result202) + p.SetLastResponseMeta_(_meta201) + if _err != nil { + return + } + return _result202.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { + var _args203 IClientRPCServiceExecuteStatementV2Args + _args203.Req = req + var _result205 IClientRPCServiceExecuteStatementV2Result + var _meta204 thrift.ResponseMeta + _meta204, _err = p.Client_().Call(ctx, "executeStatementV2", &_args203, &_result205) + p.SetLastResponseMeta_(_meta204) + if _err != nil { + return + } + return _result205.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteRawDataQueryV2(ctx context.Context, req *TSRawDataQueryReq) (_r *TSExecuteStatementResp, _err error) { + var _args206 IClientRPCServiceExecuteRawDataQueryV2Args + _args206.Req = req + var _result208 IClientRPCServiceExecuteRawDataQueryV2Result + var _meta207 thrift.ResponseMeta + _meta207, _err = p.Client_().Call(ctx, "executeRawDataQueryV2", &_args206, &_result208) + p.SetLastResponseMeta_(_meta207) + if _err != nil { + return + } + return _result208.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteLastDataQueryV2(ctx context.Context, req *TSLastDataQueryReq) (_r *TSExecuteStatementResp, _err error) { + var _args209 IClientRPCServiceExecuteLastDataQueryV2Args + _args209.Req = req + var _result211 IClientRPCServiceExecuteLastDataQueryV2Result + var _meta210 thrift.ResponseMeta + _meta210, _err = p.Client_().Call(ctx, "executeLastDataQueryV2", &_args209, &_result211) + p.SetLastResponseMeta_(_meta210) + if _err != nil { + return + } + return _result211.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteFastLastDataQueryForOnePrefixPath(ctx context.Context, req *TSFastLastDataQueryForOnePrefixPathReq) (_r *TSExecuteStatementResp, _err error) { + var _args212 IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs + _args212.Req = req + var _result214 IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult + var _meta213 thrift.ResponseMeta + _meta213, _err = p.Client_().Call(ctx, "executeFastLastDataQueryForOnePrefixPath", &_args212, &_result214) + p.SetLastResponseMeta_(_meta213) + if _err != nil { + return + } + return _result214.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteFastLastDataQueryForOneDeviceV2(ctx context.Context, req *TSFastLastDataQueryForOneDeviceReq) (_r *TSExecuteStatementResp, _err error) { + var _args215 IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args + _args215.Req = req + var _result217 IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result + var _meta216 thrift.ResponseMeta + _meta216, _err = p.Client_().Call(ctx, "executeFastLastDataQueryForOneDeviceV2", &_args215, &_result217) + p.SetLastResponseMeta_(_meta216) + if _err != nil { + return + } + return _result217.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteAggregationQueryV2(ctx context.Context, req *TSAggregationQueryReq) (_r *TSExecuteStatementResp, _err error) { + var _args218 IClientRPCServiceExecuteAggregationQueryV2Args + _args218.Req = req + var _result220 IClientRPCServiceExecuteAggregationQueryV2Result + var _meta219 thrift.ResponseMeta + _meta219, _err = p.Client_().Call(ctx, "executeAggregationQueryV2", &_args218, &_result220) + p.SetLastResponseMeta_(_meta219) + if _err != nil { + return + } + return _result220.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) FetchResultsV2(ctx context.Context, req *TSFetchResultsReq) (_r *TSFetchResultsResp, _err error) { + var _args221 IClientRPCServiceFetchResultsV2Args + _args221.Req = req + var _result223 IClientRPCServiceFetchResultsV2Result + var _meta222 thrift.ResponseMeta + _meta222, _err = p.Client_().Call(ctx, "fetchResultsV2", &_args221, &_result223) + p.SetLastResponseMeta_(_meta222) + if _err != nil { + return + } + return _result223.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) OpenSession(ctx context.Context, req *TSOpenSessionReq) (_r *TSOpenSessionResp, _err error) { + var _args224 IClientRPCServiceOpenSessionArgs + _args224.Req = req + var _result226 IClientRPCServiceOpenSessionResult + var _meta225 thrift.ResponseMeta + _meta225, _err = p.Client_().Call(ctx, "openSession", &_args224, &_result226) + p.SetLastResponseMeta_(_meta225) + if _err != nil { + return + } + return _result226.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) CloseSession(ctx context.Context, req *TSCloseSessionReq) (_r *common.TSStatus, _err error) { + var _args227 IClientRPCServiceCloseSessionArgs + _args227.Req = req + var _result229 IClientRPCServiceCloseSessionResult + var _meta228 thrift.ResponseMeta + _meta228, _err = p.Client_().Call(ctx, "closeSession", &_args227, &_result229) + p.SetLastResponseMeta_(_meta228) + if _err != nil { + return + } + return _result229.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteStatement(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { + var _args230 IClientRPCServiceExecuteStatementArgs + _args230.Req = req + var _result232 IClientRPCServiceExecuteStatementResult + var _meta231 thrift.ResponseMeta + _meta231, _err = p.Client_().Call(ctx, "executeStatement", &_args230, &_result232) + p.SetLastResponseMeta_(_meta231) + if _err != nil { + return + } + return _result232.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteBatchStatement(ctx context.Context, req *TSExecuteBatchStatementReq) (_r *common.TSStatus, _err error) { + var _args233 IClientRPCServiceExecuteBatchStatementArgs + _args233.Req = req + var _result235 IClientRPCServiceExecuteBatchStatementResult + var _meta234 thrift.ResponseMeta + _meta234, _err = p.Client_().Call(ctx, "executeBatchStatement", &_args233, &_result235) + p.SetLastResponseMeta_(_meta234) + if _err != nil { + return + } + return _result235.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteQueryStatement(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { + var _args236 IClientRPCServiceExecuteQueryStatementArgs + _args236.Req = req + var _result238 IClientRPCServiceExecuteQueryStatementResult + var _meta237 thrift.ResponseMeta + _meta237, _err = p.Client_().Call(ctx, "executeQueryStatement", &_args236, &_result238) + p.SetLastResponseMeta_(_meta237) + if _err != nil { + return + } + return _result238.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecuteUpdateStatement(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { + var _args239 IClientRPCServiceExecuteUpdateStatementArgs + _args239.Req = req + var _result241 IClientRPCServiceExecuteUpdateStatementResult + var _meta240 thrift.ResponseMeta + _meta240, _err = p.Client_().Call(ctx, "executeUpdateStatement", &_args239, &_result241) + p.SetLastResponseMeta_(_meta240) + if _err != nil { + return + } + return _result241.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) FetchResults(ctx context.Context, req *TSFetchResultsReq) (_r *TSFetchResultsResp, _err error) { + var _args242 IClientRPCServiceFetchResultsArgs + _args242.Req = req + var _result244 IClientRPCServiceFetchResultsResult + var _meta243 thrift.ResponseMeta + _meta243, _err = p.Client_().Call(ctx, "fetchResults", &_args242, &_result244) + p.SetLastResponseMeta_(_meta243) + if _err != nil { + return + } + return _result244.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) FetchMetadata(ctx context.Context, req *TSFetchMetadataReq) (_r *TSFetchMetadataResp, _err error) { + var _args245 IClientRPCServiceFetchMetadataArgs + _args245.Req = req + var _result247 IClientRPCServiceFetchMetadataResult + var _meta246 thrift.ResponseMeta + _meta246, _err = p.Client_().Call(ctx, "fetchMetadata", &_args245, &_result247) + p.SetLastResponseMeta_(_meta246) + if _err != nil { + return + } + return _result247.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) CancelOperation(ctx context.Context, req *TSCancelOperationReq) (_r *common.TSStatus, _err error) { + var _args248 IClientRPCServiceCancelOperationArgs + _args248.Req = req + var _result250 IClientRPCServiceCancelOperationResult + var _meta249 thrift.ResponseMeta + _meta249, _err = p.Client_().Call(ctx, "cancelOperation", &_args248, &_result250) + p.SetLastResponseMeta_(_meta249) + if _err != nil { + return + } + return _result250.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) CloseOperation(ctx context.Context, req *TSCloseOperationReq) (_r *common.TSStatus, _err error) { + var _args251 IClientRPCServiceCloseOperationArgs + _args251.Req = req + var _result253 IClientRPCServiceCloseOperationResult + var _meta252 thrift.ResponseMeta + _meta252, _err = p.Client_().Call(ctx, "closeOperation", &_args251, &_result253) + p.SetLastResponseMeta_(_meta252) + if _err != nil { + return + } + return _result253.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) PrepareStatement(ctx context.Context, req *TSPrepareReq) (_r *TSPrepareResp, _err error) { + var _args254 IClientRPCServicePrepareStatementArgs + _args254.Req = req + var _result256 IClientRPCServicePrepareStatementResult + var _meta255 thrift.ResponseMeta + _meta255, _err = p.Client_().Call(ctx, "prepareStatement", &_args254, &_result256) + p.SetLastResponseMeta_(_meta255) + if _err != nil { + return + } + return _result256.GetSuccess(), nil } -func NewIClientRPCServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *IClientRPCServiceClient { - return &IClientRPCServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), +// Parameters: +// - Req +func (p *IClientRPCServiceClient) ExecutePreparedStatement(ctx context.Context, req *TSExecutePreparedReq) (_r *TSExecuteStatementResp, _err error) { + var _args257 IClientRPCServiceExecutePreparedStatementArgs + _args257.Req = req + var _result259 IClientRPCServiceExecutePreparedStatementResult + var _meta258 thrift.ResponseMeta + _meta258, _err = p.Client_().Call(ctx, "executePreparedStatement", &_args257, &_result259) + p.SetLastResponseMeta_(_meta258) + if _err != nil { + return } + return _result259.GetSuccess(), nil } -func NewIClientRPCServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *IClientRPCServiceClient { - return &IClientRPCServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), +// Parameters: +// - Req +func (p *IClientRPCServiceClient) DeallocatePreparedStatement(ctx context.Context, req *TSDeallocatePreparedReq) (_r *common.TSStatus, _err error) { + var _args260 IClientRPCServiceDeallocatePreparedStatementArgs + _args260.Req = req + var _result262 IClientRPCServiceDeallocatePreparedStatementResult + var _meta261 thrift.ResponseMeta + _meta261, _err = p.Client_().Call(ctx, "deallocatePreparedStatement", &_args260, &_result262) + p.SetLastResponseMeta_(_meta261) + if _err != nil { + return } + return _result262.GetSuccess(), nil } -func NewIClientRPCServiceClient(c thrift.TClient) *IClientRPCServiceClient { - return &IClientRPCServiceClient{ - c: c, +// Parameters: +// - SessionId +func (p *IClientRPCServiceClient) GetTimeZone(ctx context.Context, sessionId int64) (_r *TSGetTimeZoneResp, _err error) { + var _args263 IClientRPCServiceGetTimeZoneArgs + _args263.SessionId = sessionId + var _result265 IClientRPCServiceGetTimeZoneResult + var _meta264 thrift.ResponseMeta + _meta264, _err = p.Client_().Call(ctx, "getTimeZone", &_args263, &_result265) + p.SetLastResponseMeta_(_meta264) + if _err != nil { + return } + return _result265.GetSuccess(), nil } -func (p *IClientRPCServiceClient) Client_() thrift.TClient { - return p.c +// Parameters: +// - Req +func (p *IClientRPCServiceClient) SetTimeZone(ctx context.Context, req *TSSetTimeZoneReq) (_r *common.TSStatus, _err error) { + var _args266 IClientRPCServiceSetTimeZoneArgs + _args266.Req = req + var _result268 IClientRPCServiceSetTimeZoneResult + var _meta267 thrift.ResponseMeta + _meta267, _err = p.Client_().Call(ctx, "setTimeZone", &_args266, &_result268) + p.SetLastResponseMeta_(_meta267) + if _err != nil { + return + } + return _result268.GetSuccess(), nil } -func (p *IClientRPCServiceClient) LastResponseMeta_() thrift.ResponseMeta { - return p.meta +func (p *IClientRPCServiceClient) GetProperties(ctx context.Context) (_r *ServerProperties, _err error) { + var _args269 IClientRPCServiceGetPropertiesArgs + var _result271 IClientRPCServiceGetPropertiesResult + var _meta270 thrift.ResponseMeta + _meta270, _err = p.Client_().Call(ctx, "getProperties", &_args269, &_result271) + p.SetLastResponseMeta_(_meta270) + if _err != nil { + return + } + return _result271.GetSuccess(), nil } -func (p *IClientRPCServiceClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { - p.meta = meta +// Parameters: +// - SessionId +// - StorageGroup +func (p *IClientRPCServiceClient) SetStorageGroup(ctx context.Context, sessionId int64, storageGroup string) (_r *common.TSStatus, _err error) { + var _args272 IClientRPCServiceSetStorageGroupArgs + _args272.SessionId = sessionId + _args272.StorageGroup = storageGroup + var _result274 IClientRPCServiceSetStorageGroupResult + var _meta273 thrift.ResponseMeta + _meta273, _err = p.Client_().Call(ctx, "setStorageGroup", &_args272, &_result274) + p.SetLastResponseMeta_(_meta273) + if _err != nil { + return + } + return _result274.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteQueryStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { - var _args197 IClientRPCServiceExecuteQueryStatementV2Args - _args197.Req = req - var _result199 IClientRPCServiceExecuteQueryStatementV2Result - var _meta198 thrift.ResponseMeta - _meta198, _err = p.Client_().Call(ctx, "executeQueryStatementV2", &_args197, &_result199) - p.SetLastResponseMeta_(_meta198) +func (p *IClientRPCServiceClient) CreateTimeseries(ctx context.Context, req *TSCreateTimeseriesReq) (_r *common.TSStatus, _err error) { + var _args275 IClientRPCServiceCreateTimeseriesArgs + _args275.Req = req + var _result277 IClientRPCServiceCreateTimeseriesResult + var _meta276 thrift.ResponseMeta + _meta276, _err = p.Client_().Call(ctx, "createTimeseries", &_args275, &_result277) + p.SetLastResponseMeta_(_meta276) if _err != nil { return } - return _result199.GetSuccess(), nil + return _result277.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteUpdateStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { - var _args200 IClientRPCServiceExecuteUpdateStatementV2Args - _args200.Req = req - var _result202 IClientRPCServiceExecuteUpdateStatementV2Result - var _meta201 thrift.ResponseMeta - _meta201, _err = p.Client_().Call(ctx, "executeUpdateStatementV2", &_args200, &_result202) - p.SetLastResponseMeta_(_meta201) +func (p *IClientRPCServiceClient) CreateAlignedTimeseries(ctx context.Context, req *TSCreateAlignedTimeseriesReq) (_r *common.TSStatus, _err error) { + var _args278 IClientRPCServiceCreateAlignedTimeseriesArgs + _args278.Req = req + var _result280 IClientRPCServiceCreateAlignedTimeseriesResult + var _meta279 thrift.ResponseMeta + _meta279, _err = p.Client_().Call(ctx, "createAlignedTimeseries", &_args278, &_result280) + p.SetLastResponseMeta_(_meta279) if _err != nil { return } - return _result202.GetSuccess(), nil + return _result280.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteStatementV2(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { - var _args203 IClientRPCServiceExecuteStatementV2Args - _args203.Req = req - var _result205 IClientRPCServiceExecuteStatementV2Result - var _meta204 thrift.ResponseMeta - _meta204, _err = p.Client_().Call(ctx, "executeStatementV2", &_args203, &_result205) - p.SetLastResponseMeta_(_meta204) +func (p *IClientRPCServiceClient) CreateMultiTimeseries(ctx context.Context, req *TSCreateMultiTimeseriesReq) (_r *common.TSStatus, _err error) { + var _args281 IClientRPCServiceCreateMultiTimeseriesArgs + _args281.Req = req + var _result283 IClientRPCServiceCreateMultiTimeseriesResult + var _meta282 thrift.ResponseMeta + _meta282, _err = p.Client_().Call(ctx, "createMultiTimeseries", &_args281, &_result283) + p.SetLastResponseMeta_(_meta282) if _err != nil { return } - return _result205.GetSuccess(), nil + return _result283.GetSuccess(), nil +} + +// Parameters: +// - SessionId +// - Path +func (p *IClientRPCServiceClient) DeleteTimeseries(ctx context.Context, sessionId int64, path []string) (_r *common.TSStatus, _err error) { + var _args284 IClientRPCServiceDeleteTimeseriesArgs + _args284.SessionId = sessionId + _args284.Path = path + var _result286 IClientRPCServiceDeleteTimeseriesResult + var _meta285 thrift.ResponseMeta + _meta285, _err = p.Client_().Call(ctx, "deleteTimeseries", &_args284, &_result286) + p.SetLastResponseMeta_(_meta285) + if _err != nil { + return + } + return _result286.GetSuccess(), nil +} + +// Parameters: +// - SessionId +// - StorageGroup +func (p *IClientRPCServiceClient) DeleteStorageGroups(ctx context.Context, sessionId int64, storageGroup []string) (_r *common.TSStatus, _err error) { + var _args287 IClientRPCServiceDeleteStorageGroupsArgs + _args287.SessionId = sessionId + _args287.StorageGroup = storageGroup + var _result289 IClientRPCServiceDeleteStorageGroupsResult + var _meta288 thrift.ResponseMeta + _meta288, _err = p.Client_().Call(ctx, "deleteStorageGroups", &_args287, &_result289) + p.SetLastResponseMeta_(_meta288) + if _err != nil { + return + } + return _result289.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteRawDataQueryV2(ctx context.Context, req *TSRawDataQueryReq) (_r *TSExecuteStatementResp, _err error) { - var _args206 IClientRPCServiceExecuteRawDataQueryV2Args - _args206.Req = req - var _result208 IClientRPCServiceExecuteRawDataQueryV2Result - var _meta207 thrift.ResponseMeta - _meta207, _err = p.Client_().Call(ctx, "executeRawDataQueryV2", &_args206, &_result208) - p.SetLastResponseMeta_(_meta207) +func (p *IClientRPCServiceClient) InsertRecord(ctx context.Context, req *TSInsertRecordReq) (_r *common.TSStatus, _err error) { + var _args290 IClientRPCServiceInsertRecordArgs + _args290.Req = req + var _result292 IClientRPCServiceInsertRecordResult + var _meta291 thrift.ResponseMeta + _meta291, _err = p.Client_().Call(ctx, "insertRecord", &_args290, &_result292) + p.SetLastResponseMeta_(_meta291) + if _err != nil { + return + } + return _result292.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertStringRecord(ctx context.Context, req *TSInsertStringRecordReq) (_r *common.TSStatus, _err error) { + var _args293 IClientRPCServiceInsertStringRecordArgs + _args293.Req = req + var _result295 IClientRPCServiceInsertStringRecordResult + var _meta294 thrift.ResponseMeta + _meta294, _err = p.Client_().Call(ctx, "insertStringRecord", &_args293, &_result295) + p.SetLastResponseMeta_(_meta294) + if _err != nil { + return + } + return _result295.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertTablet(ctx context.Context, req *TSInsertTabletReq) (_r *common.TSStatus, _err error) { + var _args296 IClientRPCServiceInsertTabletArgs + _args296.Req = req + var _result298 IClientRPCServiceInsertTabletResult + var _meta297 thrift.ResponseMeta + _meta297, _err = p.Client_().Call(ctx, "insertTablet", &_args296, &_result298) + p.SetLastResponseMeta_(_meta297) + if _err != nil { + return + } + return _result298.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertTablets(ctx context.Context, req *TSInsertTabletsReq) (_r *common.TSStatus, _err error) { + var _args299 IClientRPCServiceInsertTabletsArgs + _args299.Req = req + var _result301 IClientRPCServiceInsertTabletsResult + var _meta300 thrift.ResponseMeta + _meta300, _err = p.Client_().Call(ctx, "insertTablets", &_args299, &_result301) + p.SetLastResponseMeta_(_meta300) + if _err != nil { + return + } + return _result301.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertRecords(ctx context.Context, req *TSInsertRecordsReq) (_r *common.TSStatus, _err error) { + var _args302 IClientRPCServiceInsertRecordsArgs + _args302.Req = req + var _result304 IClientRPCServiceInsertRecordsResult + var _meta303 thrift.ResponseMeta + _meta303, _err = p.Client_().Call(ctx, "insertRecords", &_args302, &_result304) + p.SetLastResponseMeta_(_meta303) + if _err != nil { + return + } + return _result304.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertRecordsOfOneDevice(ctx context.Context, req *TSInsertRecordsOfOneDeviceReq) (_r *common.TSStatus, _err error) { + var _args305 IClientRPCServiceInsertRecordsOfOneDeviceArgs + _args305.Req = req + var _result307 IClientRPCServiceInsertRecordsOfOneDeviceResult + var _meta306 thrift.ResponseMeta + _meta306, _err = p.Client_().Call(ctx, "insertRecordsOfOneDevice", &_args305, &_result307) + p.SetLastResponseMeta_(_meta306) + if _err != nil { + return + } + return _result307.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertStringRecordsOfOneDevice(ctx context.Context, req *TSInsertStringRecordsOfOneDeviceReq) (_r *common.TSStatus, _err error) { + var _args308 IClientRPCServiceInsertStringRecordsOfOneDeviceArgs + _args308.Req = req + var _result310 IClientRPCServiceInsertStringRecordsOfOneDeviceResult + var _meta309 thrift.ResponseMeta + _meta309, _err = p.Client_().Call(ctx, "insertStringRecordsOfOneDevice", &_args308, &_result310) + p.SetLastResponseMeta_(_meta309) + if _err != nil { + return + } + return _result310.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) InsertStringRecords(ctx context.Context, req *TSInsertStringRecordsReq) (_r *common.TSStatus, _err error) { + var _args311 IClientRPCServiceInsertStringRecordsArgs + _args311.Req = req + var _result313 IClientRPCServiceInsertStringRecordsResult + var _meta312 thrift.ResponseMeta + _meta312, _err = p.Client_().Call(ctx, "insertStringRecords", &_args311, &_result313) + p.SetLastResponseMeta_(_meta312) + if _err != nil { + return + } + return _result313.GetSuccess(), nil +} + +// Parameters: +// - Req +func (p *IClientRPCServiceClient) TestInsertTablet(ctx context.Context, req *TSInsertTabletReq) (_r *common.TSStatus, _err error) { + var _args314 IClientRPCServiceTestInsertTabletArgs + _args314.Req = req + var _result316 IClientRPCServiceTestInsertTabletResult + var _meta315 thrift.ResponseMeta + _meta315, _err = p.Client_().Call(ctx, "testInsertTablet", &_args314, &_result316) + p.SetLastResponseMeta_(_meta315) if _err != nil { return } - return _result208.GetSuccess(), nil + return _result316.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteLastDataQueryV2(ctx context.Context, req *TSLastDataQueryReq) (_r *TSExecuteStatementResp, _err error) { - var _args209 IClientRPCServiceExecuteLastDataQueryV2Args - _args209.Req = req - var _result211 IClientRPCServiceExecuteLastDataQueryV2Result - var _meta210 thrift.ResponseMeta - _meta210, _err = p.Client_().Call(ctx, "executeLastDataQueryV2", &_args209, &_result211) - p.SetLastResponseMeta_(_meta210) +func (p *IClientRPCServiceClient) TestInsertTablets(ctx context.Context, req *TSInsertTabletsReq) (_r *common.TSStatus, _err error) { + var _args317 IClientRPCServiceTestInsertTabletsArgs + _args317.Req = req + var _result319 IClientRPCServiceTestInsertTabletsResult + var _meta318 thrift.ResponseMeta + _meta318, _err = p.Client_().Call(ctx, "testInsertTablets", &_args317, &_result319) + p.SetLastResponseMeta_(_meta318) if _err != nil { return } - return _result211.GetSuccess(), nil + return _result319.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteFastLastDataQueryForOnePrefixPath(ctx context.Context, req *TSFastLastDataQueryForOnePrefixPathReq) (_r *TSExecuteStatementResp, _err error) { - var _args212 IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs - _args212.Req = req - var _result214 IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult - var _meta213 thrift.ResponseMeta - _meta213, _err = p.Client_().Call(ctx, "executeFastLastDataQueryForOnePrefixPath", &_args212, &_result214) - p.SetLastResponseMeta_(_meta213) +func (p *IClientRPCServiceClient) TestInsertRecord(ctx context.Context, req *TSInsertRecordReq) (_r *common.TSStatus, _err error) { + var _args320 IClientRPCServiceTestInsertRecordArgs + _args320.Req = req + var _result322 IClientRPCServiceTestInsertRecordResult + var _meta321 thrift.ResponseMeta + _meta321, _err = p.Client_().Call(ctx, "testInsertRecord", &_args320, &_result322) + p.SetLastResponseMeta_(_meta321) if _err != nil { return } - return _result214.GetSuccess(), nil + return _result322.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteFastLastDataQueryForOneDeviceV2(ctx context.Context, req *TSFastLastDataQueryForOneDeviceReq) (_r *TSExecuteStatementResp, _err error) { - var _args215 IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args - _args215.Req = req - var _result217 IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result - var _meta216 thrift.ResponseMeta - _meta216, _err = p.Client_().Call(ctx, "executeFastLastDataQueryForOneDeviceV2", &_args215, &_result217) - p.SetLastResponseMeta_(_meta216) +func (p *IClientRPCServiceClient) TestInsertStringRecord(ctx context.Context, req *TSInsertStringRecordReq) (_r *common.TSStatus, _err error) { + var _args323 IClientRPCServiceTestInsertStringRecordArgs + _args323.Req = req + var _result325 IClientRPCServiceTestInsertStringRecordResult + var _meta324 thrift.ResponseMeta + _meta324, _err = p.Client_().Call(ctx, "testInsertStringRecord", &_args323, &_result325) + p.SetLastResponseMeta_(_meta324) if _err != nil { return } - return _result217.GetSuccess(), nil + return _result325.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteAggregationQueryV2(ctx context.Context, req *TSAggregationQueryReq) (_r *TSExecuteStatementResp, _err error) { - var _args218 IClientRPCServiceExecuteAggregationQueryV2Args - _args218.Req = req - var _result220 IClientRPCServiceExecuteAggregationQueryV2Result - var _meta219 thrift.ResponseMeta - _meta219, _err = p.Client_().Call(ctx, "executeAggregationQueryV2", &_args218, &_result220) - p.SetLastResponseMeta_(_meta219) +func (p *IClientRPCServiceClient) TestInsertRecords(ctx context.Context, req *TSInsertRecordsReq) (_r *common.TSStatus, _err error) { + var _args326 IClientRPCServiceTestInsertRecordsArgs + _args326.Req = req + var _result328 IClientRPCServiceTestInsertRecordsResult + var _meta327 thrift.ResponseMeta + _meta327, _err = p.Client_().Call(ctx, "testInsertRecords", &_args326, &_result328) + p.SetLastResponseMeta_(_meta327) if _err != nil { return } - return _result220.GetSuccess(), nil + return _result328.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) FetchResultsV2(ctx context.Context, req *TSFetchResultsReq) (_r *TSFetchResultsResp, _err error) { - var _args221 IClientRPCServiceFetchResultsV2Args - _args221.Req = req - var _result223 IClientRPCServiceFetchResultsV2Result - var _meta222 thrift.ResponseMeta - _meta222, _err = p.Client_().Call(ctx, "fetchResultsV2", &_args221, &_result223) - p.SetLastResponseMeta_(_meta222) +func (p *IClientRPCServiceClient) TestInsertRecordsOfOneDevice(ctx context.Context, req *TSInsertRecordsOfOneDeviceReq) (_r *common.TSStatus, _err error) { + var _args329 IClientRPCServiceTestInsertRecordsOfOneDeviceArgs + _args329.Req = req + var _result331 IClientRPCServiceTestInsertRecordsOfOneDeviceResult + var _meta330 thrift.ResponseMeta + _meta330, _err = p.Client_().Call(ctx, "testInsertRecordsOfOneDevice", &_args329, &_result331) + p.SetLastResponseMeta_(_meta330) if _err != nil { return } - return _result223.GetSuccess(), nil + return _result331.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) OpenSession(ctx context.Context, req *TSOpenSessionReq) (_r *TSOpenSessionResp, _err error) { - var _args224 IClientRPCServiceOpenSessionArgs - _args224.Req = req - var _result226 IClientRPCServiceOpenSessionResult - var _meta225 thrift.ResponseMeta - _meta225, _err = p.Client_().Call(ctx, "openSession", &_args224, &_result226) - p.SetLastResponseMeta_(_meta225) +func (p *IClientRPCServiceClient) TestInsertStringRecords(ctx context.Context, req *TSInsertStringRecordsReq) (_r *common.TSStatus, _err error) { + var _args332 IClientRPCServiceTestInsertStringRecordsArgs + _args332.Req = req + var _result334 IClientRPCServiceTestInsertStringRecordsResult + var _meta333 thrift.ResponseMeta + _meta333, _err = p.Client_().Call(ctx, "testInsertStringRecords", &_args332, &_result334) + p.SetLastResponseMeta_(_meta333) if _err != nil { return } - return _result226.GetSuccess(), nil + return _result334.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) CloseSession(ctx context.Context, req *TSCloseSessionReq) (_r *common.TSStatus, _err error) { - var _args227 IClientRPCServiceCloseSessionArgs - _args227.Req = req - var _result229 IClientRPCServiceCloseSessionResult - var _meta228 thrift.ResponseMeta - _meta228, _err = p.Client_().Call(ctx, "closeSession", &_args227, &_result229) - p.SetLastResponseMeta_(_meta228) +func (p *IClientRPCServiceClient) DeleteData(ctx context.Context, req *TSDeleteDataReq) (_r *common.TSStatus, _err error) { + var _args335 IClientRPCServiceDeleteDataArgs + _args335.Req = req + var _result337 IClientRPCServiceDeleteDataResult + var _meta336 thrift.ResponseMeta + _meta336, _err = p.Client_().Call(ctx, "deleteData", &_args335, &_result337) + p.SetLastResponseMeta_(_meta336) if _err != nil { return } - return _result229.GetSuccess(), nil + return _result337.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteStatement(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { - var _args230 IClientRPCServiceExecuteStatementArgs - _args230.Req = req - var _result232 IClientRPCServiceExecuteStatementResult - var _meta231 thrift.ResponseMeta - _meta231, _err = p.Client_().Call(ctx, "executeStatement", &_args230, &_result232) - p.SetLastResponseMeta_(_meta231) +func (p *IClientRPCServiceClient) ExecuteRawDataQuery(ctx context.Context, req *TSRawDataQueryReq) (_r *TSExecuteStatementResp, _err error) { + var _args338 IClientRPCServiceExecuteRawDataQueryArgs + _args338.Req = req + var _result340 IClientRPCServiceExecuteRawDataQueryResult + var _meta339 thrift.ResponseMeta + _meta339, _err = p.Client_().Call(ctx, "executeRawDataQuery", &_args338, &_result340) + p.SetLastResponseMeta_(_meta339) if _err != nil { return } - return _result232.GetSuccess(), nil + return _result340.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteBatchStatement(ctx context.Context, req *TSExecuteBatchStatementReq) (_r *common.TSStatus, _err error) { - var _args233 IClientRPCServiceExecuteBatchStatementArgs - _args233.Req = req - var _result235 IClientRPCServiceExecuteBatchStatementResult - var _meta234 thrift.ResponseMeta - _meta234, _err = p.Client_().Call(ctx, "executeBatchStatement", &_args233, &_result235) - p.SetLastResponseMeta_(_meta234) +func (p *IClientRPCServiceClient) ExecuteLastDataQuery(ctx context.Context, req *TSLastDataQueryReq) (_r *TSExecuteStatementResp, _err error) { + var _args341 IClientRPCServiceExecuteLastDataQueryArgs + _args341.Req = req + var _result343 IClientRPCServiceExecuteLastDataQueryResult + var _meta342 thrift.ResponseMeta + _meta342, _err = p.Client_().Call(ctx, "executeLastDataQuery", &_args341, &_result343) + p.SetLastResponseMeta_(_meta342) if _err != nil { return } - return _result235.GetSuccess(), nil + return _result343.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) ExecuteQueryStatement(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { - var _args236 IClientRPCServiceExecuteQueryStatementArgs - _args236.Req = req - var _result238 IClientRPCServiceExecuteQueryStatementResult - var _meta237 thrift.ResponseMeta - _meta237, _err = p.Client_().Call(ctx, "executeQueryStatement", &_args236, &_result238) - p.SetLastResponseMeta_(_meta237) +func (p *IClientRPCServiceClient) ExecuteAggregationQuery(ctx context.Context, req *TSAggregationQueryReq) (_r *TSExecuteStatementResp, _err error) { + var _args344 IClientRPCServiceExecuteAggregationQueryArgs + _args344.Req = req + var _result346 IClientRPCServiceExecuteAggregationQueryResult + var _meta345 thrift.ResponseMeta + _meta345, _err = p.Client_().Call(ctx, "executeAggregationQuery", &_args344, &_result346) + p.SetLastResponseMeta_(_meta345) if _err != nil { return } - return _result238.GetSuccess(), nil + return _result346.GetSuccess(), nil } // Parameters: -// - Req -func (p *IClientRPCServiceClient) ExecuteUpdateStatement(ctx context.Context, req *TSExecuteStatementReq) (_r *TSExecuteStatementResp, _err error) { - var _args239 IClientRPCServiceExecuteUpdateStatementArgs - _args239.Req = req - var _result241 IClientRPCServiceExecuteUpdateStatementResult - var _meta240 thrift.ResponseMeta - _meta240, _err = p.Client_().Call(ctx, "executeUpdateStatement", &_args239, &_result241) - p.SetLastResponseMeta_(_meta240) +// - SessionId +func (p *IClientRPCServiceClient) RequestStatementId(ctx context.Context, sessionId int64) (_r int64, _err error) { + var _args347 IClientRPCServiceRequestStatementIdArgs + _args347.SessionId = sessionId + var _result349 IClientRPCServiceRequestStatementIdResult + var _meta348 thrift.ResponseMeta + _meta348, _err = p.Client_().Call(ctx, "requestStatementId", &_args347, &_result349) + p.SetLastResponseMeta_(_meta348) if _err != nil { return } - return _result241.GetSuccess(), nil + return _result349.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) FetchResults(ctx context.Context, req *TSFetchResultsReq) (_r *TSFetchResultsResp, _err error) { - var _args242 IClientRPCServiceFetchResultsArgs - _args242.Req = req - var _result244 IClientRPCServiceFetchResultsResult - var _meta243 thrift.ResponseMeta - _meta243, _err = p.Client_().Call(ctx, "fetchResults", &_args242, &_result244) - p.SetLastResponseMeta_(_meta243) +func (p *IClientRPCServiceClient) CreateSchemaTemplate(ctx context.Context, req *TSCreateSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args350 IClientRPCServiceCreateSchemaTemplateArgs + _args350.Req = req + var _result352 IClientRPCServiceCreateSchemaTemplateResult + var _meta351 thrift.ResponseMeta + _meta351, _err = p.Client_().Call(ctx, "createSchemaTemplate", &_args350, &_result352) + p.SetLastResponseMeta_(_meta351) if _err != nil { return } - return _result244.GetSuccess(), nil + return _result352.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) FetchMetadata(ctx context.Context, req *TSFetchMetadataReq) (_r *TSFetchMetadataResp, _err error) { - var _args245 IClientRPCServiceFetchMetadataArgs - _args245.Req = req - var _result247 IClientRPCServiceFetchMetadataResult - var _meta246 thrift.ResponseMeta - _meta246, _err = p.Client_().Call(ctx, "fetchMetadata", &_args245, &_result247) - p.SetLastResponseMeta_(_meta246) +func (p *IClientRPCServiceClient) AppendSchemaTemplate(ctx context.Context, req *TSAppendSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args353 IClientRPCServiceAppendSchemaTemplateArgs + _args353.Req = req + var _result355 IClientRPCServiceAppendSchemaTemplateResult + var _meta354 thrift.ResponseMeta + _meta354, _err = p.Client_().Call(ctx, "appendSchemaTemplate", &_args353, &_result355) + p.SetLastResponseMeta_(_meta354) if _err != nil { return } - return _result247.GetSuccess(), nil + return _result355.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) CancelOperation(ctx context.Context, req *TSCancelOperationReq) (_r *common.TSStatus, _err error) { - var _args248 IClientRPCServiceCancelOperationArgs - _args248.Req = req - var _result250 IClientRPCServiceCancelOperationResult - var _meta249 thrift.ResponseMeta - _meta249, _err = p.Client_().Call(ctx, "cancelOperation", &_args248, &_result250) - p.SetLastResponseMeta_(_meta249) +func (p *IClientRPCServiceClient) PruneSchemaTemplate(ctx context.Context, req *TSPruneSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args356 IClientRPCServicePruneSchemaTemplateArgs + _args356.Req = req + var _result358 IClientRPCServicePruneSchemaTemplateResult + var _meta357 thrift.ResponseMeta + _meta357, _err = p.Client_().Call(ctx, "pruneSchemaTemplate", &_args356, &_result358) + p.SetLastResponseMeta_(_meta357) if _err != nil { return } - return _result250.GetSuccess(), nil + return _result358.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) CloseOperation(ctx context.Context, req *TSCloseOperationReq) (_r *common.TSStatus, _err error) { - var _args251 IClientRPCServiceCloseOperationArgs - _args251.Req = req - var _result253 IClientRPCServiceCloseOperationResult - var _meta252 thrift.ResponseMeta - _meta252, _err = p.Client_().Call(ctx, "closeOperation", &_args251, &_result253) - p.SetLastResponseMeta_(_meta252) +func (p *IClientRPCServiceClient) QuerySchemaTemplate(ctx context.Context, req *TSQueryTemplateReq) (_r *TSQueryTemplateResp, _err error) { + var _args359 IClientRPCServiceQuerySchemaTemplateArgs + _args359.Req = req + var _result361 IClientRPCServiceQuerySchemaTemplateResult + var _meta360 thrift.ResponseMeta + _meta360, _err = p.Client_().Call(ctx, "querySchemaTemplate", &_args359, &_result361) + p.SetLastResponseMeta_(_meta360) if _err != nil { return } - return _result253.GetSuccess(), nil + return _result361.GetSuccess(), nil } -// Parameters: -// - SessionId -func (p *IClientRPCServiceClient) GetTimeZone(ctx context.Context, sessionId int64) (_r *TSGetTimeZoneResp, _err error) { - var _args254 IClientRPCServiceGetTimeZoneArgs - _args254.SessionId = sessionId - var _result256 IClientRPCServiceGetTimeZoneResult - var _meta255 thrift.ResponseMeta - _meta255, _err = p.Client_().Call(ctx, "getTimeZone", &_args254, &_result256) - p.SetLastResponseMeta_(_meta255) +func (p *IClientRPCServiceClient) ShowConfigurationTemplate(ctx context.Context) (_r *common.TShowConfigurationTemplateResp, _err error) { + var _args362 IClientRPCServiceShowConfigurationTemplateArgs + var _result364 IClientRPCServiceShowConfigurationTemplateResult + var _meta363 thrift.ResponseMeta + _meta363, _err = p.Client_().Call(ctx, "showConfigurationTemplate", &_args362, &_result364) + p.SetLastResponseMeta_(_meta363) if _err != nil { return } - return _result256.GetSuccess(), nil + return _result364.GetSuccess(), nil } // Parameters: -// - Req -func (p *IClientRPCServiceClient) SetTimeZone(ctx context.Context, req *TSSetTimeZoneReq) (_r *common.TSStatus, _err error) { - var _args257 IClientRPCServiceSetTimeZoneArgs - _args257.Req = req - var _result259 IClientRPCServiceSetTimeZoneResult - var _meta258 thrift.ResponseMeta - _meta258, _err = p.Client_().Call(ctx, "setTimeZone", &_args257, &_result259) - p.SetLastResponseMeta_(_meta258) +// - NodeId +func (p *IClientRPCServiceClient) ShowConfiguration(ctx context.Context, nodeId int32) (_r *common.TShowConfigurationResp, _err error) { + var _args365 IClientRPCServiceShowConfigurationArgs + _args365.NodeId = nodeId + var _result367 IClientRPCServiceShowConfigurationResult + var _meta366 thrift.ResponseMeta + _meta366, _err = p.Client_().Call(ctx, "showConfiguration", &_args365, &_result367) + p.SetLastResponseMeta_(_meta366) if _err != nil { return } - return _result259.GetSuccess(), nil + return _result367.GetSuccess(), nil } -func (p *IClientRPCServiceClient) GetProperties(ctx context.Context) (_r *ServerProperties, _err error) { - var _args260 IClientRPCServiceGetPropertiesArgs - var _result262 IClientRPCServiceGetPropertiesResult - var _meta261 thrift.ResponseMeta - _meta261, _err = p.Client_().Call(ctx, "getProperties", &_args260, &_result262) - p.SetLastResponseMeta_(_meta261) +// Parameters: +// - Req +func (p *IClientRPCServiceClient) SetSchemaTemplate(ctx context.Context, req *TSSetSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args368 IClientRPCServiceSetSchemaTemplateArgs + _args368.Req = req + var _result370 IClientRPCServiceSetSchemaTemplateResult + var _meta369 thrift.ResponseMeta + _meta369, _err = p.Client_().Call(ctx, "setSchemaTemplate", &_args368, &_result370) + p.SetLastResponseMeta_(_meta369) if _err != nil { return } - return _result262.GetSuccess(), nil + return _result370.GetSuccess(), nil } // Parameters: -// - SessionId -// - StorageGroup -func (p *IClientRPCServiceClient) SetStorageGroup(ctx context.Context, sessionId int64, storageGroup string) (_r *common.TSStatus, _err error) { - var _args263 IClientRPCServiceSetStorageGroupArgs - _args263.SessionId = sessionId - _args263.StorageGroup = storageGroup - var _result265 IClientRPCServiceSetStorageGroupResult - var _meta264 thrift.ResponseMeta - _meta264, _err = p.Client_().Call(ctx, "setStorageGroup", &_args263, &_result265) - p.SetLastResponseMeta_(_meta264) +// - Req +func (p *IClientRPCServiceClient) UnsetSchemaTemplate(ctx context.Context, req *TSUnsetSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args371 IClientRPCServiceUnsetSchemaTemplateArgs + _args371.Req = req + var _result373 IClientRPCServiceUnsetSchemaTemplateResult + var _meta372 thrift.ResponseMeta + _meta372, _err = p.Client_().Call(ctx, "unsetSchemaTemplate", &_args371, &_result373) + p.SetLastResponseMeta_(_meta372) if _err != nil { return } - return _result265.GetSuccess(), nil + return _result373.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) CreateTimeseries(ctx context.Context, req *TSCreateTimeseriesReq) (_r *common.TSStatus, _err error) { - var _args266 IClientRPCServiceCreateTimeseriesArgs - _args266.Req = req - var _result268 IClientRPCServiceCreateTimeseriesResult - var _meta267 thrift.ResponseMeta - _meta267, _err = p.Client_().Call(ctx, "createTimeseries", &_args266, &_result268) - p.SetLastResponseMeta_(_meta267) +func (p *IClientRPCServiceClient) DropSchemaTemplate(ctx context.Context, req *TSDropSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args374 IClientRPCServiceDropSchemaTemplateArgs + _args374.Req = req + var _result376 IClientRPCServiceDropSchemaTemplateResult + var _meta375 thrift.ResponseMeta + _meta375, _err = p.Client_().Call(ctx, "dropSchemaTemplate", &_args374, &_result376) + p.SetLastResponseMeta_(_meta375) if _err != nil { return } - return _result268.GetSuccess(), nil + return _result376.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) CreateAlignedTimeseries(ctx context.Context, req *TSCreateAlignedTimeseriesReq) (_r *common.TSStatus, _err error) { - var _args269 IClientRPCServiceCreateAlignedTimeseriesArgs - _args269.Req = req - var _result271 IClientRPCServiceCreateAlignedTimeseriesResult - var _meta270 thrift.ResponseMeta - _meta270, _err = p.Client_().Call(ctx, "createAlignedTimeseries", &_args269, &_result271) - p.SetLastResponseMeta_(_meta270) +func (p *IClientRPCServiceClient) CreateTimeseriesUsingSchemaTemplate(ctx context.Context, req *TCreateTimeseriesUsingSchemaTemplateReq) (_r *common.TSStatus, _err error) { + var _args377 IClientRPCServiceCreateTimeseriesUsingSchemaTemplateArgs + _args377.Req = req + var _result379 IClientRPCServiceCreateTimeseriesUsingSchemaTemplateResult + var _meta378 thrift.ResponseMeta + _meta378, _err = p.Client_().Call(ctx, "createTimeseriesUsingSchemaTemplate", &_args377, &_result379) + p.SetLastResponseMeta_(_meta378) if _err != nil { return } - return _result271.GetSuccess(), nil + return _result379.GetSuccess(), nil } // Parameters: -// - Req -func (p *IClientRPCServiceClient) CreateMultiTimeseries(ctx context.Context, req *TSCreateMultiTimeseriesReq) (_r *common.TSStatus, _err error) { - var _args272 IClientRPCServiceCreateMultiTimeseriesArgs - _args272.Req = req - var _result274 IClientRPCServiceCreateMultiTimeseriesResult - var _meta273 thrift.ResponseMeta - _meta273, _err = p.Client_().Call(ctx, "createMultiTimeseries", &_args272, &_result274) - p.SetLastResponseMeta_(_meta273) +// - Info +func (p *IClientRPCServiceClient) Handshake(ctx context.Context, info *TSyncIdentityInfo) (_r *common.TSStatus, _err error) { + var _args380 IClientRPCServiceHandshakeArgs + _args380.Info = info + var _result382 IClientRPCServiceHandshakeResult + var _meta381 thrift.ResponseMeta + _meta381, _err = p.Client_().Call(ctx, "handshake", &_args380, &_result382) + p.SetLastResponseMeta_(_meta381) if _err != nil { return } - return _result274.GetSuccess(), nil + return _result382.GetSuccess(), nil } // Parameters: -// - SessionId -// - Path -func (p *IClientRPCServiceClient) DeleteTimeseries(ctx context.Context, sessionId int64, path []string) (_r *common.TSStatus, _err error) { - var _args275 IClientRPCServiceDeleteTimeseriesArgs - _args275.SessionId = sessionId - _args275.Path = path - var _result277 IClientRPCServiceDeleteTimeseriesResult - var _meta276 thrift.ResponseMeta - _meta276, _err = p.Client_().Call(ctx, "deleteTimeseries", &_args275, &_result277) - p.SetLastResponseMeta_(_meta276) +// - Buff +func (p *IClientRPCServiceClient) SendPipeData(ctx context.Context, buff []byte) (_r *common.TSStatus, _err error) { + var _args383 IClientRPCServiceSendPipeDataArgs + _args383.Buff = buff + var _result385 IClientRPCServiceSendPipeDataResult + var _meta384 thrift.ResponseMeta + _meta384, _err = p.Client_().Call(ctx, "sendPipeData", &_args383, &_result385) + p.SetLastResponseMeta_(_meta384) if _err != nil { return } - return _result277.GetSuccess(), nil + return _result385.GetSuccess(), nil } // Parameters: -// - SessionId -// - StorageGroup -func (p *IClientRPCServiceClient) DeleteStorageGroups(ctx context.Context, sessionId int64, storageGroup []string) (_r *common.TSStatus, _err error) { - var _args278 IClientRPCServiceDeleteStorageGroupsArgs - _args278.SessionId = sessionId - _args278.StorageGroup = storageGroup - var _result280 IClientRPCServiceDeleteStorageGroupsResult - var _meta279 thrift.ResponseMeta - _meta279, _err = p.Client_().Call(ctx, "deleteStorageGroups", &_args278, &_result280) - p.SetLastResponseMeta_(_meta279) +// - MetaInfo +// - Buff +func (p *IClientRPCServiceClient) SendFile(ctx context.Context, metaInfo *TSyncTransportMetaInfo, buff []byte) (_r *common.TSStatus, _err error) { + var _args386 IClientRPCServiceSendFileArgs + _args386.MetaInfo = metaInfo + _args386.Buff = buff + var _result388 IClientRPCServiceSendFileResult + var _meta387 thrift.ResponseMeta + _meta387, _err = p.Client_().Call(ctx, "sendFile", &_args386, &_result388) + p.SetLastResponseMeta_(_meta387) if _err != nil { return } - return _result280.GetSuccess(), nil + return _result388.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) InsertRecord(ctx context.Context, req *TSInsertRecordReq) (_r *common.TSStatus, _err error) { - var _args281 IClientRPCServiceInsertRecordArgs - _args281.Req = req - var _result283 IClientRPCServiceInsertRecordResult - var _meta282 thrift.ResponseMeta - _meta282, _err = p.Client_().Call(ctx, "insertRecord", &_args281, &_result283) - p.SetLastResponseMeta_(_meta282) +func (p *IClientRPCServiceClient) PipeTransfer(ctx context.Context, req *TPipeTransferReq) (_r *TPipeTransferResp, _err error) { + var _args389 IClientRPCServicePipeTransferArgs + _args389.Req = req + var _result391 IClientRPCServicePipeTransferResult + var _meta390 thrift.ResponseMeta + _meta390, _err = p.Client_().Call(ctx, "pipeTransfer", &_args389, &_result391) + p.SetLastResponseMeta_(_meta390) if _err != nil { return } - return _result283.GetSuccess(), nil + return _result391.GetSuccess(), nil } // Parameters: // - Req -func (p *IClientRPCServiceClient) InsertStringRecord(ctx context.Context, req *TSInsertStringRecordReq) (_r *common.TSStatus, _err error) { - var _args284 IClientRPCServiceInsertStringRecordArgs - _args284.Req = req - var _result286 IClientRPCServiceInsertStringRecordResult - var _meta285 thrift.ResponseMeta - _meta285, _err = p.Client_().Call(ctx, "insertStringRecord", &_args284, &_result286) - p.SetLastResponseMeta_(_meta285) +func (p *IClientRPCServiceClient) PipeSubscribe(ctx context.Context, req *TPipeSubscribeReq) (_r *TPipeSubscribeResp, _err error) { + var _args392 IClientRPCServicePipeSubscribeArgs + _args392.Req = req + var _result394 IClientRPCServicePipeSubscribeResult + var _meta393 thrift.ResponseMeta + _meta393, _err = p.Client_().Call(ctx, "pipeSubscribe", &_args392, &_result394) + p.SetLastResponseMeta_(_meta393) if _err != nil { return } - return _result286.GetSuccess(), nil + return _result394.GetSuccess(), nil } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) InsertTablet(ctx context.Context, req *TSInsertTabletReq) (_r *common.TSStatus, _err error) { - var _args287 IClientRPCServiceInsertTabletArgs - _args287.Req = req - var _result289 IClientRPCServiceInsertTabletResult - var _meta288 thrift.ResponseMeta - _meta288, _err = p.Client_().Call(ctx, "insertTablet", &_args287, &_result289) - p.SetLastResponseMeta_(_meta288) +func (p *IClientRPCServiceClient) GetBackupConfiguration(ctx context.Context) (_r *TSBackupConfigurationResp, _err error) { + var _args395 IClientRPCServiceGetBackupConfigurationArgs + var _result397 IClientRPCServiceGetBackupConfigurationResult + var _meta396 thrift.ResponseMeta + _meta396, _err = p.Client_().Call(ctx, "getBackupConfiguration", &_args395, &_result397) + p.SetLastResponseMeta_(_meta396) if _err != nil { return } - return _result289.GetSuccess(), nil + return _result397.GetSuccess(), nil } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) InsertTablets(ctx context.Context, req *TSInsertTabletsReq) (_r *common.TSStatus, _err error) { - var _args290 IClientRPCServiceInsertTabletsArgs - _args290.Req = req - var _result292 IClientRPCServiceInsertTabletsResult - var _meta291 thrift.ResponseMeta - _meta291, _err = p.Client_().Call(ctx, "insertTablets", &_args290, &_result292) - p.SetLastResponseMeta_(_meta291) +func (p *IClientRPCServiceClient) FetchAllConnectionsInfo(ctx context.Context) (_r *TSConnectionInfoResp, _err error) { + var _args398 IClientRPCServiceFetchAllConnectionsInfoArgs + var _result400 IClientRPCServiceFetchAllConnectionsInfoResult + var _meta399 thrift.ResponseMeta + _meta399, _err = p.Client_().Call(ctx, "fetchAllConnectionsInfo", &_args398, &_result400) + p.SetLastResponseMeta_(_meta399) if _err != nil { return } - return _result292.GetSuccess(), nil + return _result400.GetSuccess(), nil } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) InsertRecords(ctx context.Context, req *TSInsertRecordsReq) (_r *common.TSStatus, _err error) { - var _args293 IClientRPCServiceInsertRecordsArgs - _args293.Req = req - var _result295 IClientRPCServiceInsertRecordsResult - var _meta294 thrift.ResponseMeta - _meta294, _err = p.Client_().Call(ctx, "insertRecords", &_args293, &_result295) - p.SetLastResponseMeta_(_meta294) +// For other node's call +func (p *IClientRPCServiceClient) TestConnectionEmptyRPC(ctx context.Context) (_r *common.TSStatus, _err error) { + var _args401 IClientRPCServiceTestConnectionEmptyRPCArgs + var _result403 IClientRPCServiceTestConnectionEmptyRPCResult + var _meta402 thrift.ResponseMeta + _meta402, _err = p.Client_().Call(ctx, "testConnectionEmptyRPC", &_args401, &_result403) + p.SetLastResponseMeta_(_meta402) if _err != nil { return } - return _result295.GetSuccess(), nil -} - -// Parameters: -// - Req -func (p *IClientRPCServiceClient) InsertRecordsOfOneDevice(ctx context.Context, req *TSInsertRecordsOfOneDeviceReq) (_r *common.TSStatus, _err error) { - var _args296 IClientRPCServiceInsertRecordsOfOneDeviceArgs - _args296.Req = req - var _result298 IClientRPCServiceInsertRecordsOfOneDeviceResult - var _meta297 thrift.ResponseMeta - _meta297, _err = p.Client_().Call(ctx, "insertRecordsOfOneDevice", &_args296, &_result298) - p.SetLastResponseMeta_(_meta297) - if _err != nil { - return + return _result403.GetSuccess(), nil +} + +type IClientRPCServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler IClientRPCService +} + +func (p *IClientRPCServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *IClientRPCServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *IClientRPCServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewIClientRPCServiceProcessor(handler IClientRPCService) *IClientRPCServiceProcessor { + + self404 := &IClientRPCServiceProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self404.processorMap["executeQueryStatementV2"] = &iClientRPCServiceProcessorExecuteQueryStatementV2{handler:handler} + self404.processorMap["executeUpdateStatementV2"] = &iClientRPCServiceProcessorExecuteUpdateStatementV2{handler:handler} + self404.processorMap["executeStatementV2"] = &iClientRPCServiceProcessorExecuteStatementV2{handler:handler} + self404.processorMap["executeRawDataQueryV2"] = &iClientRPCServiceProcessorExecuteRawDataQueryV2{handler:handler} + self404.processorMap["executeLastDataQueryV2"] = &iClientRPCServiceProcessorExecuteLastDataQueryV2{handler:handler} + self404.processorMap["executeFastLastDataQueryForOnePrefixPath"] = &iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath{handler:handler} + self404.processorMap["executeFastLastDataQueryForOneDeviceV2"] = &iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2{handler:handler} + self404.processorMap["executeAggregationQueryV2"] = &iClientRPCServiceProcessorExecuteAggregationQueryV2{handler:handler} + self404.processorMap["fetchResultsV2"] = &iClientRPCServiceProcessorFetchResultsV2{handler:handler} + self404.processorMap["openSession"] = &iClientRPCServiceProcessorOpenSession{handler:handler} + self404.processorMap["closeSession"] = &iClientRPCServiceProcessorCloseSession{handler:handler} + self404.processorMap["executeStatement"] = &iClientRPCServiceProcessorExecuteStatement{handler:handler} + self404.processorMap["executeBatchStatement"] = &iClientRPCServiceProcessorExecuteBatchStatement{handler:handler} + self404.processorMap["executeQueryStatement"] = &iClientRPCServiceProcessorExecuteQueryStatement{handler:handler} + self404.processorMap["executeUpdateStatement"] = &iClientRPCServiceProcessorExecuteUpdateStatement{handler:handler} + self404.processorMap["fetchResults"] = &iClientRPCServiceProcessorFetchResults{handler:handler} + self404.processorMap["fetchMetadata"] = &iClientRPCServiceProcessorFetchMetadata{handler:handler} + self404.processorMap["cancelOperation"] = &iClientRPCServiceProcessorCancelOperation{handler:handler} + self404.processorMap["closeOperation"] = &iClientRPCServiceProcessorCloseOperation{handler:handler} + self404.processorMap["prepareStatement"] = &iClientRPCServiceProcessorPrepareStatement{handler:handler} + self404.processorMap["executePreparedStatement"] = &iClientRPCServiceProcessorExecutePreparedStatement{handler:handler} + self404.processorMap["deallocatePreparedStatement"] = &iClientRPCServiceProcessorDeallocatePreparedStatement{handler:handler} + self404.processorMap["getTimeZone"] = &iClientRPCServiceProcessorGetTimeZone{handler:handler} + self404.processorMap["setTimeZone"] = &iClientRPCServiceProcessorSetTimeZone{handler:handler} + self404.processorMap["getProperties"] = &iClientRPCServiceProcessorGetProperties{handler:handler} + self404.processorMap["setStorageGroup"] = &iClientRPCServiceProcessorSetStorageGroup{handler:handler} + self404.processorMap["createTimeseries"] = &iClientRPCServiceProcessorCreateTimeseries{handler:handler} + self404.processorMap["createAlignedTimeseries"] = &iClientRPCServiceProcessorCreateAlignedTimeseries{handler:handler} + self404.processorMap["createMultiTimeseries"] = &iClientRPCServiceProcessorCreateMultiTimeseries{handler:handler} + self404.processorMap["deleteTimeseries"] = &iClientRPCServiceProcessorDeleteTimeseries{handler:handler} + self404.processorMap["deleteStorageGroups"] = &iClientRPCServiceProcessorDeleteStorageGroups{handler:handler} + self404.processorMap["insertRecord"] = &iClientRPCServiceProcessorInsertRecord{handler:handler} + self404.processorMap["insertStringRecord"] = &iClientRPCServiceProcessorInsertStringRecord{handler:handler} + self404.processorMap["insertTablet"] = &iClientRPCServiceProcessorInsertTablet{handler:handler} + self404.processorMap["insertTablets"] = &iClientRPCServiceProcessorInsertTablets{handler:handler} + self404.processorMap["insertRecords"] = &iClientRPCServiceProcessorInsertRecords{handler:handler} + self404.processorMap["insertRecordsOfOneDevice"] = &iClientRPCServiceProcessorInsertRecordsOfOneDevice{handler:handler} + self404.processorMap["insertStringRecordsOfOneDevice"] = &iClientRPCServiceProcessorInsertStringRecordsOfOneDevice{handler:handler} + self404.processorMap["insertStringRecords"] = &iClientRPCServiceProcessorInsertStringRecords{handler:handler} + self404.processorMap["testInsertTablet"] = &iClientRPCServiceProcessorTestInsertTablet{handler:handler} + self404.processorMap["testInsertTablets"] = &iClientRPCServiceProcessorTestInsertTablets{handler:handler} + self404.processorMap["testInsertRecord"] = &iClientRPCServiceProcessorTestInsertRecord{handler:handler} + self404.processorMap["testInsertStringRecord"] = &iClientRPCServiceProcessorTestInsertStringRecord{handler:handler} + self404.processorMap["testInsertRecords"] = &iClientRPCServiceProcessorTestInsertRecords{handler:handler} + self404.processorMap["testInsertRecordsOfOneDevice"] = &iClientRPCServiceProcessorTestInsertRecordsOfOneDevice{handler:handler} + self404.processorMap["testInsertStringRecords"] = &iClientRPCServiceProcessorTestInsertStringRecords{handler:handler} + self404.processorMap["deleteData"] = &iClientRPCServiceProcessorDeleteData{handler:handler} + self404.processorMap["executeRawDataQuery"] = &iClientRPCServiceProcessorExecuteRawDataQuery{handler:handler} + self404.processorMap["executeLastDataQuery"] = &iClientRPCServiceProcessorExecuteLastDataQuery{handler:handler} + self404.processorMap["executeAggregationQuery"] = &iClientRPCServiceProcessorExecuteAggregationQuery{handler:handler} + self404.processorMap["requestStatementId"] = &iClientRPCServiceProcessorRequestStatementId{handler:handler} + self404.processorMap["createSchemaTemplate"] = &iClientRPCServiceProcessorCreateSchemaTemplate{handler:handler} + self404.processorMap["appendSchemaTemplate"] = &iClientRPCServiceProcessorAppendSchemaTemplate{handler:handler} + self404.processorMap["pruneSchemaTemplate"] = &iClientRPCServiceProcessorPruneSchemaTemplate{handler:handler} + self404.processorMap["querySchemaTemplate"] = &iClientRPCServiceProcessorQuerySchemaTemplate{handler:handler} + self404.processorMap["showConfigurationTemplate"] = &iClientRPCServiceProcessorShowConfigurationTemplate{handler:handler} + self404.processorMap["showConfiguration"] = &iClientRPCServiceProcessorShowConfiguration{handler:handler} + self404.processorMap["setSchemaTemplate"] = &iClientRPCServiceProcessorSetSchemaTemplate{handler:handler} + self404.processorMap["unsetSchemaTemplate"] = &iClientRPCServiceProcessorUnsetSchemaTemplate{handler:handler} + self404.processorMap["dropSchemaTemplate"] = &iClientRPCServiceProcessorDropSchemaTemplate{handler:handler} + self404.processorMap["createTimeseriesUsingSchemaTemplate"] = &iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate{handler:handler} + self404.processorMap["handshake"] = &iClientRPCServiceProcessorHandshake{handler:handler} + self404.processorMap["sendPipeData"] = &iClientRPCServiceProcessorSendPipeData{handler:handler} + self404.processorMap["sendFile"] = &iClientRPCServiceProcessorSendFile{handler:handler} + self404.processorMap["pipeTransfer"] = &iClientRPCServiceProcessorPipeTransfer{handler:handler} + self404.processorMap["pipeSubscribe"] = &iClientRPCServiceProcessorPipeSubscribe{handler:handler} + self404.processorMap["getBackupConfiguration"] = &iClientRPCServiceProcessorGetBackupConfiguration{handler:handler} + self404.processorMap["fetchAllConnectionsInfo"] = &iClientRPCServiceProcessorFetchAllConnectionsInfo{handler:handler} + self404.processorMap["testConnectionEmptyRPC"] = &iClientRPCServiceProcessorTestConnectionEmptyRPC{handler:handler} +return self404 +} + +func (p *IClientRPCServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(ctx, seqId, iprot, oprot) + } + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x405 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x405.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, x405 + +} + +type iClientRPCServiceProcessorExecuteQueryStatementV2 struct { + handler IClientRPCService +} + +func (p *iClientRPCServiceProcessorExecuteQueryStatementV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteQueryStatementV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeQueryStatementV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) + } + + result := IClientRPCServiceExecuteQueryStatementV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteQueryStatementV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeQueryStatementV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeQueryStatementV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval + } + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeQueryStatementV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err != nil { + return + } + return true, err +} + +type iClientRPCServiceProcessorExecuteUpdateStatementV2 struct { + handler IClientRPCService +} + +func (p *iClientRPCServiceProcessorExecuteUpdateStatementV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteUpdateStatementV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeUpdateStatementV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) + } + + result := IClientRPCServiceExecuteUpdateStatementV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteUpdateStatementV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeUpdateStatementV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeUpdateStatementV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval + } + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeUpdateStatementV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result298.GetSuccess(), nil -} - -// Parameters: -// - Req -func (p *IClientRPCServiceClient) InsertStringRecordsOfOneDevice(ctx context.Context, req *TSInsertStringRecordsOfOneDeviceReq) (_r *common.TSStatus, _err error) { - var _args299 IClientRPCServiceInsertStringRecordsOfOneDeviceArgs - _args299.Req = req - var _result301 IClientRPCServiceInsertStringRecordsOfOneDeviceResult - var _meta300 thrift.ResponseMeta - _meta300, _err = p.Client_().Call(ctx, "insertStringRecordsOfOneDevice", &_args299, &_result301) - p.SetLastResponseMeta_(_meta300) - if _err != nil { - return + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result301.GetSuccess(), nil -} - -// Parameters: -// - Req -func (p *IClientRPCServiceClient) InsertStringRecords(ctx context.Context, req *TSInsertStringRecordsReq) (_r *common.TSStatus, _err error) { - var _args302 IClientRPCServiceInsertStringRecordsArgs - _args302.Req = req - var _result304 IClientRPCServiceInsertStringRecordsResult - var _meta303 thrift.ResponseMeta - _meta303, _err = p.Client_().Call(ctx, "insertStringRecords", &_args302, &_result304) - p.SetLastResponseMeta_(_meta303) - if _err != nil { + if err != nil { return } - return _result304.GetSuccess(), nil + return true, err } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertTablet(ctx context.Context, req *TSInsertTabletReq) (_r *common.TSStatus, _err error) { - var _args305 IClientRPCServiceTestInsertTabletArgs - _args305.Req = req - var _result307 IClientRPCServiceTestInsertTabletResult - var _meta306 thrift.ResponseMeta - _meta306, _err = p.Client_().Call(ctx, "testInsertTablet", &_args305, &_result307) - p.SetLastResponseMeta_(_meta306) - if _err != nil { - return - } - return _result307.GetSuccess(), nil +type iClientRPCServiceProcessorExecuteStatementV2 struct { + handler IClientRPCService } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertTablets(ctx context.Context, req *TSInsertTabletsReq) (_r *common.TSStatus, _err error) { - var _args308 IClientRPCServiceTestInsertTabletsArgs - _args308.Req = req - var _result310 IClientRPCServiceTestInsertTabletsResult - var _meta309 thrift.ResponseMeta - _meta309, _err = p.Client_().Call(ctx, "testInsertTablets", &_args308, &_result310) - p.SetLastResponseMeta_(_meta309) - if _err != nil { - return +func (p *iClientRPCServiceProcessorExecuteStatementV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteStatementV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeStatementV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) } - return _result310.GetSuccess(), nil -} + iprot.ReadMessageEnd(ctx) -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertRecord(ctx context.Context, req *TSInsertRecordReq) (_r *common.TSStatus, _err error) { - var _args311 IClientRPCServiceTestInsertRecordArgs - _args311.Req = req - var _result313 IClientRPCServiceTestInsertRecordResult - var _meta312 thrift.ResponseMeta - _meta312, _err = p.Client_().Call(ctx, "testInsertRecord", &_args311, &_result313) - p.SetLastResponseMeta_(_meta312) - if _err != nil { - return + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - return _result313.GetSuccess(), nil -} -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertStringRecord(ctx context.Context, req *TSInsertStringRecordReq) (_r *common.TSStatus, _err error) { - var _args314 IClientRPCServiceTestInsertStringRecordArgs - _args314.Req = req - var _result316 IClientRPCServiceTestInsertStringRecordResult - var _meta315 thrift.ResponseMeta - _meta315, _err = p.Client_().Call(ctx, "testInsertStringRecord", &_args314, &_result316) - p.SetLastResponseMeta_(_meta315) - if _err != nil { - return + result := IClientRPCServiceExecuteStatementV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteStatementV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeStatementV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeStatementV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval } - return _result316.GetSuccess(), nil -} - -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertRecords(ctx context.Context, req *TSInsertRecordsReq) (_r *common.TSStatus, _err error) { - var _args317 IClientRPCServiceTestInsertRecordsArgs - _args317.Req = req - var _result319 IClientRPCServiceTestInsertRecordsResult - var _meta318 thrift.ResponseMeta - _meta318, _err = p.Client_().Call(ctx, "testInsertRecords", &_args317, &_result319) - p.SetLastResponseMeta_(_meta318) - if _err != nil { + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeStatementV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err != nil { return } - return _result319.GetSuccess(), nil + return true, err } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertRecordsOfOneDevice(ctx context.Context, req *TSInsertRecordsOfOneDeviceReq) (_r *common.TSStatus, _err error) { - var _args320 IClientRPCServiceTestInsertRecordsOfOneDeviceArgs - _args320.Req = req - var _result322 IClientRPCServiceTestInsertRecordsOfOneDeviceResult - var _meta321 thrift.ResponseMeta - _meta321, _err = p.Client_().Call(ctx, "testInsertRecordsOfOneDevice", &_args320, &_result322) - p.SetLastResponseMeta_(_meta321) - if _err != nil { - return - } - return _result322.GetSuccess(), nil +type iClientRPCServiceProcessorExecuteRawDataQueryV2 struct { + handler IClientRPCService } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) TestInsertStringRecords(ctx context.Context, req *TSInsertStringRecordsReq) (_r *common.TSStatus, _err error) { - var _args323 IClientRPCServiceTestInsertStringRecordsArgs - _args323.Req = req - var _result325 IClientRPCServiceTestInsertStringRecordsResult - var _meta324 thrift.ResponseMeta - _meta324, _err = p.Client_().Call(ctx, "testInsertStringRecords", &_args323, &_result325) - p.SetLastResponseMeta_(_meta324) - if _err != nil { - return +func (p *iClientRPCServiceProcessorExecuteRawDataQueryV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteRawDataQueryV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeRawDataQueryV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) } - return _result325.GetSuccess(), nil -} + iprot.ReadMessageEnd(ctx) -// Parameters: -// - Req -func (p *IClientRPCServiceClient) DeleteData(ctx context.Context, req *TSDeleteDataReq) (_r *common.TSStatus, _err error) { - var _args326 IClientRPCServiceDeleteDataArgs - _args326.Req = req - var _result328 IClientRPCServiceDeleteDataResult - var _meta327 thrift.ResponseMeta - _meta327, _err = p.Client_().Call(ctx, "deleteData", &_args326, &_result328) - p.SetLastResponseMeta_(_meta327) - if _err != nil { - return + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - return _result328.GetSuccess(), nil -} -// Parameters: -// - Req -func (p *IClientRPCServiceClient) ExecuteRawDataQuery(ctx context.Context, req *TSRawDataQueryReq) (_r *TSExecuteStatementResp, _err error) { - var _args329 IClientRPCServiceExecuteRawDataQueryArgs - _args329.Req = req - var _result331 IClientRPCServiceExecuteRawDataQueryResult - var _meta330 thrift.ResponseMeta - _meta330, _err = p.Client_().Call(ctx, "executeRawDataQuery", &_args329, &_result331) - p.SetLastResponseMeta_(_meta330) - if _err != nil { - return + result := IClientRPCServiceExecuteRawDataQueryV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteRawDataQueryV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeRawDataQueryV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeRawDataQueryV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval + } + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeRawDataQueryV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result331.GetSuccess(), nil -} - -// Parameters: -// - Req -func (p *IClientRPCServiceClient) ExecuteLastDataQuery(ctx context.Context, req *TSLastDataQueryReq) (_r *TSExecuteStatementResp, _err error) { - var _args332 IClientRPCServiceExecuteLastDataQueryArgs - _args332.Req = req - var _result334 IClientRPCServiceExecuteLastDataQueryResult - var _meta333 thrift.ResponseMeta - _meta333, _err = p.Client_().Call(ctx, "executeLastDataQuery", &_args332, &_result334) - p.SetLastResponseMeta_(_meta333) - if _err != nil { - return + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result334.GetSuccess(), nil -} - -// Parameters: -// - Req -func (p *IClientRPCServiceClient) ExecuteAggregationQuery(ctx context.Context, req *TSAggregationQueryReq) (_r *TSExecuteStatementResp, _err error) { - var _args335 IClientRPCServiceExecuteAggregationQueryArgs - _args335.Req = req - var _result337 IClientRPCServiceExecuteAggregationQueryResult - var _meta336 thrift.ResponseMeta - _meta336, _err = p.Client_().Call(ctx, "executeAggregationQuery", &_args335, &_result337) - p.SetLastResponseMeta_(_meta336) - if _err != nil { - return + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result337.GetSuccess(), nil -} - -// Parameters: -// - SessionId -func (p *IClientRPCServiceClient) RequestStatementId(ctx context.Context, sessionId int64) (_r int64, _err error) { - var _args338 IClientRPCServiceRequestStatementIdArgs - _args338.SessionId = sessionId - var _result340 IClientRPCServiceRequestStatementIdResult - var _meta339 thrift.ResponseMeta - _meta339, _err = p.Client_().Call(ctx, "requestStatementId", &_args338, &_result340) - p.SetLastResponseMeta_(_meta339) - if _err != nil { + if err != nil { return } - return _result340.GetSuccess(), nil + return true, err } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) CreateSchemaTemplate(ctx context.Context, req *TSCreateSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args341 IClientRPCServiceCreateSchemaTemplateArgs - _args341.Req = req - var _result343 IClientRPCServiceCreateSchemaTemplateResult - var _meta342 thrift.ResponseMeta - _meta342, _err = p.Client_().Call(ctx, "createSchemaTemplate", &_args341, &_result343) - p.SetLastResponseMeta_(_meta342) - if _err != nil { - return - } - return _result343.GetSuccess(), nil +type iClientRPCServiceProcessorExecuteLastDataQueryV2 struct { + handler IClientRPCService } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) AppendSchemaTemplate(ctx context.Context, req *TSAppendSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args344 IClientRPCServiceAppendSchemaTemplateArgs - _args344.Req = req - var _result346 IClientRPCServiceAppendSchemaTemplateResult - var _meta345 thrift.ResponseMeta - _meta345, _err = p.Client_().Call(ctx, "appendSchemaTemplate", &_args344, &_result346) - p.SetLastResponseMeta_(_meta345) - if _err != nil { - return +func (p *iClientRPCServiceProcessorExecuteLastDataQueryV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteLastDataQueryV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeLastDataQueryV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) } - return _result346.GetSuccess(), nil -} + iprot.ReadMessageEnd(ctx) -// Parameters: -// - Req -func (p *IClientRPCServiceClient) PruneSchemaTemplate(ctx context.Context, req *TSPruneSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args347 IClientRPCServicePruneSchemaTemplateArgs - _args347.Req = req - var _result349 IClientRPCServicePruneSchemaTemplateResult - var _meta348 thrift.ResponseMeta - _meta348, _err = p.Client_().Call(ctx, "pruneSchemaTemplate", &_args347, &_result349) - p.SetLastResponseMeta_(_meta348) - if _err != nil { - return + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - return _result349.GetSuccess(), nil -} -// Parameters: -// - Req -func (p *IClientRPCServiceClient) QuerySchemaTemplate(ctx context.Context, req *TSQueryTemplateReq) (_r *TSQueryTemplateResp, _err error) { - var _args350 IClientRPCServiceQuerySchemaTemplateArgs - _args350.Req = req - var _result352 IClientRPCServiceQuerySchemaTemplateResult - var _meta351 thrift.ResponseMeta - _meta351, _err = p.Client_().Call(ctx, "querySchemaTemplate", &_args350, &_result352) - p.SetLastResponseMeta_(_meta351) - if _err != nil { - return + result := IClientRPCServiceExecuteLastDataQueryV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteLastDataQueryV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeLastDataQueryV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeLastDataQueryV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval } - return _result352.GetSuccess(), nil -} - -func (p *IClientRPCServiceClient) ShowConfigurationTemplate(ctx context.Context) (_r *common.TShowConfigurationTemplateResp, _err error) { - var _args353 IClientRPCServiceShowConfigurationTemplateArgs - var _result355 IClientRPCServiceShowConfigurationTemplateResult - var _meta354 thrift.ResponseMeta - _meta354, _err = p.Client_().Call(ctx, "showConfigurationTemplate", &_args353, &_result355) - p.SetLastResponseMeta_(_meta354) - if _err != nil { - return + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeLastDataQueryV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - return _result355.GetSuccess(), nil -} - -// Parameters: -// - NodeId -func (p *IClientRPCServiceClient) ShowConfiguration(ctx context.Context, nodeId int32) (_r *common.TShowConfigurationResp, _err error) { - var _args356 IClientRPCServiceShowConfigurationArgs - _args356.NodeId = nodeId - var _result358 IClientRPCServiceShowConfigurationResult - var _meta357 thrift.ResponseMeta - _meta357, _err = p.Client_().Call(ctx, "showConfiguration", &_args356, &_result358) - p.SetLastResponseMeta_(_meta357) - if _err != nil { + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err != nil { return } - return _result358.GetSuccess(), nil + return true, err } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) SetSchemaTemplate(ctx context.Context, req *TSSetSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args359 IClientRPCServiceSetSchemaTemplateArgs - _args359.Req = req - var _result361 IClientRPCServiceSetSchemaTemplateResult - var _meta360 thrift.ResponseMeta - _meta360, _err = p.Client_().Call(ctx, "setSchemaTemplate", &_args359, &_result361) - p.SetLastResponseMeta_(_meta360) - if _err != nil { - return - } - return _result361.GetSuccess(), nil +type iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath struct { + handler IClientRPCService } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) UnsetSchemaTemplate(ctx context.Context, req *TSUnsetSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args362 IClientRPCServiceUnsetSchemaTemplateArgs - _args362.Req = req - var _result364 IClientRPCServiceUnsetSchemaTemplateResult - var _meta363 thrift.ResponseMeta - _meta363, _err = p.Client_().Call(ctx, "unsetSchemaTemplate", &_args362, &_result364) - p.SetLastResponseMeta_(_meta363) - if _err != nil { - return +func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOnePrefixPath", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) } - return _result364.GetSuccess(), nil -} + iprot.ReadMessageEnd(ctx) -// Parameters: -// - Req -func (p *IClientRPCServiceClient) DropSchemaTemplate(ctx context.Context, req *TSDropSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args365 IClientRPCServiceDropSchemaTemplateArgs - _args365.Req = req - var _result367 IClientRPCServiceDropSchemaTemplateResult - var _meta366 thrift.ResponseMeta - _meta366, _err = p.Client_().Call(ctx, "dropSchemaTemplate", &_args365, &_result367) - p.SetLastResponseMeta_(_meta366) - if _err != nil { - return + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - return _result367.GetSuccess(), nil -} -// Parameters: -// - Req -func (p *IClientRPCServiceClient) CreateTimeseriesUsingSchemaTemplate(ctx context.Context, req *TCreateTimeseriesUsingSchemaTemplateReq) (_r *common.TSStatus, _err error) { - var _args368 IClientRPCServiceCreateTimeseriesUsingSchemaTemplateArgs - _args368.Req = req - var _result370 IClientRPCServiceCreateTimeseriesUsingSchemaTemplateResult - var _meta369 thrift.ResponseMeta - _meta369, _err = p.Client_().Call(ctx, "createTimeseriesUsingSchemaTemplate", &_args368, &_result370) - p.SetLastResponseMeta_(_meta369) - if _err != nil { - return + result := IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteFastLastDataQueryForOnePrefixPath(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeFastLastDataQueryForOnePrefixPath: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOnePrefixPath", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval + } + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOnePrefixPath", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result370.GetSuccess(), nil -} - -// Parameters: -// - Info -func (p *IClientRPCServiceClient) Handshake(ctx context.Context, info *TSyncIdentityInfo) (_r *common.TSStatus, _err error) { - var _args371 IClientRPCServiceHandshakeArgs - _args371.Info = info - var _result373 IClientRPCServiceHandshakeResult - var _meta372 thrift.ResponseMeta - _meta372, _err = p.Client_().Call(ctx, "handshake", &_args371, &_result373) - p.SetLastResponseMeta_(_meta372) - if _err != nil { - return + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result373.GetSuccess(), nil -} - -// Parameters: -// - Buff -func (p *IClientRPCServiceClient) SendPipeData(ctx context.Context, buff []byte) (_r *common.TSStatus, _err error) { - var _args374 IClientRPCServiceSendPipeDataArgs - _args374.Buff = buff - var _result376 IClientRPCServiceSendPipeDataResult - var _meta375 thrift.ResponseMeta - _meta375, _err = p.Client_().Call(ctx, "sendPipeData", &_args374, &_result376) - p.SetLastResponseMeta_(_meta375) - if _err != nil { - return + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - return _result376.GetSuccess(), nil -} - -// Parameters: -// - MetaInfo -// - Buff -func (p *IClientRPCServiceClient) SendFile(ctx context.Context, metaInfo *TSyncTransportMetaInfo, buff []byte) (_r *common.TSStatus, _err error) { - var _args377 IClientRPCServiceSendFileArgs - _args377.MetaInfo = metaInfo - _args377.Buff = buff - var _result379 IClientRPCServiceSendFileResult - var _meta378 thrift.ResponseMeta - _meta378, _err = p.Client_().Call(ctx, "sendFile", &_args377, &_result379) - p.SetLastResponseMeta_(_meta378) - if _err != nil { + if err != nil { return } - return _result379.GetSuccess(), nil + return true, err } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) PipeTransfer(ctx context.Context, req *TPipeTransferReq) (_r *TPipeTransferResp, _err error) { - var _args380 IClientRPCServicePipeTransferArgs - _args380.Req = req - var _result382 IClientRPCServicePipeTransferResult - var _meta381 thrift.ResponseMeta - _meta381, _err = p.Client_().Call(ctx, "pipeTransfer", &_args380, &_result382) - p.SetLastResponseMeta_(_meta381) - if _err != nil { - return - } - return _result382.GetSuccess(), nil +type iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2 struct { + handler IClientRPCService } -// Parameters: -// - Req -func (p *IClientRPCServiceClient) PipeSubscribe(ctx context.Context, req *TPipeSubscribeReq) (_r *TPipeSubscribeResp, _err error) { - var _args383 IClientRPCServicePipeSubscribeArgs - _args383.Req = req - var _result385 IClientRPCServicePipeSubscribeResult - var _meta384 thrift.ResponseMeta - _meta384, _err = p.Client_().Call(ctx, "pipeSubscribe", &_args383, &_result385) - p.SetLastResponseMeta_(_meta384) - if _err != nil { - return +func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOneDeviceV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) } - return _result385.GetSuccess(), nil -} + iprot.ReadMessageEnd(ctx) -func (p *IClientRPCServiceClient) GetBackupConfiguration(ctx context.Context) (_r *TSBackupConfigurationResp, _err error) { - var _args386 IClientRPCServiceGetBackupConfigurationArgs - var _result388 IClientRPCServiceGetBackupConfigurationResult - var _meta387 thrift.ResponseMeta - _meta387, _err = p.Client_().Call(ctx, "getBackupConfiguration", &_args386, &_result388) - p.SetLastResponseMeta_(_meta387) - if _err != nil { - return + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - return _result388.GetSuccess(), nil -} -func (p *IClientRPCServiceClient) FetchAllConnectionsInfo(ctx context.Context) (_r *TSConnectionInfoResp, _err error) { - var _args389 IClientRPCServiceFetchAllConnectionsInfoArgs - var _result391 IClientRPCServiceFetchAllConnectionsInfoResult - var _meta390 thrift.ResponseMeta - _meta390, _err = p.Client_().Call(ctx, "fetchAllConnectionsInfo", &_args389, &_result391) - p.SetLastResponseMeta_(_meta390) - if _err != nil { - return + result := IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteFastLastDataQueryForOneDeviceV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeFastLastDataQueryForOneDeviceV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOneDeviceV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval } - return _result391.GetSuccess(), nil -} - -// For other node's call -func (p *IClientRPCServiceClient) TestConnectionEmptyRPC(ctx context.Context) (_r *common.TSStatus, _err error) { - var _args392 IClientRPCServiceTestConnectionEmptyRPCArgs - var _result394 IClientRPCServiceTestConnectionEmptyRPCResult - var _meta393 thrift.ResponseMeta - _meta393, _err = p.Client_().Call(ctx, "testConnectionEmptyRPC", &_args392, &_result394) - p.SetLastResponseMeta_(_meta393) - if _err != nil { + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOneDeviceV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err != nil { return } - return _result394.GetSuccess(), nil + return true, err } -type IClientRPCServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction +type iClientRPCServiceProcessorExecuteAggregationQueryV2 struct { handler IClientRPCService } -func (p *IClientRPCServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *IClientRPCServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *IClientRPCServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewIClientRPCServiceProcessor(handler IClientRPCService) *IClientRPCServiceProcessor { - - self395 := &IClientRPCServiceProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self395.processorMap["executeQueryStatementV2"] = &iClientRPCServiceProcessorExecuteQueryStatementV2{handler:handler} - self395.processorMap["executeUpdateStatementV2"] = &iClientRPCServiceProcessorExecuteUpdateStatementV2{handler:handler} - self395.processorMap["executeStatementV2"] = &iClientRPCServiceProcessorExecuteStatementV2{handler:handler} - self395.processorMap["executeRawDataQueryV2"] = &iClientRPCServiceProcessorExecuteRawDataQueryV2{handler:handler} - self395.processorMap["executeLastDataQueryV2"] = &iClientRPCServiceProcessorExecuteLastDataQueryV2{handler:handler} - self395.processorMap["executeFastLastDataQueryForOnePrefixPath"] = &iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath{handler:handler} - self395.processorMap["executeFastLastDataQueryForOneDeviceV2"] = &iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2{handler:handler} - self395.processorMap["executeAggregationQueryV2"] = &iClientRPCServiceProcessorExecuteAggregationQueryV2{handler:handler} - self395.processorMap["fetchResultsV2"] = &iClientRPCServiceProcessorFetchResultsV2{handler:handler} - self395.processorMap["openSession"] = &iClientRPCServiceProcessorOpenSession{handler:handler} - self395.processorMap["closeSession"] = &iClientRPCServiceProcessorCloseSession{handler:handler} - self395.processorMap["executeStatement"] = &iClientRPCServiceProcessorExecuteStatement{handler:handler} - self395.processorMap["executeBatchStatement"] = &iClientRPCServiceProcessorExecuteBatchStatement{handler:handler} - self395.processorMap["executeQueryStatement"] = &iClientRPCServiceProcessorExecuteQueryStatement{handler:handler} - self395.processorMap["executeUpdateStatement"] = &iClientRPCServiceProcessorExecuteUpdateStatement{handler:handler} - self395.processorMap["fetchResults"] = &iClientRPCServiceProcessorFetchResults{handler:handler} - self395.processorMap["fetchMetadata"] = &iClientRPCServiceProcessorFetchMetadata{handler:handler} - self395.processorMap["cancelOperation"] = &iClientRPCServiceProcessorCancelOperation{handler:handler} - self395.processorMap["closeOperation"] = &iClientRPCServiceProcessorCloseOperation{handler:handler} - self395.processorMap["getTimeZone"] = &iClientRPCServiceProcessorGetTimeZone{handler:handler} - self395.processorMap["setTimeZone"] = &iClientRPCServiceProcessorSetTimeZone{handler:handler} - self395.processorMap["getProperties"] = &iClientRPCServiceProcessorGetProperties{handler:handler} - self395.processorMap["setStorageGroup"] = &iClientRPCServiceProcessorSetStorageGroup{handler:handler} - self395.processorMap["createTimeseries"] = &iClientRPCServiceProcessorCreateTimeseries{handler:handler} - self395.processorMap["createAlignedTimeseries"] = &iClientRPCServiceProcessorCreateAlignedTimeseries{handler:handler} - self395.processorMap["createMultiTimeseries"] = &iClientRPCServiceProcessorCreateMultiTimeseries{handler:handler} - self395.processorMap["deleteTimeseries"] = &iClientRPCServiceProcessorDeleteTimeseries{handler:handler} - self395.processorMap["deleteStorageGroups"] = &iClientRPCServiceProcessorDeleteStorageGroups{handler:handler} - self395.processorMap["insertRecord"] = &iClientRPCServiceProcessorInsertRecord{handler:handler} - self395.processorMap["insertStringRecord"] = &iClientRPCServiceProcessorInsertStringRecord{handler:handler} - self395.processorMap["insertTablet"] = &iClientRPCServiceProcessorInsertTablet{handler:handler} - self395.processorMap["insertTablets"] = &iClientRPCServiceProcessorInsertTablets{handler:handler} - self395.processorMap["insertRecords"] = &iClientRPCServiceProcessorInsertRecords{handler:handler} - self395.processorMap["insertRecordsOfOneDevice"] = &iClientRPCServiceProcessorInsertRecordsOfOneDevice{handler:handler} - self395.processorMap["insertStringRecordsOfOneDevice"] = &iClientRPCServiceProcessorInsertStringRecordsOfOneDevice{handler:handler} - self395.processorMap["insertStringRecords"] = &iClientRPCServiceProcessorInsertStringRecords{handler:handler} - self395.processorMap["testInsertTablet"] = &iClientRPCServiceProcessorTestInsertTablet{handler:handler} - self395.processorMap["testInsertTablets"] = &iClientRPCServiceProcessorTestInsertTablets{handler:handler} - self395.processorMap["testInsertRecord"] = &iClientRPCServiceProcessorTestInsertRecord{handler:handler} - self395.processorMap["testInsertStringRecord"] = &iClientRPCServiceProcessorTestInsertStringRecord{handler:handler} - self395.processorMap["testInsertRecords"] = &iClientRPCServiceProcessorTestInsertRecords{handler:handler} - self395.processorMap["testInsertRecordsOfOneDevice"] = &iClientRPCServiceProcessorTestInsertRecordsOfOneDevice{handler:handler} - self395.processorMap["testInsertStringRecords"] = &iClientRPCServiceProcessorTestInsertStringRecords{handler:handler} - self395.processorMap["deleteData"] = &iClientRPCServiceProcessorDeleteData{handler:handler} - self395.processorMap["executeRawDataQuery"] = &iClientRPCServiceProcessorExecuteRawDataQuery{handler:handler} - self395.processorMap["executeLastDataQuery"] = &iClientRPCServiceProcessorExecuteLastDataQuery{handler:handler} - self395.processorMap["executeAggregationQuery"] = &iClientRPCServiceProcessorExecuteAggregationQuery{handler:handler} - self395.processorMap["requestStatementId"] = &iClientRPCServiceProcessorRequestStatementId{handler:handler} - self395.processorMap["createSchemaTemplate"] = &iClientRPCServiceProcessorCreateSchemaTemplate{handler:handler} - self395.processorMap["appendSchemaTemplate"] = &iClientRPCServiceProcessorAppendSchemaTemplate{handler:handler} - self395.processorMap["pruneSchemaTemplate"] = &iClientRPCServiceProcessorPruneSchemaTemplate{handler:handler} - self395.processorMap["querySchemaTemplate"] = &iClientRPCServiceProcessorQuerySchemaTemplate{handler:handler} - self395.processorMap["showConfigurationTemplate"] = &iClientRPCServiceProcessorShowConfigurationTemplate{handler:handler} - self395.processorMap["showConfiguration"] = &iClientRPCServiceProcessorShowConfiguration{handler:handler} - self395.processorMap["setSchemaTemplate"] = &iClientRPCServiceProcessorSetSchemaTemplate{handler:handler} - self395.processorMap["unsetSchemaTemplate"] = &iClientRPCServiceProcessorUnsetSchemaTemplate{handler:handler} - self395.processorMap["dropSchemaTemplate"] = &iClientRPCServiceProcessorDropSchemaTemplate{handler:handler} - self395.processorMap["createTimeseriesUsingSchemaTemplate"] = &iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate{handler:handler} - self395.processorMap["handshake"] = &iClientRPCServiceProcessorHandshake{handler:handler} - self395.processorMap["sendPipeData"] = &iClientRPCServiceProcessorSendPipeData{handler:handler} - self395.processorMap["sendFile"] = &iClientRPCServiceProcessorSendFile{handler:handler} - self395.processorMap["pipeTransfer"] = &iClientRPCServiceProcessorPipeTransfer{handler:handler} - self395.processorMap["pipeSubscribe"] = &iClientRPCServiceProcessorPipeSubscribe{handler:handler} - self395.processorMap["getBackupConfiguration"] = &iClientRPCServiceProcessorGetBackupConfiguration{handler:handler} - self395.processorMap["fetchAllConnectionsInfo"] = &iClientRPCServiceProcessorFetchAllConnectionsInfo{handler:handler} - self395.processorMap["testConnectionEmptyRPC"] = &iClientRPCServiceProcessorTestConnectionEmptyRPC{handler:handler} -return self395 -} - -func (p *IClientRPCServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) - if err2 != nil { return false, thrift.WrapTException(err2) } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) +func (p *iClientRPCServiceProcessorExecuteAggregationQueryV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteAggregationQueryV2Args{} + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "executeAggregationQueryV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return false, thrift.WrapTException(err2) } - iprot.Skip(ctx, thrift.STRUCT) iprot.ReadMessageEnd(ctx) - x396 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) - x396.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, x396 + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) + } + + result := IClientRPCServiceExecuteAggregationQueryV2Result{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteAggregationQueryV2(ctx, args.Req); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeAggregationQueryV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeAggregationQueryV2", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) + oprot.Flush(ctx) + return true, thrift.WrapTException(err2) + } else { + result.Success = retval + } + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "executeAggregationQueryV2", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err != nil { + return + } + return true, err } -type iClientRPCServiceProcessorExecuteQueryStatementV2 struct { +type iClientRPCServiceProcessorFetchResultsV2 struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteQueryStatementV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteQueryStatementV2Args{} +func (p *iClientRPCServiceProcessorFetchResultsV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceFetchResultsV2Args{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeQueryStatementV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "fetchResultsV2", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20406,17 +21931,17 @@ func (p *iClientRPCServiceProcessorExecuteQueryStatementV2) Process(ctx context. } } }(tickerCtx, cancel) - } - - result := IClientRPCServiceExecuteQueryStatementV2Result{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteQueryStatementV2(ctx, args.Req); err2 != nil { + } + + result := IClientRPCServiceFetchResultsV2Result{} + var retval *TSFetchResultsResp + if retval, err2 = p.handler.FetchResultsV2(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeQueryStatementV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeQueryStatementV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchResultsV2: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "fetchResultsV2", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20425,7 +21950,7 @@ func (p *iClientRPCServiceProcessorExecuteQueryStatementV2) Process(ctx context. result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeQueryStatementV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "fetchResultsV2", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20443,17 +21968,17 @@ func (p *iClientRPCServiceProcessorExecuteQueryStatementV2) Process(ctx context. return true, err } -type iClientRPCServiceProcessorExecuteUpdateStatementV2 struct { +type iClientRPCServiceProcessorOpenSession struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteUpdateStatementV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteUpdateStatementV2Args{} +func (p *iClientRPCServiceProcessorOpenSession) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceOpenSessionArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeUpdateStatementV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "openSession", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20487,15 +22012,15 @@ func (p *iClientRPCServiceProcessorExecuteUpdateStatementV2) Process(ctx context }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteUpdateStatementV2Result{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteUpdateStatementV2(ctx, args.Req); err2 != nil { + result := IClientRPCServiceOpenSessionResult{} + var retval *TSOpenSessionResp + if retval, err2 = p.handler.OpenSession(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeUpdateStatementV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeUpdateStatementV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing openSession: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "openSession", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20504,7 +22029,7 @@ func (p *iClientRPCServiceProcessorExecuteUpdateStatementV2) Process(ctx context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeUpdateStatementV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "openSession", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20522,17 +22047,17 @@ func (p *iClientRPCServiceProcessorExecuteUpdateStatementV2) Process(ctx context return true, err } -type iClientRPCServiceProcessorExecuteStatementV2 struct { +type iClientRPCServiceProcessorCloseSession struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteStatementV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteStatementV2Args{} +func (p *iClientRPCServiceProcessorCloseSession) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCloseSessionArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeStatementV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "closeSession", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20566,15 +22091,15 @@ func (p *iClientRPCServiceProcessorExecuteStatementV2) Process(ctx context.Conte }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteStatementV2Result{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteStatementV2(ctx, args.Req); err2 != nil { + result := IClientRPCServiceCloseSessionResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.CloseSession(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeStatementV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeStatementV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing closeSession: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "closeSession", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20583,7 +22108,7 @@ func (p *iClientRPCServiceProcessorExecuteStatementV2) Process(ctx context.Conte result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeStatementV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "closeSession", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20601,17 +22126,17 @@ func (p *iClientRPCServiceProcessorExecuteStatementV2) Process(ctx context.Conte return true, err } -type iClientRPCServiceProcessorExecuteRawDataQueryV2 struct { +type iClientRPCServiceProcessorExecuteStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteRawDataQueryV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteRawDataQueryV2Args{} +func (p *iClientRPCServiceProcessorExecuteStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeRawDataQueryV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20645,15 +22170,15 @@ func (p *iClientRPCServiceProcessorExecuteRawDataQueryV2) Process(ctx context.Co }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteRawDataQueryV2Result{} + result := IClientRPCServiceExecuteStatementResult{} var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteRawDataQueryV2(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.ExecuteStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeRawDataQueryV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeRawDataQueryV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20662,7 +22187,7 @@ func (p *iClientRPCServiceProcessorExecuteRawDataQueryV2) Process(ctx context.Co result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeRawDataQueryV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20680,17 +22205,17 @@ func (p *iClientRPCServiceProcessorExecuteRawDataQueryV2) Process(ctx context.Co return true, err } -type iClientRPCServiceProcessorExecuteLastDataQueryV2 struct { +type iClientRPCServiceProcessorExecuteBatchStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteLastDataQueryV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteLastDataQueryV2Args{} +func (p *iClientRPCServiceProcessorExecuteBatchStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteBatchStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeLastDataQueryV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeBatchStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20724,15 +22249,15 @@ func (p *iClientRPCServiceProcessorExecuteLastDataQueryV2) Process(ctx context.C }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteLastDataQueryV2Result{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteLastDataQueryV2(ctx, args.Req); err2 != nil { + result := IClientRPCServiceExecuteBatchStatementResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.ExecuteBatchStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeLastDataQueryV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeLastDataQueryV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeBatchStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeBatchStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20741,7 +22266,7 @@ func (p *iClientRPCServiceProcessorExecuteLastDataQueryV2) Process(ctx context.C result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeLastDataQueryV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeBatchStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20759,17 +22284,17 @@ func (p *iClientRPCServiceProcessorExecuteLastDataQueryV2) Process(ctx context.C return true, err } -type iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath struct { +type iClientRPCServiceProcessorExecuteQueryStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs{} +func (p *iClientRPCServiceProcessorExecuteQueryStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteQueryStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOnePrefixPath", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeQueryStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20803,15 +22328,15 @@ func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath) Pro }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult{} + result := IClientRPCServiceExecuteQueryStatementResult{} var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteFastLastDataQueryForOnePrefixPath(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.ExecuteQueryStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeFastLastDataQueryForOnePrefixPath: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOnePrefixPath", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeQueryStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeQueryStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20820,7 +22345,7 @@ func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath) Pro result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOnePrefixPath", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeQueryStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20838,17 +22363,17 @@ func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOnePrefixPath) Pro return true, err } -type iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2 struct { +type iClientRPCServiceProcessorExecuteUpdateStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args{} +func (p *iClientRPCServiceProcessorExecuteUpdateStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteUpdateStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOneDeviceV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeUpdateStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20882,15 +22407,15 @@ func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2) Proce }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result{} + result := IClientRPCServiceExecuteUpdateStatementResult{} var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteFastLastDataQueryForOneDeviceV2(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.ExecuteUpdateStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeFastLastDataQueryForOneDeviceV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOneDeviceV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeUpdateStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeUpdateStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20899,7 +22424,7 @@ func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2) Proce result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeFastLastDataQueryForOneDeviceV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeUpdateStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20917,17 +22442,17 @@ func (p *iClientRPCServiceProcessorExecuteFastLastDataQueryForOneDeviceV2) Proce return true, err } -type iClientRPCServiceProcessorExecuteAggregationQueryV2 struct { +type iClientRPCServiceProcessorFetchResults struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteAggregationQueryV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteAggregationQueryV2Args{} +func (p *iClientRPCServiceProcessorFetchResults) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceFetchResultsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeAggregationQueryV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "fetchResults", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20961,15 +22486,15 @@ func (p *iClientRPCServiceProcessorExecuteAggregationQueryV2) Process(ctx contex }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteAggregationQueryV2Result{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteAggregationQueryV2(ctx, args.Req); err2 != nil { + result := IClientRPCServiceFetchResultsResult{} + var retval *TSFetchResultsResp + if retval, err2 = p.handler.FetchResults(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeAggregationQueryV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeAggregationQueryV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchResults: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "fetchResults", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -20978,7 +22503,7 @@ func (p *iClientRPCServiceProcessorExecuteAggregationQueryV2) Process(ctx contex result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeAggregationQueryV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "fetchResults", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -20996,17 +22521,17 @@ func (p *iClientRPCServiceProcessorExecuteAggregationQueryV2) Process(ctx contex return true, err } -type iClientRPCServiceProcessorFetchResultsV2 struct { +type iClientRPCServiceProcessorFetchMetadata struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorFetchResultsV2) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceFetchResultsV2Args{} +func (p *iClientRPCServiceProcessorFetchMetadata) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceFetchMetadataArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchResultsV2", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "fetchMetadata", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21040,15 +22565,15 @@ func (p *iClientRPCServiceProcessorFetchResultsV2) Process(ctx context.Context, }(tickerCtx, cancel) } - result := IClientRPCServiceFetchResultsV2Result{} - var retval *TSFetchResultsResp - if retval, err2 = p.handler.FetchResultsV2(ctx, args.Req); err2 != nil { + result := IClientRPCServiceFetchMetadataResult{} + var retval *TSFetchMetadataResp + if retval, err2 = p.handler.FetchMetadata(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchResultsV2: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchResultsV2", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchMetadata: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "fetchMetadata", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21057,7 +22582,7 @@ func (p *iClientRPCServiceProcessorFetchResultsV2) Process(ctx context.Context, result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "fetchResultsV2", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "fetchMetadata", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21075,17 +22600,17 @@ func (p *iClientRPCServiceProcessorFetchResultsV2) Process(ctx context.Context, return true, err } -type iClientRPCServiceProcessorOpenSession struct { +type iClientRPCServiceProcessorCancelOperation struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorOpenSession) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceOpenSessionArgs{} +func (p *iClientRPCServiceProcessorCancelOperation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCancelOperationArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "openSession", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "cancelOperation", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21119,15 +22644,15 @@ func (p *iClientRPCServiceProcessorOpenSession) Process(ctx context.Context, seq }(tickerCtx, cancel) } - result := IClientRPCServiceOpenSessionResult{} - var retval *TSOpenSessionResp - if retval, err2 = p.handler.OpenSession(ctx, args.Req); err2 != nil { + result := IClientRPCServiceCancelOperationResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.CancelOperation(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing openSession: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "openSession", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing cancelOperation: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "cancelOperation", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21136,7 +22661,7 @@ func (p *iClientRPCServiceProcessorOpenSession) Process(ctx context.Context, seq result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "openSession", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "cancelOperation", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21154,17 +22679,17 @@ func (p *iClientRPCServiceProcessorOpenSession) Process(ctx context.Context, seq return true, err } -type iClientRPCServiceProcessorCloseSession struct { +type iClientRPCServiceProcessorCloseOperation struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCloseSession) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCloseSessionArgs{} +func (p *iClientRPCServiceProcessorCloseOperation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCloseOperationArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "closeSession", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "closeOperation", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21198,15 +22723,15 @@ func (p *iClientRPCServiceProcessorCloseSession) Process(ctx context.Context, se }(tickerCtx, cancel) } - result := IClientRPCServiceCloseSessionResult{} + result := IClientRPCServiceCloseOperationResult{} var retval *common.TSStatus - if retval, err2 = p.handler.CloseSession(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.CloseOperation(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing closeSession: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "closeSession", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing closeOperation: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "closeOperation", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21215,7 +22740,7 @@ func (p *iClientRPCServiceProcessorCloseSession) Process(ctx context.Context, se result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "closeSession", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "closeOperation", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21233,17 +22758,17 @@ func (p *iClientRPCServiceProcessorCloseSession) Process(ctx context.Context, se return true, err } -type iClientRPCServiceProcessorExecuteStatement struct { +type iClientRPCServiceProcessorPrepareStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteStatementArgs{} +func (p *iClientRPCServiceProcessorPrepareStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServicePrepareStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeStatement", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "prepareStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21277,15 +22802,15 @@ func (p *iClientRPCServiceProcessorExecuteStatement) Process(ctx context.Context }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteStatementResult{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteStatement(ctx, args.Req); err2 != nil { + result := IClientRPCServicePrepareStatementResult{} + var retval *TSPrepareResp + if retval, err2 = p.handler.PrepareStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeStatement: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeStatement", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing prepareStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "prepareStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21294,7 +22819,7 @@ func (p *iClientRPCServiceProcessorExecuteStatement) Process(ctx context.Context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeStatement", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "prepareStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21312,17 +22837,17 @@ func (p *iClientRPCServiceProcessorExecuteStatement) Process(ctx context.Context return true, err } -type iClientRPCServiceProcessorExecuteBatchStatement struct { +type iClientRPCServiceProcessorExecutePreparedStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteBatchStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteBatchStatementArgs{} +func (p *iClientRPCServiceProcessorExecutePreparedStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecutePreparedStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeBatchStatement", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executePreparedStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21356,15 +22881,15 @@ func (p *iClientRPCServiceProcessorExecuteBatchStatement) Process(ctx context.Co }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteBatchStatementResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.ExecuteBatchStatement(ctx, args.Req); err2 != nil { + result := IClientRPCServiceExecutePreparedStatementResult{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecutePreparedStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeBatchStatement: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeBatchStatement", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executePreparedStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executePreparedStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21373,7 +22898,7 @@ func (p *iClientRPCServiceProcessorExecuteBatchStatement) Process(ctx context.Co result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeBatchStatement", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executePreparedStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21391,17 +22916,17 @@ func (p *iClientRPCServiceProcessorExecuteBatchStatement) Process(ctx context.Co return true, err } -type iClientRPCServiceProcessorExecuteQueryStatement struct { +type iClientRPCServiceProcessorDeallocatePreparedStatement struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteQueryStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteQueryStatementArgs{} +func (p *iClientRPCServiceProcessorDeallocatePreparedStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceDeallocatePreparedStatementArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeQueryStatement", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "deallocatePreparedStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21435,15 +22960,15 @@ func (p *iClientRPCServiceProcessorExecuteQueryStatement) Process(ctx context.Co }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteQueryStatementResult{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteQueryStatement(ctx, args.Req); err2 != nil { + result := IClientRPCServiceDeallocatePreparedStatementResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.DeallocatePreparedStatement(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeQueryStatement: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeQueryStatement", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deallocatePreparedStatement: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "deallocatePreparedStatement", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21452,7 +22977,7 @@ func (p *iClientRPCServiceProcessorExecuteQueryStatement) Process(ctx context.Co result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeQueryStatement", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "deallocatePreparedStatement", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21470,17 +22995,17 @@ func (p *iClientRPCServiceProcessorExecuteQueryStatement) Process(ctx context.Co return true, err } -type iClientRPCServiceProcessorExecuteUpdateStatement struct { +type iClientRPCServiceProcessorGetTimeZone struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteUpdateStatement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteUpdateStatementArgs{} +func (p *iClientRPCServiceProcessorGetTimeZone) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceGetTimeZoneArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeUpdateStatement", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "getTimeZone", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21514,15 +23039,15 @@ func (p *iClientRPCServiceProcessorExecuteUpdateStatement) Process(ctx context.C }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteUpdateStatementResult{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteUpdateStatement(ctx, args.Req); err2 != nil { + result := IClientRPCServiceGetTimeZoneResult{} + var retval *TSGetTimeZoneResp + if retval, err2 = p.handler.GetTimeZone(ctx, args.SessionId); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeUpdateStatement: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeUpdateStatement", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTimeZone: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "getTimeZone", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21531,7 +23056,7 @@ func (p *iClientRPCServiceProcessorExecuteUpdateStatement) Process(ctx context.C result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeUpdateStatement", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "getTimeZone", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21549,17 +23074,17 @@ func (p *iClientRPCServiceProcessorExecuteUpdateStatement) Process(ctx context.C return true, err } -type iClientRPCServiceProcessorFetchResults struct { +type iClientRPCServiceProcessorSetTimeZone struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorFetchResults) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceFetchResultsArgs{} +func (p *iClientRPCServiceProcessorSetTimeZone) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceSetTimeZoneArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchResults", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "setTimeZone", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21593,15 +23118,15 @@ func (p *iClientRPCServiceProcessorFetchResults) Process(ctx context.Context, se }(tickerCtx, cancel) } - result := IClientRPCServiceFetchResultsResult{} - var retval *TSFetchResultsResp - if retval, err2 = p.handler.FetchResults(ctx, args.Req); err2 != nil { + result := IClientRPCServiceSetTimeZoneResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.SetTimeZone(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchResults: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchResults", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setTimeZone: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "setTimeZone", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21610,7 +23135,7 @@ func (p *iClientRPCServiceProcessorFetchResults) Process(ctx context.Context, se result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "fetchResults", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "setTimeZone", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21628,17 +23153,17 @@ func (p *iClientRPCServiceProcessorFetchResults) Process(ctx context.Context, se return true, err } -type iClientRPCServiceProcessorFetchMetadata struct { +type iClientRPCServiceProcessorGetProperties struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorFetchMetadata) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceFetchMetadataArgs{} +func (p *iClientRPCServiceProcessorGetProperties) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceGetPropertiesArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchMetadata", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "getProperties", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21672,15 +23197,15 @@ func (p *iClientRPCServiceProcessorFetchMetadata) Process(ctx context.Context, s }(tickerCtx, cancel) } - result := IClientRPCServiceFetchMetadataResult{} - var retval *TSFetchMetadataResp - if retval, err2 = p.handler.FetchMetadata(ctx, args.Req); err2 != nil { + result := IClientRPCServiceGetPropertiesResult{} + var retval *ServerProperties + if retval, err2 = p.handler.GetProperties(ctx); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchMetadata: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchMetadata", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getProperties: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "getProperties", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21689,7 +23214,7 @@ func (p *iClientRPCServiceProcessorFetchMetadata) Process(ctx context.Context, s result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "fetchMetadata", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "getProperties", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21707,17 +23232,17 @@ func (p *iClientRPCServiceProcessorFetchMetadata) Process(ctx context.Context, s return true, err } -type iClientRPCServiceProcessorCancelOperation struct { +type iClientRPCServiceProcessorSetStorageGroup struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCancelOperation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCancelOperationArgs{} +func (p *iClientRPCServiceProcessorSetStorageGroup) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceSetStorageGroupArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "cancelOperation", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21751,15 +23276,15 @@ func (p *iClientRPCServiceProcessorCancelOperation) Process(ctx context.Context, }(tickerCtx, cancel) } - result := IClientRPCServiceCancelOperationResult{} + result := IClientRPCServiceSetStorageGroupResult{} var retval *common.TSStatus - if retval, err2 = p.handler.CancelOperation(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.SetStorageGroup(ctx, args.SessionId, args.StorageGroup); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing cancelOperation: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "cancelOperation", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setStorageGroup: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21768,7 +23293,7 @@ func (p *iClientRPCServiceProcessorCancelOperation) Process(ctx context.Context, result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "cancelOperation", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21786,17 +23311,17 @@ func (p *iClientRPCServiceProcessorCancelOperation) Process(ctx context.Context, return true, err } -type iClientRPCServiceProcessorCloseOperation struct { +type iClientRPCServiceProcessorCreateTimeseries struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCloseOperation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCloseOperationArgs{} +func (p *iClientRPCServiceProcessorCreateTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCreateTimeseriesArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "closeOperation", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21830,15 +23355,15 @@ func (p *iClientRPCServiceProcessorCloseOperation) Process(ctx context.Context, }(tickerCtx, cancel) } - result := IClientRPCServiceCloseOperationResult{} + result := IClientRPCServiceCreateTimeseriesResult{} var retval *common.TSStatus - if retval, err2 = p.handler.CloseOperation(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.CreateTimeseries(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing closeOperation: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "closeOperation", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createTimeseries: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21847,7 +23372,7 @@ func (p *iClientRPCServiceProcessorCloseOperation) Process(ctx context.Context, result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "closeOperation", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21865,17 +23390,17 @@ func (p *iClientRPCServiceProcessorCloseOperation) Process(ctx context.Context, return true, err } -type iClientRPCServiceProcessorGetTimeZone struct { +type iClientRPCServiceProcessorCreateAlignedTimeseries struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorGetTimeZone) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceGetTimeZoneArgs{} +func (p *iClientRPCServiceProcessorCreateAlignedTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCreateAlignedTimeseriesArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "getTimeZone", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "createAlignedTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21909,15 +23434,15 @@ func (p *iClientRPCServiceProcessorGetTimeZone) Process(ctx context.Context, seq }(tickerCtx, cancel) } - result := IClientRPCServiceGetTimeZoneResult{} - var retval *TSGetTimeZoneResp - if retval, err2 = p.handler.GetTimeZone(ctx, args.SessionId); err2 != nil { + result := IClientRPCServiceCreateAlignedTimeseriesResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.CreateAlignedTimeseries(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTimeZone: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "getTimeZone", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createAlignedTimeseries: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "createAlignedTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21926,7 +23451,7 @@ func (p *iClientRPCServiceProcessorGetTimeZone) Process(ctx context.Context, seq result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "getTimeZone", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "createAlignedTimeseries", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -21944,17 +23469,17 @@ func (p *iClientRPCServiceProcessorGetTimeZone) Process(ctx context.Context, seq return true, err } -type iClientRPCServiceProcessorSetTimeZone struct { +type iClientRPCServiceProcessorCreateMultiTimeseries struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorSetTimeZone) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceSetTimeZoneArgs{} +func (p *iClientRPCServiceProcessorCreateMultiTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCreateMultiTimeseriesArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "setTimeZone", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "createMultiTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -21988,15 +23513,15 @@ func (p *iClientRPCServiceProcessorSetTimeZone) Process(ctx context.Context, seq }(tickerCtx, cancel) } - result := IClientRPCServiceSetTimeZoneResult{} + result := IClientRPCServiceCreateMultiTimeseriesResult{} var retval *common.TSStatus - if retval, err2 = p.handler.SetTimeZone(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.CreateMultiTimeseries(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setTimeZone: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "setTimeZone", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createMultiTimeseries: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "createMultiTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22005,7 +23530,7 @@ func (p *iClientRPCServiceProcessorSetTimeZone) Process(ctx context.Context, seq result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "setTimeZone", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "createMultiTimeseries", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22023,17 +23548,17 @@ func (p *iClientRPCServiceProcessorSetTimeZone) Process(ctx context.Context, seq return true, err } -type iClientRPCServiceProcessorGetProperties struct { +type iClientRPCServiceProcessorDeleteTimeseries struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorGetProperties) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceGetPropertiesArgs{} +func (p *iClientRPCServiceProcessorDeleteTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceDeleteTimeseriesArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "getProperties", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "deleteTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22067,15 +23592,15 @@ func (p *iClientRPCServiceProcessorGetProperties) Process(ctx context.Context, s }(tickerCtx, cancel) } - result := IClientRPCServiceGetPropertiesResult{} - var retval *ServerProperties - if retval, err2 = p.handler.GetProperties(ctx); err2 != nil { + result := IClientRPCServiceDeleteTimeseriesResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.DeleteTimeseries(ctx, args.SessionId, args.Path); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getProperties: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "getProperties", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteTimeseries: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "deleteTimeseries", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22084,7 +23609,7 @@ func (p *iClientRPCServiceProcessorGetProperties) Process(ctx context.Context, s result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "getProperties", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "deleteTimeseries", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22102,17 +23627,17 @@ func (p *iClientRPCServiceProcessorGetProperties) Process(ctx context.Context, s return true, err } -type iClientRPCServiceProcessorSetStorageGroup struct { +type iClientRPCServiceProcessorDeleteStorageGroups struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorSetStorageGroup) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceSetStorageGroupArgs{} +func (p *iClientRPCServiceProcessorDeleteStorageGroups) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceDeleteStorageGroupsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "deleteStorageGroups", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22146,15 +23671,15 @@ func (p *iClientRPCServiceProcessorSetStorageGroup) Process(ctx context.Context, }(tickerCtx, cancel) } - result := IClientRPCServiceSetStorageGroupResult{} + result := IClientRPCServiceDeleteStorageGroupsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.SetStorageGroup(ctx, args.SessionId, args.StorageGroup); err2 != nil { + if retval, err2 = p.handler.DeleteStorageGroups(ctx, args.SessionId, args.StorageGroup); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setStorageGroup: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteStorageGroups: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "deleteStorageGroups", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22163,7 +23688,7 @@ func (p *iClientRPCServiceProcessorSetStorageGroup) Process(ctx context.Context, result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "deleteStorageGroups", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22181,17 +23706,17 @@ func (p *iClientRPCServiceProcessorSetStorageGroup) Process(ctx context.Context, return true, err } -type iClientRPCServiceProcessorCreateTimeseries struct { +type iClientRPCServiceProcessorInsertRecord struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCreateTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCreateTimeseriesArgs{} +func (p *iClientRPCServiceProcessorInsertRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertRecordArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22225,15 +23750,15 @@ func (p *iClientRPCServiceProcessorCreateTimeseries) Process(ctx context.Context }(tickerCtx, cancel) } - result := IClientRPCServiceCreateTimeseriesResult{} + result := IClientRPCServiceInsertRecordResult{} var retval *common.TSStatus - if retval, err2 = p.handler.CreateTimeseries(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.InsertRecord(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createTimeseries: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecord: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22242,7 +23767,7 @@ func (p *iClientRPCServiceProcessorCreateTimeseries) Process(ctx context.Context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertRecord", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22260,17 +23785,17 @@ func (p *iClientRPCServiceProcessorCreateTimeseries) Process(ctx context.Context return true, err } -type iClientRPCServiceProcessorCreateAlignedTimeseries struct { +type iClientRPCServiceProcessorInsertStringRecord struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCreateAlignedTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCreateAlignedTimeseriesArgs{} +func (p *iClientRPCServiceProcessorInsertStringRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertStringRecordArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "createAlignedTimeseries", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertStringRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22304,15 +23829,15 @@ func (p *iClientRPCServiceProcessorCreateAlignedTimeseries) Process(ctx context. }(tickerCtx, cancel) } - result := IClientRPCServiceCreateAlignedTimeseriesResult{} + result := IClientRPCServiceInsertStringRecordResult{} var retval *common.TSStatus - if retval, err2 = p.handler.CreateAlignedTimeseries(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.InsertStringRecord(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createAlignedTimeseries: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "createAlignedTimeseries", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertStringRecord: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertStringRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22321,7 +23846,7 @@ func (p *iClientRPCServiceProcessorCreateAlignedTimeseries) Process(ctx context. result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "createAlignedTimeseries", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertStringRecord", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22339,17 +23864,17 @@ func (p *iClientRPCServiceProcessorCreateAlignedTimeseries) Process(ctx context. return true, err } -type iClientRPCServiceProcessorCreateMultiTimeseries struct { +type iClientRPCServiceProcessorInsertTablet struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCreateMultiTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCreateMultiTimeseriesArgs{} +func (p *iClientRPCServiceProcessorInsertTablet) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertTabletArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "createMultiTimeseries", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertTablet", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22383,15 +23908,15 @@ func (p *iClientRPCServiceProcessorCreateMultiTimeseries) Process(ctx context.Co }(tickerCtx, cancel) } - result := IClientRPCServiceCreateMultiTimeseriesResult{} + result := IClientRPCServiceInsertTabletResult{} var retval *common.TSStatus - if retval, err2 = p.handler.CreateMultiTimeseries(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.InsertTablet(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createMultiTimeseries: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "createMultiTimeseries", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertTablet: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertTablet", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22400,7 +23925,7 @@ func (p *iClientRPCServiceProcessorCreateMultiTimeseries) Process(ctx context.Co result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "createMultiTimeseries", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertTablet", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22418,17 +23943,17 @@ func (p *iClientRPCServiceProcessorCreateMultiTimeseries) Process(ctx context.Co return true, err } -type iClientRPCServiceProcessorDeleteTimeseries struct { +type iClientRPCServiceProcessorInsertTablets struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorDeleteTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceDeleteTimeseriesArgs{} +func (p *iClientRPCServiceProcessorInsertTablets) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertTabletsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "deleteTimeseries", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertTablets", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22462,15 +23987,15 @@ func (p *iClientRPCServiceProcessorDeleteTimeseries) Process(ctx context.Context }(tickerCtx, cancel) } - result := IClientRPCServiceDeleteTimeseriesResult{} + result := IClientRPCServiceInsertTabletsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.DeleteTimeseries(ctx, args.SessionId, args.Path); err2 != nil { + if retval, err2 = p.handler.InsertTablets(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteTimeseries: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "deleteTimeseries", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertTablets: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertTablets", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22479,7 +24004,7 @@ func (p *iClientRPCServiceProcessorDeleteTimeseries) Process(ctx context.Context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "deleteTimeseries", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertTablets", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22497,17 +24022,17 @@ func (p *iClientRPCServiceProcessorDeleteTimeseries) Process(ctx context.Context return true, err } -type iClientRPCServiceProcessorDeleteStorageGroups struct { +type iClientRPCServiceProcessorInsertRecords struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorDeleteStorageGroups) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceDeleteStorageGroupsArgs{} +func (p *iClientRPCServiceProcessorInsertRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertRecordsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "deleteStorageGroups", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22541,15 +24066,15 @@ func (p *iClientRPCServiceProcessorDeleteStorageGroups) Process(ctx context.Cont }(tickerCtx, cancel) } - result := IClientRPCServiceDeleteStorageGroupsResult{} + result := IClientRPCServiceInsertRecordsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.DeleteStorageGroups(ctx, args.SessionId, args.StorageGroup); err2 != nil { + if retval, err2 = p.handler.InsertRecords(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteStorageGroups: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "deleteStorageGroups", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecords: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22558,7 +24083,7 @@ func (p *iClientRPCServiceProcessorDeleteStorageGroups) Process(ctx context.Cont result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "deleteStorageGroups", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertRecords", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22576,17 +24101,17 @@ func (p *iClientRPCServiceProcessorDeleteStorageGroups) Process(ctx context.Cont return true, err } -type iClientRPCServiceProcessorInsertRecord struct { +type iClientRPCServiceProcessorInsertRecordsOfOneDevice struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertRecordArgs{} +func (p *iClientRPCServiceProcessorInsertRecordsOfOneDevice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertRecordsOfOneDeviceArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertRecord", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertRecordsOfOneDevice", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22620,15 +24145,15 @@ func (p *iClientRPCServiceProcessorInsertRecord) Process(ctx context.Context, se }(tickerCtx, cancel) } - result := IClientRPCServiceInsertRecordResult{} + result := IClientRPCServiceInsertRecordsOfOneDeviceResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertRecord(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.InsertRecordsOfOneDevice(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) - } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecord: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertRecord", thrift.EXCEPTION, seqId) + } + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecordsOfOneDevice: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertRecordsOfOneDevice", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22637,7 +24162,7 @@ func (p *iClientRPCServiceProcessorInsertRecord) Process(ctx context.Context, se result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertRecord", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertRecordsOfOneDevice", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22655,17 +24180,17 @@ func (p *iClientRPCServiceProcessorInsertRecord) Process(ctx context.Context, se return true, err } -type iClientRPCServiceProcessorInsertStringRecord struct { +type iClientRPCServiceProcessorInsertStringRecordsOfOneDevice struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertStringRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertStringRecordArgs{} +func (p *iClientRPCServiceProcessorInsertStringRecordsOfOneDevice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertStringRecordsOfOneDeviceArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertStringRecord", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertStringRecordsOfOneDevice", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22699,15 +24224,15 @@ func (p *iClientRPCServiceProcessorInsertStringRecord) Process(ctx context.Conte }(tickerCtx, cancel) } - result := IClientRPCServiceInsertStringRecordResult{} + result := IClientRPCServiceInsertStringRecordsOfOneDeviceResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertStringRecord(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.InsertStringRecordsOfOneDevice(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertStringRecord: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertStringRecord", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertStringRecordsOfOneDevice: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertStringRecordsOfOneDevice", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22716,7 +24241,7 @@ func (p *iClientRPCServiceProcessorInsertStringRecord) Process(ctx context.Conte result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertStringRecord", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertStringRecordsOfOneDevice", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22734,17 +24259,17 @@ func (p *iClientRPCServiceProcessorInsertStringRecord) Process(ctx context.Conte return true, err } -type iClientRPCServiceProcessorInsertTablet struct { +type iClientRPCServiceProcessorInsertStringRecords struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertTablet) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertTabletArgs{} +func (p *iClientRPCServiceProcessorInsertStringRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceInsertStringRecordsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertTablet", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "insertStringRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22778,15 +24303,15 @@ func (p *iClientRPCServiceProcessorInsertTablet) Process(ctx context.Context, se }(tickerCtx, cancel) } - result := IClientRPCServiceInsertTabletResult{} + result := IClientRPCServiceInsertStringRecordsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertTablet(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.InsertStringRecords(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertTablet: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertTablet", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertStringRecords: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "insertStringRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22795,7 +24320,7 @@ func (p *iClientRPCServiceProcessorInsertTablet) Process(ctx context.Context, se result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertTablet", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "insertStringRecords", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22813,17 +24338,17 @@ func (p *iClientRPCServiceProcessorInsertTablet) Process(ctx context.Context, se return true, err } -type iClientRPCServiceProcessorInsertTablets struct { +type iClientRPCServiceProcessorTestInsertTablet struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertTablets) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertTabletsArgs{} +func (p *iClientRPCServiceProcessorTestInsertTablet) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertTabletArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertTablets", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertTablet", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22857,15 +24382,15 @@ func (p *iClientRPCServiceProcessorInsertTablets) Process(ctx context.Context, s }(tickerCtx, cancel) } - result := IClientRPCServiceInsertTabletsResult{} + result := IClientRPCServiceTestInsertTabletResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertTablets(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertTablet(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertTablets: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertTablets", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertTablet: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertTablet", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22874,7 +24399,7 @@ func (p *iClientRPCServiceProcessorInsertTablets) Process(ctx context.Context, s result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertTablets", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertTablet", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22892,17 +24417,17 @@ func (p *iClientRPCServiceProcessorInsertTablets) Process(ctx context.Context, s return true, err } -type iClientRPCServiceProcessorInsertRecords struct { +type iClientRPCServiceProcessorTestInsertTablets struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertRecordsArgs{} +func (p *iClientRPCServiceProcessorTestInsertTablets) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertTabletsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertRecords", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertTablets", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22936,15 +24461,15 @@ func (p *iClientRPCServiceProcessorInsertRecords) Process(ctx context.Context, s }(tickerCtx, cancel) } - result := IClientRPCServiceInsertRecordsResult{} + result := IClientRPCServiceTestInsertTabletsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertRecords(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertTablets(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecords: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertRecords", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertTablets: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertTablets", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -22953,7 +24478,7 @@ func (p *iClientRPCServiceProcessorInsertRecords) Process(ctx context.Context, s result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertRecords", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertTablets", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -22971,17 +24496,17 @@ func (p *iClientRPCServiceProcessorInsertRecords) Process(ctx context.Context, s return true, err } -type iClientRPCServiceProcessorInsertRecordsOfOneDevice struct { +type iClientRPCServiceProcessorTestInsertRecord struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertRecordsOfOneDevice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertRecordsOfOneDeviceArgs{} +func (p *iClientRPCServiceProcessorTestInsertRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertRecordArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertRecordsOfOneDevice", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23015,15 +24540,15 @@ func (p *iClientRPCServiceProcessorInsertRecordsOfOneDevice) Process(ctx context }(tickerCtx, cancel) } - result := IClientRPCServiceInsertRecordsOfOneDeviceResult{} + result := IClientRPCServiceTestInsertRecordResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertRecordsOfOneDevice(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertRecord(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecordsOfOneDevice: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertRecordsOfOneDevice", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertRecord: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23032,7 +24557,7 @@ func (p *iClientRPCServiceProcessorInsertRecordsOfOneDevice) Process(ctx context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertRecordsOfOneDevice", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertRecord", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23050,17 +24575,17 @@ func (p *iClientRPCServiceProcessorInsertRecordsOfOneDevice) Process(ctx context return true, err } -type iClientRPCServiceProcessorInsertStringRecordsOfOneDevice struct { +type iClientRPCServiceProcessorTestInsertStringRecord struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertStringRecordsOfOneDevice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertStringRecordsOfOneDeviceArgs{} +func (p *iClientRPCServiceProcessorTestInsertStringRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertStringRecordArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertStringRecordsOfOneDevice", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertStringRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23094,15 +24619,15 @@ func (p *iClientRPCServiceProcessorInsertStringRecordsOfOneDevice) Process(ctx c }(tickerCtx, cancel) } - result := IClientRPCServiceInsertStringRecordsOfOneDeviceResult{} + result := IClientRPCServiceTestInsertStringRecordResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertStringRecordsOfOneDevice(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertStringRecord(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertStringRecordsOfOneDevice: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertStringRecordsOfOneDevice", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertStringRecord: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertStringRecord", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23111,7 +24636,7 @@ func (p *iClientRPCServiceProcessorInsertStringRecordsOfOneDevice) Process(ctx c result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertStringRecordsOfOneDevice", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertStringRecord", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23129,17 +24654,17 @@ func (p *iClientRPCServiceProcessorInsertStringRecordsOfOneDevice) Process(ctx c return true, err } -type iClientRPCServiceProcessorInsertStringRecords struct { +type iClientRPCServiceProcessorTestInsertRecords struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorInsertStringRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceInsertStringRecordsArgs{} +func (p *iClientRPCServiceProcessorTestInsertRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertRecordsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "insertStringRecords", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23173,15 +24698,15 @@ func (p *iClientRPCServiceProcessorInsertStringRecords) Process(ctx context.Cont }(tickerCtx, cancel) } - result := IClientRPCServiceInsertStringRecordsResult{} + result := IClientRPCServiceTestInsertRecordsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.InsertStringRecords(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertRecords(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertStringRecords: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "insertStringRecords", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertRecords: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23190,7 +24715,7 @@ func (p *iClientRPCServiceProcessorInsertStringRecords) Process(ctx context.Cont result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "insertStringRecords", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertRecords", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23208,17 +24733,17 @@ func (p *iClientRPCServiceProcessorInsertStringRecords) Process(ctx context.Cont return true, err } -type iClientRPCServiceProcessorTestInsertTablet struct { +type iClientRPCServiceProcessorTestInsertRecordsOfOneDevice struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertTablet) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertTabletArgs{} +func (p *iClientRPCServiceProcessorTestInsertRecordsOfOneDevice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertRecordsOfOneDeviceArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertTablet", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertRecordsOfOneDevice", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23252,15 +24777,15 @@ func (p *iClientRPCServiceProcessorTestInsertTablet) Process(ctx context.Context }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertTabletResult{} + result := IClientRPCServiceTestInsertRecordsOfOneDeviceResult{} var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertTablet(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertRecordsOfOneDevice(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertTablet: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertTablet", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertRecordsOfOneDevice: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertRecordsOfOneDevice", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23269,7 +24794,7 @@ func (p *iClientRPCServiceProcessorTestInsertTablet) Process(ctx context.Context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertTablet", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertRecordsOfOneDevice", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23287,17 +24812,17 @@ func (p *iClientRPCServiceProcessorTestInsertTablet) Process(ctx context.Context return true, err } -type iClientRPCServiceProcessorTestInsertTablets struct { +type iClientRPCServiceProcessorTestInsertStringRecords struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertTablets) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertTabletsArgs{} +func (p *iClientRPCServiceProcessorTestInsertStringRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestInsertStringRecordsArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertTablets", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testInsertStringRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23331,15 +24856,15 @@ func (p *iClientRPCServiceProcessorTestInsertTablets) Process(ctx context.Contex }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertTabletsResult{} + result := IClientRPCServiceTestInsertStringRecordsResult{} var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertTablets(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.TestInsertStringRecords(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertTablets: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertTablets", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertStringRecords: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testInsertStringRecords", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23348,7 +24873,7 @@ func (p *iClientRPCServiceProcessorTestInsertTablets) Process(ctx context.Contex result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertTablets", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testInsertStringRecords", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23366,17 +24891,17 @@ func (p *iClientRPCServiceProcessorTestInsertTablets) Process(ctx context.Contex return true, err } -type iClientRPCServiceProcessorTestInsertRecord struct { +type iClientRPCServiceProcessorDeleteData struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertRecordArgs{} +func (p *iClientRPCServiceProcessorDeleteData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceDeleteDataArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertRecord", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "deleteData", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23410,15 +24935,15 @@ func (p *iClientRPCServiceProcessorTestInsertRecord) Process(ctx context.Context }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertRecordResult{} + result := IClientRPCServiceDeleteDataResult{} var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertRecord(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.DeleteData(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertRecord: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertRecord", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteData: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "deleteData", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23427,7 +24952,7 @@ func (p *iClientRPCServiceProcessorTestInsertRecord) Process(ctx context.Context result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertRecord", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "deleteData", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23445,17 +24970,17 @@ func (p *iClientRPCServiceProcessorTestInsertRecord) Process(ctx context.Context return true, err } -type iClientRPCServiceProcessorTestInsertStringRecord struct { +type iClientRPCServiceProcessorExecuteRawDataQuery struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertStringRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertStringRecordArgs{} +func (p *iClientRPCServiceProcessorExecuteRawDataQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteRawDataQueryArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertStringRecord", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeRawDataQuery", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23489,15 +25014,15 @@ func (p *iClientRPCServiceProcessorTestInsertStringRecord) Process(ctx context.C }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertStringRecordResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertStringRecord(ctx, args.Req); err2 != nil { + result := IClientRPCServiceExecuteRawDataQueryResult{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteRawDataQuery(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertStringRecord: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertStringRecord", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeRawDataQuery: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeRawDataQuery", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23506,7 +25031,7 @@ func (p *iClientRPCServiceProcessorTestInsertStringRecord) Process(ctx context.C result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertStringRecord", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeRawDataQuery", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23524,17 +25049,17 @@ func (p *iClientRPCServiceProcessorTestInsertStringRecord) Process(ctx context.C return true, err } -type iClientRPCServiceProcessorTestInsertRecords struct { +type iClientRPCServiceProcessorExecuteLastDataQuery struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertRecordsArgs{} +func (p *iClientRPCServiceProcessorExecuteLastDataQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteLastDataQueryArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertRecords", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeLastDataQuery", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23568,15 +25093,15 @@ func (p *iClientRPCServiceProcessorTestInsertRecords) Process(ctx context.Contex }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertRecordsResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertRecords(ctx, args.Req); err2 != nil { + result := IClientRPCServiceExecuteLastDataQueryResult{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteLastDataQuery(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertRecords: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertRecords", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeLastDataQuery: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeLastDataQuery", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23585,7 +25110,7 @@ func (p *iClientRPCServiceProcessorTestInsertRecords) Process(ctx context.Contex result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertRecords", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeLastDataQuery", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23603,17 +25128,17 @@ func (p *iClientRPCServiceProcessorTestInsertRecords) Process(ctx context.Contex return true, err } -type iClientRPCServiceProcessorTestInsertRecordsOfOneDevice struct { +type iClientRPCServiceProcessorExecuteAggregationQuery struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertRecordsOfOneDevice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertRecordsOfOneDeviceArgs{} +func (p *iClientRPCServiceProcessorExecuteAggregationQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceExecuteAggregationQueryArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertRecordsOfOneDevice", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "executeAggregationQuery", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23647,15 +25172,15 @@ func (p *iClientRPCServiceProcessorTestInsertRecordsOfOneDevice) Process(ctx con }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertRecordsOfOneDeviceResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertRecordsOfOneDevice(ctx, args.Req); err2 != nil { + result := IClientRPCServiceExecuteAggregationQueryResult{} + var retval *TSExecuteStatementResp + if retval, err2 = p.handler.ExecuteAggregationQuery(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertRecordsOfOneDevice: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertRecordsOfOneDevice", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeAggregationQuery: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "executeAggregationQuery", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23664,7 +25189,7 @@ func (p *iClientRPCServiceProcessorTestInsertRecordsOfOneDevice) Process(ctx con result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertRecordsOfOneDevice", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "executeAggregationQuery", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23682,17 +25207,17 @@ func (p *iClientRPCServiceProcessorTestInsertRecordsOfOneDevice) Process(ctx con return true, err } -type iClientRPCServiceProcessorTestInsertStringRecords struct { +type iClientRPCServiceProcessorRequestStatementId struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorTestInsertStringRecords) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestInsertStringRecordsArgs{} +func (p *iClientRPCServiceProcessorRequestStatementId) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceRequestStatementIdArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertStringRecords", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "requestStatementId", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23726,24 +25251,24 @@ func (p *iClientRPCServiceProcessorTestInsertStringRecords) Process(ctx context. }(tickerCtx, cancel) } - result := IClientRPCServiceTestInsertStringRecordsResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.TestInsertStringRecords(ctx, args.Req); err2 != nil { + result := IClientRPCServiceRequestStatementIdResult{} + var retval int64 + if retval, err2 = p.handler.RequestStatementId(ctx, args.SessionId); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testInsertStringRecords: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testInsertStringRecords", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing requestStatementId: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "requestStatementId", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) return true, thrift.WrapTException(err2) } else { - result.Success = retval + result.Success = &retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testInsertStringRecords", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "requestStatementId", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23761,17 +25286,17 @@ func (p *iClientRPCServiceProcessorTestInsertStringRecords) Process(ctx context. return true, err } -type iClientRPCServiceProcessorDeleteData struct { +type iClientRPCServiceProcessorCreateSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorDeleteData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceDeleteDataArgs{} +func (p *iClientRPCServiceProcessorCreateSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCreateSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "deleteData", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "createSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23805,15 +25330,15 @@ func (p *iClientRPCServiceProcessorDeleteData) Process(ctx context.Context, seqI }(tickerCtx, cancel) } - result := IClientRPCServiceDeleteDataResult{} + result := IClientRPCServiceCreateSchemaTemplateResult{} var retval *common.TSStatus - if retval, err2 = p.handler.DeleteData(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.CreateSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteData: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "deleteData", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "createSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23822,7 +25347,7 @@ func (p *iClientRPCServiceProcessorDeleteData) Process(ctx context.Context, seqI result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "deleteData", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "createSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23840,17 +25365,17 @@ func (p *iClientRPCServiceProcessorDeleteData) Process(ctx context.Context, seqI return true, err } -type iClientRPCServiceProcessorExecuteRawDataQuery struct { +type iClientRPCServiceProcessorAppendSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteRawDataQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteRawDataQueryArgs{} +func (p *iClientRPCServiceProcessorAppendSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceAppendSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeRawDataQuery", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "appendSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23884,15 +25409,15 @@ func (p *iClientRPCServiceProcessorExecuteRawDataQuery) Process(ctx context.Cont }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteRawDataQueryResult{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteRawDataQuery(ctx, args.Req); err2 != nil { + result := IClientRPCServiceAppendSchemaTemplateResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.AppendSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeRawDataQuery: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeRawDataQuery", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing appendSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "appendSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23901,7 +25426,7 @@ func (p *iClientRPCServiceProcessorExecuteRawDataQuery) Process(ctx context.Cont result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeRawDataQuery", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "appendSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23919,17 +25444,17 @@ func (p *iClientRPCServiceProcessorExecuteRawDataQuery) Process(ctx context.Cont return true, err } -type iClientRPCServiceProcessorExecuteLastDataQuery struct { +type iClientRPCServiceProcessorPruneSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteLastDataQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteLastDataQueryArgs{} +func (p *iClientRPCServiceProcessorPruneSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServicePruneSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeLastDataQuery", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "pruneSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23963,15 +25488,15 @@ func (p *iClientRPCServiceProcessorExecuteLastDataQuery) Process(ctx context.Con }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteLastDataQueryResult{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteLastDataQuery(ctx, args.Req); err2 != nil { + result := IClientRPCServicePruneSchemaTemplateResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.PruneSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeLastDataQuery: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeLastDataQuery", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pruneSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "pruneSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -23980,7 +25505,7 @@ func (p *iClientRPCServiceProcessorExecuteLastDataQuery) Process(ctx context.Con result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeLastDataQuery", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "pruneSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -23998,17 +25523,17 @@ func (p *iClientRPCServiceProcessorExecuteLastDataQuery) Process(ctx context.Con return true, err } -type iClientRPCServiceProcessorExecuteAggregationQuery struct { +type iClientRPCServiceProcessorQuerySchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorExecuteAggregationQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceExecuteAggregationQueryArgs{} +func (p *iClientRPCServiceProcessorQuerySchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceQuerySchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "executeAggregationQuery", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "querySchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24042,15 +25567,15 @@ func (p *iClientRPCServiceProcessorExecuteAggregationQuery) Process(ctx context. }(tickerCtx, cancel) } - result := IClientRPCServiceExecuteAggregationQueryResult{} - var retval *TSExecuteStatementResp - if retval, err2 = p.handler.ExecuteAggregationQuery(ctx, args.Req); err2 != nil { + result := IClientRPCServiceQuerySchemaTemplateResult{} + var retval *TSQueryTemplateResp + if retval, err2 = p.handler.QuerySchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeAggregationQuery: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "executeAggregationQuery", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing querySchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "querySchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24059,7 +25584,7 @@ func (p *iClientRPCServiceProcessorExecuteAggregationQuery) Process(ctx context. result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "executeAggregationQuery", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "querySchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24077,17 +25602,17 @@ func (p *iClientRPCServiceProcessorExecuteAggregationQuery) Process(ctx context. return true, err } -type iClientRPCServiceProcessorRequestStatementId struct { +type iClientRPCServiceProcessorShowConfigurationTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorRequestStatementId) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceRequestStatementIdArgs{} +func (p *iClientRPCServiceProcessorShowConfigurationTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceShowConfigurationTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "requestStatementId", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "showConfigurationTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24121,24 +25646,24 @@ func (p *iClientRPCServiceProcessorRequestStatementId) Process(ctx context.Conte }(tickerCtx, cancel) } - result := IClientRPCServiceRequestStatementIdResult{} - var retval int64 - if retval, err2 = p.handler.RequestStatementId(ctx, args.SessionId); err2 != nil { + result := IClientRPCServiceShowConfigurationTemplateResult{} + var retval *common.TShowConfigurationTemplateResp + if retval, err2 = p.handler.ShowConfigurationTemplate(ctx); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing requestStatementId: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "requestStatementId", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing showConfigurationTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "showConfigurationTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) return true, thrift.WrapTException(err2) } else { - result.Success = &retval + result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "requestStatementId", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "showConfigurationTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24156,17 +25681,17 @@ func (p *iClientRPCServiceProcessorRequestStatementId) Process(ctx context.Conte return true, err } -type iClientRPCServiceProcessorCreateSchemaTemplate struct { +type iClientRPCServiceProcessorShowConfiguration struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCreateSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCreateSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorShowConfiguration) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceShowConfigurationArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "createSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "showConfiguration", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24200,15 +25725,15 @@ func (p *iClientRPCServiceProcessorCreateSchemaTemplate) Process(ctx context.Con }(tickerCtx, cancel) } - result := IClientRPCServiceCreateSchemaTemplateResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.CreateSchemaTemplate(ctx, args.Req); err2 != nil { + result := IClientRPCServiceShowConfigurationResult{} + var retval *common.TShowConfigurationResp + if retval, err2 = p.handler.ShowConfiguration(ctx, args.NodeId); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "createSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing showConfiguration: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "showConfiguration", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24217,7 +25742,7 @@ func (p *iClientRPCServiceProcessorCreateSchemaTemplate) Process(ctx context.Con result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "createSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "showConfiguration", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24235,17 +25760,17 @@ func (p *iClientRPCServiceProcessorCreateSchemaTemplate) Process(ctx context.Con return true, err } -type iClientRPCServiceProcessorAppendSchemaTemplate struct { +type iClientRPCServiceProcessorSetSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorAppendSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceAppendSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorSetSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceSetSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "appendSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "setSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24279,15 +25804,15 @@ func (p *iClientRPCServiceProcessorAppendSchemaTemplate) Process(ctx context.Con }(tickerCtx, cancel) } - result := IClientRPCServiceAppendSchemaTemplateResult{} + result := IClientRPCServiceSetSchemaTemplateResult{} var retval *common.TSStatus - if retval, err2 = p.handler.AppendSchemaTemplate(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.SetSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing appendSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "appendSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "setSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24296,7 +25821,7 @@ func (p *iClientRPCServiceProcessorAppendSchemaTemplate) Process(ctx context.Con result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "appendSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "setSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24314,17 +25839,17 @@ func (p *iClientRPCServiceProcessorAppendSchemaTemplate) Process(ctx context.Con return true, err } -type iClientRPCServiceProcessorPruneSchemaTemplate struct { +type iClientRPCServiceProcessorUnsetSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorPruneSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServicePruneSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorUnsetSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceUnsetSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "pruneSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "unsetSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24358,15 +25883,15 @@ func (p *iClientRPCServiceProcessorPruneSchemaTemplate) Process(ctx context.Cont }(tickerCtx, cancel) } - result := IClientRPCServicePruneSchemaTemplateResult{} + result := IClientRPCServiceUnsetSchemaTemplateResult{} var retval *common.TSStatus - if retval, err2 = p.handler.PruneSchemaTemplate(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.UnsetSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pruneSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "pruneSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing unsetSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "unsetSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24375,7 +25900,7 @@ func (p *iClientRPCServiceProcessorPruneSchemaTemplate) Process(ctx context.Cont result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "pruneSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "unsetSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24393,17 +25918,17 @@ func (p *iClientRPCServiceProcessorPruneSchemaTemplate) Process(ctx context.Cont return true, err } -type iClientRPCServiceProcessorQuerySchemaTemplate struct { +type iClientRPCServiceProcessorDropSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorQuerySchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceQuerySchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorDropSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceDropSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "querySchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "dropSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24437,15 +25962,15 @@ func (p *iClientRPCServiceProcessorQuerySchemaTemplate) Process(ctx context.Cont }(tickerCtx, cancel) } - result := IClientRPCServiceQuerySchemaTemplateResult{} - var retval *TSQueryTemplateResp - if retval, err2 = p.handler.QuerySchemaTemplate(ctx, args.Req); err2 != nil { + result := IClientRPCServiceDropSchemaTemplateResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.DropSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing querySchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "querySchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing dropSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "dropSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24454,7 +25979,7 @@ func (p *iClientRPCServiceProcessorQuerySchemaTemplate) Process(ctx context.Cont result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "querySchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "dropSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24472,17 +25997,17 @@ func (p *iClientRPCServiceProcessorQuerySchemaTemplate) Process(ctx context.Cont return true, err } -type iClientRPCServiceProcessorShowConfigurationTemplate struct { +type iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorShowConfigurationTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceShowConfigurationTemplateArgs{} +func (p *iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceCreateTimeseriesUsingSchemaTemplateArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "showConfigurationTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "createTimeseriesUsingSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24516,15 +26041,15 @@ func (p *iClientRPCServiceProcessorShowConfigurationTemplate) Process(ctx contex }(tickerCtx, cancel) } - result := IClientRPCServiceShowConfigurationTemplateResult{} - var retval *common.TShowConfigurationTemplateResp - if retval, err2 = p.handler.ShowConfigurationTemplate(ctx); err2 != nil { + result := IClientRPCServiceCreateTimeseriesUsingSchemaTemplateResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.CreateTimeseriesUsingSchemaTemplate(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing showConfigurationTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "showConfigurationTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createTimeseriesUsingSchemaTemplate: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "createTimeseriesUsingSchemaTemplate", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24533,7 +26058,7 @@ func (p *iClientRPCServiceProcessorShowConfigurationTemplate) Process(ctx contex result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "showConfigurationTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "createTimeseriesUsingSchemaTemplate", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24551,17 +26076,17 @@ func (p *iClientRPCServiceProcessorShowConfigurationTemplate) Process(ctx contex return true, err } -type iClientRPCServiceProcessorShowConfiguration struct { +type iClientRPCServiceProcessorHandshake struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorShowConfiguration) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceShowConfigurationArgs{} +func (p *iClientRPCServiceProcessorHandshake) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceHandshakeArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "showConfiguration", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "handshake", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24595,15 +26120,15 @@ func (p *iClientRPCServiceProcessorShowConfiguration) Process(ctx context.Contex }(tickerCtx, cancel) } - result := IClientRPCServiceShowConfigurationResult{} - var retval *common.TShowConfigurationResp - if retval, err2 = p.handler.ShowConfiguration(ctx, args.NodeId); err2 != nil { + result := IClientRPCServiceHandshakeResult{} + var retval *common.TSStatus + if retval, err2 = p.handler.Handshake(ctx, args.Info); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing showConfiguration: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "showConfiguration", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing handshake: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "handshake", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24612,7 +26137,7 @@ func (p *iClientRPCServiceProcessorShowConfiguration) Process(ctx context.Contex result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "showConfiguration", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "handshake", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24630,17 +26155,17 @@ func (p *iClientRPCServiceProcessorShowConfiguration) Process(ctx context.Contex return true, err } -type iClientRPCServiceProcessorSetSchemaTemplate struct { +type iClientRPCServiceProcessorSendPipeData struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorSetSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceSetSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorSendPipeData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceSendPipeDataArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "setSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "sendPipeData", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24674,15 +26199,15 @@ func (p *iClientRPCServiceProcessorSetSchemaTemplate) Process(ctx context.Contex }(tickerCtx, cancel) } - result := IClientRPCServiceSetSchemaTemplateResult{} + result := IClientRPCServiceSendPipeDataResult{} var retval *common.TSStatus - if retval, err2 = p.handler.SetSchemaTemplate(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.SendPipeData(ctx, args.Buff); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "setSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing sendPipeData: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "sendPipeData", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24691,7 +26216,7 @@ func (p *iClientRPCServiceProcessorSetSchemaTemplate) Process(ctx context.Contex result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "setSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "sendPipeData", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24709,17 +26234,17 @@ func (p *iClientRPCServiceProcessorSetSchemaTemplate) Process(ctx context.Contex return true, err } -type iClientRPCServiceProcessorUnsetSchemaTemplate struct { +type iClientRPCServiceProcessorSendFile struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorUnsetSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceUnsetSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorSendFile) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceSendFileArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "unsetSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "sendFile", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24753,15 +26278,15 @@ func (p *iClientRPCServiceProcessorUnsetSchemaTemplate) Process(ctx context.Cont }(tickerCtx, cancel) } - result := IClientRPCServiceUnsetSchemaTemplateResult{} + result := IClientRPCServiceSendFileResult{} var retval *common.TSStatus - if retval, err2 = p.handler.UnsetSchemaTemplate(ctx, args.Req); err2 != nil { + if retval, err2 = p.handler.SendFile(ctx, args.MetaInfo, args.Buff); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing unsetSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "unsetSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing sendFile: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "sendFile", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24770,7 +26295,7 @@ func (p *iClientRPCServiceProcessorUnsetSchemaTemplate) Process(ctx context.Cont result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "unsetSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "sendFile", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24788,17 +26313,17 @@ func (p *iClientRPCServiceProcessorUnsetSchemaTemplate) Process(ctx context.Cont return true, err } -type iClientRPCServiceProcessorDropSchemaTemplate struct { +type iClientRPCServiceProcessorPipeTransfer struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorDropSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceDropSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorPipeTransfer) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServicePipeTransferArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "dropSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "pipeTransfer", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24832,15 +26357,15 @@ func (p *iClientRPCServiceProcessorDropSchemaTemplate) Process(ctx context.Conte }(tickerCtx, cancel) } - result := IClientRPCServiceDropSchemaTemplateResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.DropSchemaTemplate(ctx, args.Req); err2 != nil { + result := IClientRPCServicePipeTransferResult{} + var retval *TPipeTransferResp + if retval, err2 = p.handler.PipeTransfer(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing dropSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "dropSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pipeTransfer: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "pipeTransfer", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24849,7 +26374,7 @@ func (p *iClientRPCServiceProcessorDropSchemaTemplate) Process(ctx context.Conte result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "dropSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "pipeTransfer", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24867,17 +26392,17 @@ func (p *iClientRPCServiceProcessorDropSchemaTemplate) Process(ctx context.Conte return true, err } -type iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate struct { +type iClientRPCServiceProcessorPipeSubscribe struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceCreateTimeseriesUsingSchemaTemplateArgs{} +func (p *iClientRPCServiceProcessorPipeSubscribe) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServicePipeSubscribeArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "createTimeseriesUsingSchemaTemplate", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "pipeSubscribe", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24911,15 +26436,15 @@ func (p *iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate) Process( }(tickerCtx, cancel) } - result := IClientRPCServiceCreateTimeseriesUsingSchemaTemplateResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.CreateTimeseriesUsingSchemaTemplate(ctx, args.Req); err2 != nil { + result := IClientRPCServicePipeSubscribeResult{} + var retval *TPipeSubscribeResp + if retval, err2 = p.handler.PipeSubscribe(ctx, args.Req); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createTimeseriesUsingSchemaTemplate: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "createTimeseriesUsingSchemaTemplate", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pipeSubscribe: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "pipeSubscribe", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24928,7 +26453,7 @@ func (p *iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate) Process( result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "createTimeseriesUsingSchemaTemplate", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "pipeSubscribe", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -24946,17 +26471,17 @@ func (p *iClientRPCServiceProcessorCreateTimeseriesUsingSchemaTemplate) Process( return true, err } -type iClientRPCServiceProcessorHandshake struct { +type iClientRPCServiceProcessorGetBackupConfiguration struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorHandshake) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceHandshakeArgs{} +func (p *iClientRPCServiceProcessorGetBackupConfiguration) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceGetBackupConfigurationArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "handshake", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "getBackupConfiguration", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -24990,15 +26515,15 @@ func (p *iClientRPCServiceProcessorHandshake) Process(ctx context.Context, seqId }(tickerCtx, cancel) } - result := IClientRPCServiceHandshakeResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.Handshake(ctx, args.Info); err2 != nil { + result := IClientRPCServiceGetBackupConfigurationResult{} + var retval *TSBackupConfigurationResp + if retval, err2 = p.handler.GetBackupConfiguration(ctx); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing handshake: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "handshake", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getBackupConfiguration: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "getBackupConfiguration", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -25007,7 +26532,7 @@ func (p *iClientRPCServiceProcessorHandshake) Process(ctx context.Context, seqId result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "handshake", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "getBackupConfiguration", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -25025,17 +26550,17 @@ func (p *iClientRPCServiceProcessorHandshake) Process(ctx context.Context, seqId return true, err } -type iClientRPCServiceProcessorSendPipeData struct { +type iClientRPCServiceProcessorFetchAllConnectionsInfo struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorSendPipeData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceSendPipeDataArgs{} +func (p *iClientRPCServiceProcessorFetchAllConnectionsInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceFetchAllConnectionsInfoArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "sendPipeData", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "fetchAllConnectionsInfo", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -25069,15 +26594,15 @@ func (p *iClientRPCServiceProcessorSendPipeData) Process(ctx context.Context, se }(tickerCtx, cancel) } - result := IClientRPCServiceSendPipeDataResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.SendPipeData(ctx, args.Buff); err2 != nil { + result := IClientRPCServiceFetchAllConnectionsInfoResult{} + var retval *TSConnectionInfoResp + if retval, err2 = p.handler.FetchAllConnectionsInfo(ctx); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing sendPipeData: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "sendPipeData", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchAllConnectionsInfo: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "fetchAllConnectionsInfo", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -25086,7 +26611,7 @@ func (p *iClientRPCServiceProcessorSendPipeData) Process(ctx context.Context, se result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "sendPipeData", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "fetchAllConnectionsInfo", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -25104,17 +26629,17 @@ func (p *iClientRPCServiceProcessorSendPipeData) Process(ctx context.Context, se return true, err } -type iClientRPCServiceProcessorSendFile struct { +type iClientRPCServiceProcessorTestConnectionEmptyRPC struct { handler IClientRPCService } -func (p *iClientRPCServiceProcessorSendFile) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceSendFileArgs{} +func (p *iClientRPCServiceProcessorTestConnectionEmptyRPC) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := IClientRPCServiceTestConnectionEmptyRPCArgs{} var err2 error if err2 = args.Read(ctx, iprot); err2 != nil { iprot.ReadMessageEnd(ctx) x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "sendFile", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin(ctx, "testConnectionEmptyRPC", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -25148,15 +26673,15 @@ func (p *iClientRPCServiceProcessorSendFile) Process(ctx context.Context, seqId }(tickerCtx, cancel) } - result := IClientRPCServiceSendFileResult{} + result := IClientRPCServiceTestConnectionEmptyRPCResult{} var retval *common.TSStatus - if retval, err2 = p.handler.SendFile(ctx, args.MetaInfo, args.Buff); err2 != nil { + if retval, err2 = p.handler.TestConnectionEmptyRPC(ctx); err2 != nil { tickerCancel() if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing sendFile: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "sendFile", thrift.EXCEPTION, seqId) + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testConnectionEmptyRPC: " + err2.Error()) + oprot.WriteMessageBegin(ctx, "testConnectionEmptyRPC", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) @@ -25165,7 +26690,7 @@ func (p *iClientRPCServiceProcessorSendFile) Process(ctx context.Context, seqId result.Success = retval } tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "sendFile", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin(ctx, "testConnectionEmptyRPC", thrift.REPLY, seqId); err2 != nil { err = thrift.WrapTException(err2) } if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { @@ -25183,426 +26708,625 @@ func (p *iClientRPCServiceProcessorSendFile) Process(ctx context.Context, seqId return true, err } -type iClientRPCServiceProcessorPipeTransfer struct { - handler IClientRPCService + +// HELPER FUNCTIONS AND STRUCTURES + +// Attributes: +// - Req +type IClientRPCServiceExecuteQueryStatementV2Args struct { + Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` } -func (p *iClientRPCServiceProcessorPipeTransfer) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServicePipeTransferArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "pipeTransfer", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) +func NewIClientRPCServiceExecuteQueryStatementV2Args() *IClientRPCServiceExecuteQueryStatementV2Args { + return &IClientRPCServiceExecuteQueryStatementV2Args{} +} + +var IClientRPCServiceExecuteQueryStatementV2Args_Req_DEFAULT *TSExecuteStatementReq +func (p *IClientRPCServiceExecuteQueryStatementV2Args) GetReq() *TSExecuteStatementReq { + if !p.IsSetReq() { + return IClientRPCServiceExecuteQueryStatementV2Args_Req_DEFAULT } - iprot.ReadMessageEnd(ctx) +return p.Req +} +func (p *IClientRPCServiceExecuteQueryStatementV2Args) IsSetReq() bool { + return p.Req != nil +} - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } +func (p *IClientRPCServiceExecuteQueryStatementV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err } } - }(tickerCtx, cancel) + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecuteStatementReq{} + if err := p.Req.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) + } + return nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeQueryStatementV2_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } + if err := p.Req.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Req), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:req: ", p), err) } + return err +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Args) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementV2Args(%+v)", *p) +} + +// Attributes: +// - Success +type IClientRPCServiceExecuteQueryStatementV2Result struct { + Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +} + +func NewIClientRPCServiceExecuteQueryStatementV2Result() *IClientRPCServiceExecuteQueryStatementV2Result { + return &IClientRPCServiceExecuteQueryStatementV2Result{} +} + +var IClientRPCServiceExecuteQueryStatementV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteQueryStatementV2Result) GetSuccess() *TSExecuteStatementResp { + if !p.IsSetSuccess() { + return IClientRPCServiceExecuteQueryStatementV2Result_Success_DEFAULT + } +return p.Success +} +func (p *IClientRPCServiceExecuteQueryStatementV2Result) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - result := IClientRPCServicePipeTransferResult{} - var retval *TPipeTransferResp - if retval, err2 = p.handler.PipeTransfer(ctx, args.Req); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField0(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pipeTransfer: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "pipeTransfer", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "pipeTransfer", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSExecuteStatementResp{} + if err := p.Success.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeQueryStatementV2_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } + if err := p.Success.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } - if err != nil { - return + return err +} + +func (p *IClientRPCServiceExecuteQueryStatementV2Result) String() string { + if p == nil { + return "" } - return true, err + return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementV2Result(%+v)", *p) } -type iClientRPCServiceProcessorPipeSubscribe struct { - handler IClientRPCService +// Attributes: +// - Req +type IClientRPCServiceExecuteUpdateStatementV2Args struct { + Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` } -func (p *iClientRPCServiceProcessorPipeSubscribe) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServicePipeSubscribeArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "pipeSubscribe", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) +func NewIClientRPCServiceExecuteUpdateStatementV2Args() *IClientRPCServiceExecuteUpdateStatementV2Args { + return &IClientRPCServiceExecuteUpdateStatementV2Args{} +} + +var IClientRPCServiceExecuteUpdateStatementV2Args_Req_DEFAULT *TSExecuteStatementReq +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) GetReq() *TSExecuteStatementReq { + if !p.IsSetReq() { + return IClientRPCServiceExecuteUpdateStatementV2Args_Req_DEFAULT } - iprot.ReadMessageEnd(ctx) +return p.Req +} +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) IsSetReq() bool { + return p.Req != nil +} - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } - } - } - }(tickerCtx, cancel) +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - result := IClientRPCServicePipeSubscribeResult{} - var retval *TPipeSubscribeResp - if retval, err2 = p.handler.PipeSubscribe(ctx, args.Req); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pipeSubscribe: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "pipeSubscribe", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "pipeSubscribe", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecuteStatementReq{} + if err := p.Req.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeUpdateStatementV2_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } + if err := p.Req.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Req), err) } - if err != nil { - return + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:req: ", p), err) } + return err +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Args) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementV2Args(%+v)", *p) +} + +// Attributes: +// - Success +type IClientRPCServiceExecuteUpdateStatementV2Result struct { + Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +} + +func NewIClientRPCServiceExecuteUpdateStatementV2Result() *IClientRPCServiceExecuteUpdateStatementV2Result { + return &IClientRPCServiceExecuteUpdateStatementV2Result{} +} + +var IClientRPCServiceExecuteUpdateStatementV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) GetSuccess() *TSExecuteStatementResp { + if !p.IsSetSuccess() { + return IClientRPCServiceExecuteUpdateStatementV2Result_Success_DEFAULT } - return true, err +return p.Success } - -type iClientRPCServiceProcessorGetBackupConfiguration struct { - handler IClientRPCService +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) IsSetSuccess() bool { + return p.Success != nil } -func (p *iClientRPCServiceProcessorGetBackupConfiguration) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceGetBackupConfigurationArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "getBackupConfiguration", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - iprot.ReadMessageEnd(ctx) - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField0(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err } } - }(tickerCtx, cancel) - } - - result := IClientRPCServiceGetBackupConfigurationResult{} - var retval *TSBackupConfigurationResp - if retval, err2 = p.handler.GetBackupConfiguration(ctx); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getBackupConfiguration: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "getBackupConfiguration", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "getBackupConfiguration", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSExecuteStatementResp{} + if err := p.Success.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeUpdateStatementV2_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } + if err := p.Success.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } - if err != nil { - return + return err +} + +func (p *IClientRPCServiceExecuteUpdateStatementV2Result) String() string { + if p == nil { + return "" } - return true, err + return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementV2Result(%+v)", *p) } -type iClientRPCServiceProcessorFetchAllConnectionsInfo struct { - handler IClientRPCService +// Attributes: +// - Req +type IClientRPCServiceExecuteStatementV2Args struct { + Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` } -func (p *iClientRPCServiceProcessorFetchAllConnectionsInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceFetchAllConnectionsInfoArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchAllConnectionsInfo", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) +func NewIClientRPCServiceExecuteStatementV2Args() *IClientRPCServiceExecuteStatementV2Args { + return &IClientRPCServiceExecuteStatementV2Args{} +} + +var IClientRPCServiceExecuteStatementV2Args_Req_DEFAULT *TSExecuteStatementReq +func (p *IClientRPCServiceExecuteStatementV2Args) GetReq() *TSExecuteStatementReq { + if !p.IsSetReq() { + return IClientRPCServiceExecuteStatementV2Args_Req_DEFAULT } - iprot.ReadMessageEnd(ctx) +return p.Req +} +func (p *IClientRPCServiceExecuteStatementV2Args) IsSetReq() bool { + return p.Req != nil +} - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } - } - } - }(tickerCtx, cancel) +func (p *IClientRPCServiceExecuteStatementV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - result := IClientRPCServiceFetchAllConnectionsInfoResult{} - var retval *TSConnectionInfoResp - if retval, err2 = p.handler.FetchAllConnectionsInfo(ctx); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetchAllConnectionsInfo: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "fetchAllConnectionsInfo", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "fetchAllConnectionsInfo", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteStatementV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecuteStatementReq{} + if err := p.Req.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteStatementV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeStatementV2_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *IClientRPCServiceExecuteStatementV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } + if err := p.Req.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Req), err) } - if err != nil { - return + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:req: ", p), err) } + return err +} + +func (p *IClientRPCServiceExecuteStatementV2Args) String() string { + if p == nil { + return "" } - return true, err + return fmt.Sprintf("IClientRPCServiceExecuteStatementV2Args(%+v)", *p) } -type iClientRPCServiceProcessorTestConnectionEmptyRPC struct { - handler IClientRPCService +// Attributes: +// - Success +type IClientRPCServiceExecuteStatementV2Result struct { + Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func (p *iClientRPCServiceProcessorTestConnectionEmptyRPC) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := IClientRPCServiceTestConnectionEmptyRPCArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "testConnectionEmptyRPC", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) +func NewIClientRPCServiceExecuteStatementV2Result() *IClientRPCServiceExecuteStatementV2Result { + return &IClientRPCServiceExecuteStatementV2Result{} +} + +var IClientRPCServiceExecuteStatementV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteStatementV2Result) GetSuccess() *TSExecuteStatementResp { + if !p.IsSetSuccess() { + return IClientRPCServiceExecuteStatementV2Result_Success_DEFAULT } - iprot.ReadMessageEnd(ctx) +return p.Success +} +func (p *IClientRPCServiceExecuteStatementV2Result) IsSetSuccess() bool { + return p.Success != nil +} - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } - } - } - }(tickerCtx, cancel) +func (p *IClientRPCServiceExecuteStatementV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } - result := IClientRPCServiceTestConnectionEmptyRPCResult{} - var retval *common.TSStatus - if retval, err2 = p.handler.TestConnectionEmptyRPC(ctx); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField0(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing testConnectionEmptyRPC: " + err2.Error()) - oprot.WriteMessageBegin(ctx, "testConnectionEmptyRPC", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval - } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "testConnectionEmptyRPC", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) + return nil +} + +func (p *IClientRPCServiceExecuteStatementV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSExecuteStatementResp{} + if err := p.Success.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } - if err != nil { - return + return nil +} + +func (p *IClientRPCServiceExecuteStatementV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeStatementV2_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField0(ctx, oprot); err != nil { return err } } - return true, err + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil } +func (p *IClientRPCServiceExecuteStatementV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } + if err := p.Success.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } + } + return err +} -// HELPER FUNCTIONS AND STRUCTURES +func (p *IClientRPCServiceExecuteStatementV2Result) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("IClientRPCServiceExecuteStatementV2Result(%+v)", *p) +} // Attributes: // - Req -type IClientRPCServiceExecuteQueryStatementV2Args struct { - Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteRawDataQueryV2Args struct { + Req *TSRawDataQueryReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteQueryStatementV2Args() *IClientRPCServiceExecuteQueryStatementV2Args { - return &IClientRPCServiceExecuteQueryStatementV2Args{} +func NewIClientRPCServiceExecuteRawDataQueryV2Args() *IClientRPCServiceExecuteRawDataQueryV2Args { + return &IClientRPCServiceExecuteRawDataQueryV2Args{} } -var IClientRPCServiceExecuteQueryStatementV2Args_Req_DEFAULT *TSExecuteStatementReq -func (p *IClientRPCServiceExecuteQueryStatementV2Args) GetReq() *TSExecuteStatementReq { +var IClientRPCServiceExecuteRawDataQueryV2Args_Req_DEFAULT *TSRawDataQueryReq +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) GetReq() *TSRawDataQueryReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteQueryStatementV2Args_Req_DEFAULT + return IClientRPCServiceExecuteRawDataQueryV2Args_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteQueryStatementV2Args) IsSetReq() bool { +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -25640,16 +27364,16 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Args) Read(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSExecuteStatementReq{} +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSRawDataQueryReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeQueryStatementV2_args"); err != nil { +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeRawDataQueryV2_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -25661,7 +27385,7 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Args) Write(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -25672,35 +27396,35 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Args) writeField1(ctx context.C return err } -func (p *IClientRPCServiceExecuteQueryStatementV2Args) String() string { +func (p *IClientRPCServiceExecuteRawDataQueryV2Args) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteRawDataQueryV2Args(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteQueryStatementV2Result struct { +type IClientRPCServiceExecuteRawDataQueryV2Result struct { Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteQueryStatementV2Result() *IClientRPCServiceExecuteQueryStatementV2Result { - return &IClientRPCServiceExecuteQueryStatementV2Result{} +func NewIClientRPCServiceExecuteRawDataQueryV2Result() *IClientRPCServiceExecuteRawDataQueryV2Result { + return &IClientRPCServiceExecuteRawDataQueryV2Result{} } -var IClientRPCServiceExecuteQueryStatementV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteQueryStatementV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceExecuteRawDataQueryV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteQueryStatementV2Result_Success_DEFAULT + return IClientRPCServiceExecuteRawDataQueryV2Result_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteQueryStatementV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -25738,7 +27462,7 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Result) Read(ctx context.Contex return nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -25746,8 +27470,8 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Result) ReadField0(ctx context return nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeQueryStatementV2_result"); err != nil { +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeRawDataQueryV2_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -25759,7 +27483,7 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Result) Write(ctx context.Conte return nil } -func (p *IClientRPCServiceExecuteQueryStatementV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -25772,35 +27496,35 @@ func (p *IClientRPCServiceExecuteQueryStatementV2Result) writeField0(ctx context return err } -func (p *IClientRPCServiceExecuteQueryStatementV2Result) String() string { +func (p *IClientRPCServiceExecuteRawDataQueryV2Result) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteRawDataQueryV2Result(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteUpdateStatementV2Args struct { - Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteLastDataQueryV2Args struct { + Req *TSLastDataQueryReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteUpdateStatementV2Args() *IClientRPCServiceExecuteUpdateStatementV2Args { - return &IClientRPCServiceExecuteUpdateStatementV2Args{} +func NewIClientRPCServiceExecuteLastDataQueryV2Args() *IClientRPCServiceExecuteLastDataQueryV2Args { + return &IClientRPCServiceExecuteLastDataQueryV2Args{} } -var IClientRPCServiceExecuteUpdateStatementV2Args_Req_DEFAULT *TSExecuteStatementReq -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) GetReq() *TSExecuteStatementReq { +var IClientRPCServiceExecuteLastDataQueryV2Args_Req_DEFAULT *TSLastDataQueryReq +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) GetReq() *TSLastDataQueryReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteUpdateStatementV2Args_Req_DEFAULT + return IClientRPCServiceExecuteLastDataQueryV2Args_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) IsSetReq() bool { +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -25838,16 +27562,16 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Args) Read(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSExecuteStatementReq{} +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSLastDataQueryReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeUpdateStatementV2_args"); err != nil { +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeLastDataQueryV2_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -25859,7 +27583,7 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Args) Write(ctx context.Contex return nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -25870,35 +27594,35 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Args) writeField1(ctx context. return err } -func (p *IClientRPCServiceExecuteUpdateStatementV2Args) String() string { +func (p *IClientRPCServiceExecuteLastDataQueryV2Args) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteLastDataQueryV2Args(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteUpdateStatementV2Result struct { +type IClientRPCServiceExecuteLastDataQueryV2Result struct { Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteUpdateStatementV2Result() *IClientRPCServiceExecuteUpdateStatementV2Result { - return &IClientRPCServiceExecuteUpdateStatementV2Result{} +func NewIClientRPCServiceExecuteLastDataQueryV2Result() *IClientRPCServiceExecuteLastDataQueryV2Result { + return &IClientRPCServiceExecuteLastDataQueryV2Result{} } -var IClientRPCServiceExecuteUpdateStatementV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceExecuteLastDataQueryV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteUpdateStatementV2Result_Success_DEFAULT + return IClientRPCServiceExecuteLastDataQueryV2Result_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -25936,7 +27660,7 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Result) Read(ctx context.Conte return nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -25944,8 +27668,8 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Result) ReadField0(ctx contex return nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeUpdateStatementV2_result"); err != nil { +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeLastDataQueryV2_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -25957,7 +27681,7 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Result) Write(ctx context.Cont return nil } -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -25970,35 +27694,35 @@ func (p *IClientRPCServiceExecuteUpdateStatementV2Result) writeField0(ctx contex return err } -func (p *IClientRPCServiceExecuteUpdateStatementV2Result) String() string { +func (p *IClientRPCServiceExecuteLastDataQueryV2Result) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteLastDataQueryV2Result(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteStatementV2Args struct { - Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs struct { + Req *TSFastLastDataQueryForOnePrefixPathReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteStatementV2Args() *IClientRPCServiceExecuteStatementV2Args { - return &IClientRPCServiceExecuteStatementV2Args{} +func NewIClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs() *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs { + return &IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs{} } -var IClientRPCServiceExecuteStatementV2Args_Req_DEFAULT *TSExecuteStatementReq -func (p *IClientRPCServiceExecuteStatementV2Args) GetReq() *TSExecuteStatementReq { +var IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs_Req_DEFAULT *TSFastLastDataQueryForOnePrefixPathReq +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) GetReq() *TSFastLastDataQueryForOnePrefixPathReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteStatementV2Args_Req_DEFAULT + return IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteStatementV2Args) IsSetReq() bool { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteStatementV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26036,16 +27760,16 @@ func (p *IClientRPCServiceExecuteStatementV2Args) Read(ctx context.Context, ipro return nil } -func (p *IClientRPCServiceExecuteStatementV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSExecuteStatementReq{} +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSFastLastDataQueryForOnePrefixPathReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteStatementV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeStatementV2_args"); err != nil { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOnePrefixPath_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -26057,7 +27781,7 @@ func (p *IClientRPCServiceExecuteStatementV2Args) Write(ctx context.Context, opr return nil } -func (p *IClientRPCServiceExecuteStatementV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -26068,35 +27792,35 @@ func (p *IClientRPCServiceExecuteStatementV2Args) writeField1(ctx context.Contex return err } -func (p *IClientRPCServiceExecuteStatementV2Args) String() string { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteStatementV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteStatementV2Result struct { +type IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult struct { Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteStatementV2Result() *IClientRPCServiceExecuteStatementV2Result { - return &IClientRPCServiceExecuteStatementV2Result{} +func NewIClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult() *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult { + return &IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult{} } -var IClientRPCServiceExecuteStatementV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteStatementV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteStatementV2Result_Success_DEFAULT + return IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteStatementV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteStatementV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26134,7 +27858,7 @@ func (p *IClientRPCServiceExecuteStatementV2Result) Read(ctx context.Context, ip return nil } -func (p *IClientRPCServiceExecuteStatementV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -26142,8 +27866,8 @@ func (p *IClientRPCServiceExecuteStatementV2Result) ReadField0(ctx context.Cont return nil } -func (p *IClientRPCServiceExecuteStatementV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeStatementV2_result"); err != nil { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOnePrefixPath_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -26155,7 +27879,7 @@ func (p *IClientRPCServiceExecuteStatementV2Result) Write(ctx context.Context, o return nil } -func (p *IClientRPCServiceExecuteStatementV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -26168,35 +27892,35 @@ func (p *IClientRPCServiceExecuteStatementV2Result) writeField0(ctx context.Cont return err } -func (p *IClientRPCServiceExecuteStatementV2Result) String() string { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteStatementV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteRawDataQueryV2Args struct { - Req *TSRawDataQueryReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args struct { + Req *TSFastLastDataQueryForOneDeviceReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteRawDataQueryV2Args() *IClientRPCServiceExecuteRawDataQueryV2Args { - return &IClientRPCServiceExecuteRawDataQueryV2Args{} +func NewIClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args() *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args { + return &IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args{} } -var IClientRPCServiceExecuteRawDataQueryV2Args_Req_DEFAULT *TSRawDataQueryReq -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) GetReq() *TSRawDataQueryReq { +var IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args_Req_DEFAULT *TSFastLastDataQueryForOneDeviceReq +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) GetReq() *TSFastLastDataQueryForOneDeviceReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteRawDataQueryV2Args_Req_DEFAULT + return IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) IsSetReq() bool { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26234,16 +27958,16 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Args) Read(ctx context.Context, i return nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSRawDataQueryReq{} +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSFastLastDataQueryForOneDeviceReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeRawDataQueryV2_args"); err != nil { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOneDeviceV2_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -26255,7 +27979,7 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Args) Write(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -26266,35 +27990,35 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Args) writeField1(ctx context.Con return err } -func (p *IClientRPCServiceExecuteRawDataQueryV2Args) String() string { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteRawDataQueryV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteRawDataQueryV2Result struct { +type IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result struct { Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteRawDataQueryV2Result() *IClientRPCServiceExecuteRawDataQueryV2Result { - return &IClientRPCServiceExecuteRawDataQueryV2Result{} +func NewIClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result() *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result { + return &IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result{} } -var IClientRPCServiceExecuteRawDataQueryV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteRawDataQueryV2Result_Success_DEFAULT + return IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26332,7 +28056,7 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Result) Read(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -26340,8 +28064,8 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Result) ReadField0(ctx context.C return nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeRawDataQueryV2_result"); err != nil { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOneDeviceV2_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -26353,7 +28077,7 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Result) Write(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -26366,35 +28090,35 @@ func (p *IClientRPCServiceExecuteRawDataQueryV2Result) writeField0(ctx context.C return err } -func (p *IClientRPCServiceExecuteRawDataQueryV2Result) String() string { +func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteRawDataQueryV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteLastDataQueryV2Args struct { - Req *TSLastDataQueryReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteAggregationQueryV2Args struct { + Req *TSAggregationQueryReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteLastDataQueryV2Args() *IClientRPCServiceExecuteLastDataQueryV2Args { - return &IClientRPCServiceExecuteLastDataQueryV2Args{} +func NewIClientRPCServiceExecuteAggregationQueryV2Args() *IClientRPCServiceExecuteAggregationQueryV2Args { + return &IClientRPCServiceExecuteAggregationQueryV2Args{} } -var IClientRPCServiceExecuteLastDataQueryV2Args_Req_DEFAULT *TSLastDataQueryReq -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) GetReq() *TSLastDataQueryReq { +var IClientRPCServiceExecuteAggregationQueryV2Args_Req_DEFAULT *TSAggregationQueryReq +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) GetReq() *TSAggregationQueryReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteLastDataQueryV2Args_Req_DEFAULT + return IClientRPCServiceExecuteAggregationQueryV2Args_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) IsSetReq() bool { +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26432,16 +28156,16 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Args) Read(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSLastDataQueryReq{} +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSAggregationQueryReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeLastDataQueryV2_args"); err != nil { +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeAggregationQueryV2_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -26453,7 +28177,7 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Args) Write(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -26464,35 +28188,35 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Args) writeField1(ctx context.Co return err } -func (p *IClientRPCServiceExecuteLastDataQueryV2Args) String() string { +func (p *IClientRPCServiceExecuteAggregationQueryV2Args) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteLastDataQueryV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteAggregationQueryV2Args(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteLastDataQueryV2Result struct { +type IClientRPCServiceExecuteAggregationQueryV2Result struct { Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteLastDataQueryV2Result() *IClientRPCServiceExecuteLastDataQueryV2Result { - return &IClientRPCServiceExecuteLastDataQueryV2Result{} +func NewIClientRPCServiceExecuteAggregationQueryV2Result() *IClientRPCServiceExecuteAggregationQueryV2Result { + return &IClientRPCServiceExecuteAggregationQueryV2Result{} } -var IClientRPCServiceExecuteLastDataQueryV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceExecuteAggregationQueryV2Result_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteLastDataQueryV2Result_Success_DEFAULT + return IClientRPCServiceExecuteAggregationQueryV2Result_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26530,7 +28254,7 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Result) Read(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -26538,8 +28262,8 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Result) ReadField0(ctx context. return nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeLastDataQueryV2_result"); err != nil { +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeAggregationQueryV2_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -26551,7 +28275,7 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Result) Write(ctx context.Contex return nil } -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -26564,35 +28288,35 @@ func (p *IClientRPCServiceExecuteLastDataQueryV2Result) writeField0(ctx context. return err } -func (p *IClientRPCServiceExecuteLastDataQueryV2Result) String() string { +func (p *IClientRPCServiceExecuteAggregationQueryV2Result) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteLastDataQueryV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteAggregationQueryV2Result(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs struct { - Req *TSFastLastDataQueryForOnePrefixPathReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceFetchResultsV2Args struct { + Req *TSFetchResultsReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs() *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs { - return &IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs{} +func NewIClientRPCServiceFetchResultsV2Args() *IClientRPCServiceFetchResultsV2Args { + return &IClientRPCServiceFetchResultsV2Args{} } -var IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs_Req_DEFAULT *TSFastLastDataQueryForOnePrefixPathReq -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) GetReq() *TSFastLastDataQueryForOnePrefixPathReq { +var IClientRPCServiceFetchResultsV2Args_Req_DEFAULT *TSFetchResultsReq +func (p *IClientRPCServiceFetchResultsV2Args) GetReq() *TSFetchResultsReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs_Req_DEFAULT + return IClientRPCServiceFetchResultsV2Args_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) IsSetReq() bool { +func (p *IClientRPCServiceFetchResultsV2Args) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceFetchResultsV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26630,16 +28354,16 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) Read(ctx return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSFastLastDataQueryForOnePrefixPathReq{} +func (p *IClientRPCServiceFetchResultsV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSFetchResultsReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOnePrefixPath_args"); err != nil { +func (p *IClientRPCServiceFetchResultsV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "fetchResultsV2_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -26651,7 +28375,7 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) Write(ct return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceFetchResultsV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -26662,35 +28386,35 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) writeFie return err } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs) String() string { +func (p *IClientRPCServiceFetchResultsV2Args) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceFetchResultsV2Args(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult struct { - Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceFetchResultsV2Result struct { + Success *TSFetchResultsResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult() *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult { - return &IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult{} +func NewIClientRPCServiceFetchResultsV2Result() *IClientRPCServiceFetchResultsV2Result { + return &IClientRPCServiceFetchResultsV2Result{} } -var IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceFetchResultsV2Result_Success_DEFAULT *TSFetchResultsResp +func (p *IClientRPCServiceFetchResultsV2Result) GetSuccess() *TSFetchResultsResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult_Success_DEFAULT + return IClientRPCServiceFetchResultsV2Result_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) IsSetSuccess() bool { +func (p *IClientRPCServiceFetchResultsV2Result) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceFetchResultsV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26728,16 +28452,16 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) Read(c return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSExecuteStatementResp{} +func (p *IClientRPCServiceFetchResultsV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSFetchResultsResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOnePrefixPath_result"); err != nil { +func (p *IClientRPCServiceFetchResultsV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "fetchResultsV2_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -26749,7 +28473,7 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) Write( return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceFetchResultsV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -26762,35 +28486,35 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) writeF return err } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult) String() string { +func (p *IClientRPCServiceFetchResultsV2Result) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOnePrefixPathResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceFetchResultsV2Result(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args struct { - Req *TSFastLastDataQueryForOneDeviceReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceOpenSessionArgs struct { + Req *TSOpenSessionReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args() *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args { - return &IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args{} +func NewIClientRPCServiceOpenSessionArgs() *IClientRPCServiceOpenSessionArgs { + return &IClientRPCServiceOpenSessionArgs{} } -var IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args_Req_DEFAULT *TSFastLastDataQueryForOneDeviceReq -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) GetReq() *TSFastLastDataQueryForOneDeviceReq { +var IClientRPCServiceOpenSessionArgs_Req_DEFAULT *TSOpenSessionReq +func (p *IClientRPCServiceOpenSessionArgs) GetReq() *TSOpenSessionReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args_Req_DEFAULT + return IClientRPCServiceOpenSessionArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) IsSetReq() bool { +func (p *IClientRPCServiceOpenSessionArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceOpenSessionArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26828,16 +28552,18 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) Read(ctx c return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSFastLastDataQueryForOneDeviceReq{} +func (p *IClientRPCServiceOpenSessionArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSOpenSessionReq{ + ClientProtocol: 2, +} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOneDeviceV2_args"); err != nil { +func (p *IClientRPCServiceOpenSessionArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "openSession_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -26849,7 +28575,7 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) Write(ctx return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceOpenSessionArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -26860,35 +28586,35 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) writeField return err } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args) String() string { +func (p *IClientRPCServiceOpenSessionArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceOpenSessionArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result struct { - Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceOpenSessionResult struct { + Success *TSOpenSessionResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result() *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result { - return &IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result{} +func NewIClientRPCServiceOpenSessionResult() *IClientRPCServiceOpenSessionResult { + return &IClientRPCServiceOpenSessionResult{} } -var IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceOpenSessionResult_Success_DEFAULT *TSOpenSessionResp +func (p *IClientRPCServiceOpenSessionResult) GetSuccess() *TSOpenSessionResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result_Success_DEFAULT + return IClientRPCServiceOpenSessionResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceOpenSessionResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceOpenSessionResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -26926,16 +28652,18 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) Read(ctx return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSExecuteStatementResp{} +func (p *IClientRPCServiceOpenSessionResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSOpenSessionResp{ + ServerProtocolVersion: 0, +} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeFastLastDataQueryForOneDeviceV2_result"); err != nil { +func (p *IClientRPCServiceOpenSessionResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "openSession_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -26947,7 +28675,7 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) Write(ct return nil } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceOpenSessionResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -26960,35 +28688,35 @@ func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) writeFie return err } -func (p *IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result) String() string { +func (p *IClientRPCServiceOpenSessionResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteFastLastDataQueryForOneDeviceV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceOpenSessionResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteAggregationQueryV2Args struct { - Req *TSAggregationQueryReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceCloseSessionArgs struct { + Req *TSCloseSessionReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteAggregationQueryV2Args() *IClientRPCServiceExecuteAggregationQueryV2Args { - return &IClientRPCServiceExecuteAggregationQueryV2Args{} +func NewIClientRPCServiceCloseSessionArgs() *IClientRPCServiceCloseSessionArgs { + return &IClientRPCServiceCloseSessionArgs{} } -var IClientRPCServiceExecuteAggregationQueryV2Args_Req_DEFAULT *TSAggregationQueryReq -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) GetReq() *TSAggregationQueryReq { +var IClientRPCServiceCloseSessionArgs_Req_DEFAULT *TSCloseSessionReq +func (p *IClientRPCServiceCloseSessionArgs) GetReq() *TSCloseSessionReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteAggregationQueryV2Args_Req_DEFAULT + return IClientRPCServiceCloseSessionArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) IsSetReq() bool { +func (p *IClientRPCServiceCloseSessionArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceCloseSessionArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27026,16 +28754,16 @@ func (p *IClientRPCServiceExecuteAggregationQueryV2Args) Read(ctx context.Contex return nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSAggregationQueryReq{} +func (p *IClientRPCServiceCloseSessionArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSCloseSessionReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeAggregationQueryV2_args"); err != nil { +func (p *IClientRPCServiceCloseSessionArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "closeSession_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -27047,7 +28775,7 @@ func (p *IClientRPCServiceExecuteAggregationQueryV2Args) Write(ctx context.Conte return nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceCloseSessionArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -27058,35 +28786,35 @@ func (p *IClientRPCServiceExecuteAggregationQueryV2Args) writeField1(ctx context return err } -func (p *IClientRPCServiceExecuteAggregationQueryV2Args) String() string { +func (p *IClientRPCServiceCloseSessionArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteAggregationQueryV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceCloseSessionArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteAggregationQueryV2Result struct { - Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceCloseSessionResult struct { + Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteAggregationQueryV2Result() *IClientRPCServiceExecuteAggregationQueryV2Result { - return &IClientRPCServiceExecuteAggregationQueryV2Result{} +func NewIClientRPCServiceCloseSessionResult() *IClientRPCServiceCloseSessionResult { + return &IClientRPCServiceCloseSessionResult{} } -var IClientRPCServiceExecuteAggregationQueryV2Result_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceCloseSessionResult_Success_DEFAULT *common.TSStatus +func (p *IClientRPCServiceCloseSessionResult) GetSuccess() *common.TSStatus { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteAggregationQueryV2Result_Success_DEFAULT + return IClientRPCServiceCloseSessionResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceCloseSessionResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceCloseSessionResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27124,16 +28852,16 @@ func (p *IClientRPCServiceExecuteAggregationQueryV2Result) Read(ctx context.Cont return nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSExecuteStatementResp{} +func (p *IClientRPCServiceCloseSessionResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &common.TSStatus{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeAggregationQueryV2_result"); err != nil { +func (p *IClientRPCServiceCloseSessionResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "closeSession_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -27145,7 +28873,7 @@ func (p *IClientRPCServiceExecuteAggregationQueryV2Result) Write(ctx context.Con return nil } -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceCloseSessionResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -27158,35 +28886,35 @@ func (p *IClientRPCServiceExecuteAggregationQueryV2Result) writeField0(ctx conte return err } -func (p *IClientRPCServiceExecuteAggregationQueryV2Result) String() string { +func (p *IClientRPCServiceCloseSessionResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteAggregationQueryV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceCloseSessionResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceFetchResultsV2Args struct { - Req *TSFetchResultsReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteStatementArgs struct { + Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceFetchResultsV2Args() *IClientRPCServiceFetchResultsV2Args { - return &IClientRPCServiceFetchResultsV2Args{} +func NewIClientRPCServiceExecuteStatementArgs() *IClientRPCServiceExecuteStatementArgs { + return &IClientRPCServiceExecuteStatementArgs{} } -var IClientRPCServiceFetchResultsV2Args_Req_DEFAULT *TSFetchResultsReq -func (p *IClientRPCServiceFetchResultsV2Args) GetReq() *TSFetchResultsReq { +var IClientRPCServiceExecuteStatementArgs_Req_DEFAULT *TSExecuteStatementReq +func (p *IClientRPCServiceExecuteStatementArgs) GetReq() *TSExecuteStatementReq { if !p.IsSetReq() { - return IClientRPCServiceFetchResultsV2Args_Req_DEFAULT + return IClientRPCServiceExecuteStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceFetchResultsV2Args) IsSetReq() bool { +func (p *IClientRPCServiceExecuteStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceFetchResultsV2Args) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27224,16 +28952,16 @@ func (p *IClientRPCServiceFetchResultsV2Args) Read(ctx context.Context, iprot th return nil } -func (p *IClientRPCServiceFetchResultsV2Args) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSFetchResultsReq{} +func (p *IClientRPCServiceExecuteStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecuteStatementReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceFetchResultsV2Args) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "fetchResultsV2_args"); err != nil { +func (p *IClientRPCServiceExecuteStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -27245,7 +28973,7 @@ func (p *IClientRPCServiceFetchResultsV2Args) Write(ctx context.Context, oprot t return nil } -func (p *IClientRPCServiceFetchResultsV2Args) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -27256,35 +28984,35 @@ func (p *IClientRPCServiceFetchResultsV2Args) writeField1(ctx context.Context, o return err } -func (p *IClientRPCServiceFetchResultsV2Args) String() string { +func (p *IClientRPCServiceExecuteStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceFetchResultsV2Args(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceFetchResultsV2Result struct { - Success *TSFetchResultsResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceExecuteStatementResult struct { + Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceFetchResultsV2Result() *IClientRPCServiceFetchResultsV2Result { - return &IClientRPCServiceFetchResultsV2Result{} +func NewIClientRPCServiceExecuteStatementResult() *IClientRPCServiceExecuteStatementResult { + return &IClientRPCServiceExecuteStatementResult{} } -var IClientRPCServiceFetchResultsV2Result_Success_DEFAULT *TSFetchResultsResp -func (p *IClientRPCServiceFetchResultsV2Result) GetSuccess() *TSFetchResultsResp { +var IClientRPCServiceExecuteStatementResult_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteStatementResult) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceFetchResultsV2Result_Success_DEFAULT + return IClientRPCServiceExecuteStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceFetchResultsV2Result) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceFetchResultsV2Result) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27322,16 +29050,16 @@ func (p *IClientRPCServiceFetchResultsV2Result) Read(ctx context.Context, iprot return nil } -func (p *IClientRPCServiceFetchResultsV2Result) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSFetchResultsResp{} +func (p *IClientRPCServiceExecuteStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceFetchResultsV2Result) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "fetchResultsV2_result"); err != nil { +func (p *IClientRPCServiceExecuteStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -27343,7 +29071,7 @@ func (p *IClientRPCServiceFetchResultsV2Result) Write(ctx context.Context, oprot return nil } -func (p *IClientRPCServiceFetchResultsV2Result) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -27356,35 +29084,35 @@ func (p *IClientRPCServiceFetchResultsV2Result) writeField0(ctx context.Context, return err } -func (p *IClientRPCServiceFetchResultsV2Result) String() string { +func (p *IClientRPCServiceExecuteStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceFetchResultsV2Result(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteStatementResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceOpenSessionArgs struct { - Req *TSOpenSessionReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteBatchStatementArgs struct { + Req *TSExecuteBatchStatementReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceOpenSessionArgs() *IClientRPCServiceOpenSessionArgs { - return &IClientRPCServiceOpenSessionArgs{} +func NewIClientRPCServiceExecuteBatchStatementArgs() *IClientRPCServiceExecuteBatchStatementArgs { + return &IClientRPCServiceExecuteBatchStatementArgs{} } -var IClientRPCServiceOpenSessionArgs_Req_DEFAULT *TSOpenSessionReq -func (p *IClientRPCServiceOpenSessionArgs) GetReq() *TSOpenSessionReq { +var IClientRPCServiceExecuteBatchStatementArgs_Req_DEFAULT *TSExecuteBatchStatementReq +func (p *IClientRPCServiceExecuteBatchStatementArgs) GetReq() *TSExecuteBatchStatementReq { if !p.IsSetReq() { - return IClientRPCServiceOpenSessionArgs_Req_DEFAULT + return IClientRPCServiceExecuteBatchStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceOpenSessionArgs) IsSetReq() bool { +func (p *IClientRPCServiceExecuteBatchStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceOpenSessionArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteBatchStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27422,18 +29150,16 @@ func (p *IClientRPCServiceOpenSessionArgs) Read(ctx context.Context, iprot thrif return nil } -func (p *IClientRPCServiceOpenSessionArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSOpenSessionReq{ - ClientProtocol: 2, -} +func (p *IClientRPCServiceExecuteBatchStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecuteBatchStatementReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceOpenSessionArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "openSession_args"); err != nil { +func (p *IClientRPCServiceExecuteBatchStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeBatchStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -27445,7 +29171,7 @@ func (p *IClientRPCServiceOpenSessionArgs) Write(ctx context.Context, oprot thri return nil } -func (p *IClientRPCServiceOpenSessionArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteBatchStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -27456,35 +29182,35 @@ func (p *IClientRPCServiceOpenSessionArgs) writeField1(ctx context.Context, opro return err } -func (p *IClientRPCServiceOpenSessionArgs) String() string { +func (p *IClientRPCServiceExecuteBatchStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceOpenSessionArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteBatchStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceOpenSessionResult struct { - Success *TSOpenSessionResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceExecuteBatchStatementResult struct { + Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceOpenSessionResult() *IClientRPCServiceOpenSessionResult { - return &IClientRPCServiceOpenSessionResult{} +func NewIClientRPCServiceExecuteBatchStatementResult() *IClientRPCServiceExecuteBatchStatementResult { + return &IClientRPCServiceExecuteBatchStatementResult{} } -var IClientRPCServiceOpenSessionResult_Success_DEFAULT *TSOpenSessionResp -func (p *IClientRPCServiceOpenSessionResult) GetSuccess() *TSOpenSessionResp { +var IClientRPCServiceExecuteBatchStatementResult_Success_DEFAULT *common.TSStatus +func (p *IClientRPCServiceExecuteBatchStatementResult) GetSuccess() *common.TSStatus { if !p.IsSetSuccess() { - return IClientRPCServiceOpenSessionResult_Success_DEFAULT + return IClientRPCServiceExecuteBatchStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceOpenSessionResult) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteBatchStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceOpenSessionResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteBatchStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27522,18 +29248,16 @@ func (p *IClientRPCServiceOpenSessionResult) Read(ctx context.Context, iprot thr return nil } -func (p *IClientRPCServiceOpenSessionResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSOpenSessionResp{ - ServerProtocolVersion: 0, -} +func (p *IClientRPCServiceExecuteBatchStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &common.TSStatus{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceOpenSessionResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "openSession_result"); err != nil { +func (p *IClientRPCServiceExecuteBatchStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeBatchStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -27545,7 +29269,7 @@ func (p *IClientRPCServiceOpenSessionResult) Write(ctx context.Context, oprot th return nil } -func (p *IClientRPCServiceOpenSessionResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteBatchStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -27558,35 +29282,35 @@ func (p *IClientRPCServiceOpenSessionResult) writeField0(ctx context.Context, op return err } -func (p *IClientRPCServiceOpenSessionResult) String() string { +func (p *IClientRPCServiceExecuteBatchStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceOpenSessionResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteBatchStatementResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceCloseSessionArgs struct { - Req *TSCloseSessionReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecuteQueryStatementArgs struct { + Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceCloseSessionArgs() *IClientRPCServiceCloseSessionArgs { - return &IClientRPCServiceCloseSessionArgs{} +func NewIClientRPCServiceExecuteQueryStatementArgs() *IClientRPCServiceExecuteQueryStatementArgs { + return &IClientRPCServiceExecuteQueryStatementArgs{} } -var IClientRPCServiceCloseSessionArgs_Req_DEFAULT *TSCloseSessionReq -func (p *IClientRPCServiceCloseSessionArgs) GetReq() *TSCloseSessionReq { +var IClientRPCServiceExecuteQueryStatementArgs_Req_DEFAULT *TSExecuteStatementReq +func (p *IClientRPCServiceExecuteQueryStatementArgs) GetReq() *TSExecuteStatementReq { if !p.IsSetReq() { - return IClientRPCServiceCloseSessionArgs_Req_DEFAULT + return IClientRPCServiceExecuteQueryStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceCloseSessionArgs) IsSetReq() bool { +func (p *IClientRPCServiceExecuteQueryStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceCloseSessionArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteQueryStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27624,16 +29348,16 @@ func (p *IClientRPCServiceCloseSessionArgs) Read(ctx context.Context, iprot thri return nil } -func (p *IClientRPCServiceCloseSessionArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSCloseSessionReq{} +func (p *IClientRPCServiceExecuteQueryStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecuteStatementReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceCloseSessionArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "closeSession_args"); err != nil { +func (p *IClientRPCServiceExecuteQueryStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeQueryStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -27645,7 +29369,7 @@ func (p *IClientRPCServiceCloseSessionArgs) Write(ctx context.Context, oprot thr return nil } -func (p *IClientRPCServiceCloseSessionArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteQueryStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -27656,35 +29380,35 @@ func (p *IClientRPCServiceCloseSessionArgs) writeField1(ctx context.Context, opr return err } -func (p *IClientRPCServiceCloseSessionArgs) String() string { +func (p *IClientRPCServiceExecuteQueryStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceCloseSessionArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceCloseSessionResult struct { - Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceExecuteQueryStatementResult struct { + Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceCloseSessionResult() *IClientRPCServiceCloseSessionResult { - return &IClientRPCServiceCloseSessionResult{} +func NewIClientRPCServiceExecuteQueryStatementResult() *IClientRPCServiceExecuteQueryStatementResult { + return &IClientRPCServiceExecuteQueryStatementResult{} } -var IClientRPCServiceCloseSessionResult_Success_DEFAULT *common.TSStatus -func (p *IClientRPCServiceCloseSessionResult) GetSuccess() *common.TSStatus { +var IClientRPCServiceExecuteQueryStatementResult_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteQueryStatementResult) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceCloseSessionResult_Success_DEFAULT + return IClientRPCServiceExecuteQueryStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceCloseSessionResult) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteQueryStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceCloseSessionResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteQueryStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27722,16 +29446,16 @@ func (p *IClientRPCServiceCloseSessionResult) Read(ctx context.Context, iprot th return nil } -func (p *IClientRPCServiceCloseSessionResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &common.TSStatus{} +func (p *IClientRPCServiceExecuteQueryStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceCloseSessionResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "closeSession_result"); err != nil { +func (p *IClientRPCServiceExecuteQueryStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeQueryStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -27743,7 +29467,7 @@ func (p *IClientRPCServiceCloseSessionResult) Write(ctx context.Context, oprot t return nil } -func (p *IClientRPCServiceCloseSessionResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteQueryStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -27756,35 +29480,35 @@ func (p *IClientRPCServiceCloseSessionResult) writeField0(ctx context.Context, o return err } -func (p *IClientRPCServiceCloseSessionResult) String() string { +func (p *IClientRPCServiceExecuteQueryStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceCloseSessionResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteStatementArgs struct { +type IClientRPCServiceExecuteUpdateStatementArgs struct { Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteStatementArgs() *IClientRPCServiceExecuteStatementArgs { - return &IClientRPCServiceExecuteStatementArgs{} +func NewIClientRPCServiceExecuteUpdateStatementArgs() *IClientRPCServiceExecuteUpdateStatementArgs { + return &IClientRPCServiceExecuteUpdateStatementArgs{} } -var IClientRPCServiceExecuteStatementArgs_Req_DEFAULT *TSExecuteStatementReq -func (p *IClientRPCServiceExecuteStatementArgs) GetReq() *TSExecuteStatementReq { +var IClientRPCServiceExecuteUpdateStatementArgs_Req_DEFAULT *TSExecuteStatementReq +func (p *IClientRPCServiceExecuteUpdateStatementArgs) GetReq() *TSExecuteStatementReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteStatementArgs_Req_DEFAULT + return IClientRPCServiceExecuteUpdateStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteStatementArgs) IsSetReq() bool { +func (p *IClientRPCServiceExecuteUpdateStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteUpdateStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27822,7 +29546,7 @@ func (p *IClientRPCServiceExecuteStatementArgs) Read(ctx context.Context, iprot return nil } -func (p *IClientRPCServiceExecuteStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteUpdateStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Req = &TSExecuteStatementReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) @@ -27830,8 +29554,8 @@ func (p *IClientRPCServiceExecuteStatementArgs) ReadField1(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeStatement_args"); err != nil { +func (p *IClientRPCServiceExecuteUpdateStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeUpdateStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -27843,7 +29567,7 @@ func (p *IClientRPCServiceExecuteStatementArgs) Write(ctx context.Context, oprot return nil } -func (p *IClientRPCServiceExecuteStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteUpdateStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -27854,35 +29578,35 @@ func (p *IClientRPCServiceExecuteStatementArgs) writeField1(ctx context.Context, return err } -func (p *IClientRPCServiceExecuteStatementArgs) String() string { +func (p *IClientRPCServiceExecuteUpdateStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteStatementArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteStatementResult struct { +type IClientRPCServiceExecuteUpdateStatementResult struct { Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteStatementResult() *IClientRPCServiceExecuteStatementResult { - return &IClientRPCServiceExecuteStatementResult{} +func NewIClientRPCServiceExecuteUpdateStatementResult() *IClientRPCServiceExecuteUpdateStatementResult { + return &IClientRPCServiceExecuteUpdateStatementResult{} } -var IClientRPCServiceExecuteStatementResult_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteStatementResult) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceExecuteUpdateStatementResult_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecuteUpdateStatementResult) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteStatementResult_Success_DEFAULT + return IClientRPCServiceExecuteUpdateStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteStatementResult) IsSetSuccess() bool { +func (p *IClientRPCServiceExecuteUpdateStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteUpdateStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -27920,7 +29644,7 @@ func (p *IClientRPCServiceExecuteStatementResult) Read(ctx context.Context, ipro return nil } -func (p *IClientRPCServiceExecuteStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecuteUpdateStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -27928,8 +29652,8 @@ func (p *IClientRPCServiceExecuteStatementResult) ReadField0(ctx context.Contex return nil } -func (p *IClientRPCServiceExecuteStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeStatement_result"); err != nil { +func (p *IClientRPCServiceExecuteUpdateStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executeUpdateStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -27941,7 +29665,7 @@ func (p *IClientRPCServiceExecuteStatementResult) Write(ctx context.Context, opr return nil } -func (p *IClientRPCServiceExecuteStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecuteUpdateStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -27954,35 +29678,35 @@ func (p *IClientRPCServiceExecuteStatementResult) writeField0(ctx context.Contex return err } -func (p *IClientRPCServiceExecuteStatementResult) String() string { +func (p *IClientRPCServiceExecuteUpdateStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteStatementResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteBatchStatementArgs struct { - Req *TSExecuteBatchStatementReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceFetchResultsArgs struct { + Req *TSFetchResultsReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteBatchStatementArgs() *IClientRPCServiceExecuteBatchStatementArgs { - return &IClientRPCServiceExecuteBatchStatementArgs{} +func NewIClientRPCServiceFetchResultsArgs() *IClientRPCServiceFetchResultsArgs { + return &IClientRPCServiceFetchResultsArgs{} } -var IClientRPCServiceExecuteBatchStatementArgs_Req_DEFAULT *TSExecuteBatchStatementReq -func (p *IClientRPCServiceExecuteBatchStatementArgs) GetReq() *TSExecuteBatchStatementReq { +var IClientRPCServiceFetchResultsArgs_Req_DEFAULT *TSFetchResultsReq +func (p *IClientRPCServiceFetchResultsArgs) GetReq() *TSFetchResultsReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteBatchStatementArgs_Req_DEFAULT + return IClientRPCServiceFetchResultsArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteBatchStatementArgs) IsSetReq() bool { +func (p *IClientRPCServiceFetchResultsArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteBatchStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceFetchResultsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28020,16 +29744,16 @@ func (p *IClientRPCServiceExecuteBatchStatementArgs) Read(ctx context.Context, i return nil } -func (p *IClientRPCServiceExecuteBatchStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSExecuteBatchStatementReq{} +func (p *IClientRPCServiceFetchResultsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSFetchResultsReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteBatchStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeBatchStatement_args"); err != nil { +func (p *IClientRPCServiceFetchResultsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "fetchResults_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -28041,7 +29765,7 @@ func (p *IClientRPCServiceExecuteBatchStatementArgs) Write(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteBatchStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceFetchResultsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -28052,35 +29776,35 @@ func (p *IClientRPCServiceExecuteBatchStatementArgs) writeField1(ctx context.Con return err } -func (p *IClientRPCServiceExecuteBatchStatementArgs) String() string { +func (p *IClientRPCServiceFetchResultsArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteBatchStatementArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceFetchResultsArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteBatchStatementResult struct { - Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceFetchResultsResult struct { + Success *TSFetchResultsResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteBatchStatementResult() *IClientRPCServiceExecuteBatchStatementResult { - return &IClientRPCServiceExecuteBatchStatementResult{} +func NewIClientRPCServiceFetchResultsResult() *IClientRPCServiceFetchResultsResult { + return &IClientRPCServiceFetchResultsResult{} } -var IClientRPCServiceExecuteBatchStatementResult_Success_DEFAULT *common.TSStatus -func (p *IClientRPCServiceExecuteBatchStatementResult) GetSuccess() *common.TSStatus { +var IClientRPCServiceFetchResultsResult_Success_DEFAULT *TSFetchResultsResp +func (p *IClientRPCServiceFetchResultsResult) GetSuccess() *TSFetchResultsResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteBatchStatementResult_Success_DEFAULT + return IClientRPCServiceFetchResultsResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteBatchStatementResult) IsSetSuccess() bool { +func (p *IClientRPCServiceFetchResultsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteBatchStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceFetchResultsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28118,16 +29842,16 @@ func (p *IClientRPCServiceExecuteBatchStatementResult) Read(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteBatchStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &common.TSStatus{} +func (p *IClientRPCServiceFetchResultsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSFetchResultsResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceExecuteBatchStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeBatchStatement_result"); err != nil { +func (p *IClientRPCServiceFetchResultsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "fetchResults_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -28139,7 +29863,7 @@ func (p *IClientRPCServiceExecuteBatchStatementResult) Write(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteBatchStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceFetchResultsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -28152,35 +29876,35 @@ func (p *IClientRPCServiceExecuteBatchStatementResult) writeField0(ctx context.C return err } -func (p *IClientRPCServiceExecuteBatchStatementResult) String() string { +func (p *IClientRPCServiceFetchResultsResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteBatchStatementResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceFetchResultsResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteQueryStatementArgs struct { - Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceFetchMetadataArgs struct { + Req *TSFetchMetadataReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteQueryStatementArgs() *IClientRPCServiceExecuteQueryStatementArgs { - return &IClientRPCServiceExecuteQueryStatementArgs{} +func NewIClientRPCServiceFetchMetadataArgs() *IClientRPCServiceFetchMetadataArgs { + return &IClientRPCServiceFetchMetadataArgs{} } -var IClientRPCServiceExecuteQueryStatementArgs_Req_DEFAULT *TSExecuteStatementReq -func (p *IClientRPCServiceExecuteQueryStatementArgs) GetReq() *TSExecuteStatementReq { +var IClientRPCServiceFetchMetadataArgs_Req_DEFAULT *TSFetchMetadataReq +func (p *IClientRPCServiceFetchMetadataArgs) GetReq() *TSFetchMetadataReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteQueryStatementArgs_Req_DEFAULT + return IClientRPCServiceFetchMetadataArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteQueryStatementArgs) IsSetReq() bool { +func (p *IClientRPCServiceFetchMetadataArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteQueryStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceFetchMetadataArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28218,16 +29942,16 @@ func (p *IClientRPCServiceExecuteQueryStatementArgs) Read(ctx context.Context, i return nil } -func (p *IClientRPCServiceExecuteQueryStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSExecuteStatementReq{} +func (p *IClientRPCServiceFetchMetadataArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSFetchMetadataReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteQueryStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeQueryStatement_args"); err != nil { +func (p *IClientRPCServiceFetchMetadataArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "fetchMetadata_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -28239,7 +29963,7 @@ func (p *IClientRPCServiceExecuteQueryStatementArgs) Write(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteQueryStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceFetchMetadataArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -28250,35 +29974,35 @@ func (p *IClientRPCServiceExecuteQueryStatementArgs) writeField1(ctx context.Con return err } -func (p *IClientRPCServiceExecuteQueryStatementArgs) String() string { +func (p *IClientRPCServiceFetchMetadataArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceFetchMetadataArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteQueryStatementResult struct { - Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceFetchMetadataResult struct { + Success *TSFetchMetadataResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteQueryStatementResult() *IClientRPCServiceExecuteQueryStatementResult { - return &IClientRPCServiceExecuteQueryStatementResult{} +func NewIClientRPCServiceFetchMetadataResult() *IClientRPCServiceFetchMetadataResult { + return &IClientRPCServiceFetchMetadataResult{} } -var IClientRPCServiceExecuteQueryStatementResult_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteQueryStatementResult) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceFetchMetadataResult_Success_DEFAULT *TSFetchMetadataResp +func (p *IClientRPCServiceFetchMetadataResult) GetSuccess() *TSFetchMetadataResp { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteQueryStatementResult_Success_DEFAULT + return IClientRPCServiceFetchMetadataResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteQueryStatementResult) IsSetSuccess() bool { +func (p *IClientRPCServiceFetchMetadataResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteQueryStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceFetchMetadataResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28316,16 +30040,16 @@ func (p *IClientRPCServiceExecuteQueryStatementResult) Read(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteQueryStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSExecuteStatementResp{} +func (p *IClientRPCServiceFetchMetadataResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSFetchMetadataResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceExecuteQueryStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeQueryStatement_result"); err != nil { +func (p *IClientRPCServiceFetchMetadataResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "fetchMetadata_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -28337,7 +30061,7 @@ func (p *IClientRPCServiceExecuteQueryStatementResult) Write(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteQueryStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceFetchMetadataResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -28350,35 +30074,35 @@ func (p *IClientRPCServiceExecuteQueryStatementResult) writeField0(ctx context.C return err } -func (p *IClientRPCServiceExecuteQueryStatementResult) String() string { +func (p *IClientRPCServiceFetchMetadataResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteQueryStatementResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceFetchMetadataResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceExecuteUpdateStatementArgs struct { - Req *TSExecuteStatementReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceCancelOperationArgs struct { + Req *TSCancelOperationReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceExecuteUpdateStatementArgs() *IClientRPCServiceExecuteUpdateStatementArgs { - return &IClientRPCServiceExecuteUpdateStatementArgs{} +func NewIClientRPCServiceCancelOperationArgs() *IClientRPCServiceCancelOperationArgs { + return &IClientRPCServiceCancelOperationArgs{} } -var IClientRPCServiceExecuteUpdateStatementArgs_Req_DEFAULT *TSExecuteStatementReq -func (p *IClientRPCServiceExecuteUpdateStatementArgs) GetReq() *TSExecuteStatementReq { +var IClientRPCServiceCancelOperationArgs_Req_DEFAULT *TSCancelOperationReq +func (p *IClientRPCServiceCancelOperationArgs) GetReq() *TSCancelOperationReq { if !p.IsSetReq() { - return IClientRPCServiceExecuteUpdateStatementArgs_Req_DEFAULT + return IClientRPCServiceCancelOperationArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceExecuteUpdateStatementArgs) IsSetReq() bool { +func (p *IClientRPCServiceCancelOperationArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceExecuteUpdateStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceCancelOperationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28416,16 +30140,16 @@ func (p *IClientRPCServiceExecuteUpdateStatementArgs) Read(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteUpdateStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSExecuteStatementReq{} +func (p *IClientRPCServiceCancelOperationArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSCancelOperationReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceExecuteUpdateStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeUpdateStatement_args"); err != nil { +func (p *IClientRPCServiceCancelOperationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "cancelOperation_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -28437,7 +30161,7 @@ func (p *IClientRPCServiceExecuteUpdateStatementArgs) Write(ctx context.Context, return nil } -func (p *IClientRPCServiceExecuteUpdateStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceCancelOperationArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -28448,35 +30172,35 @@ func (p *IClientRPCServiceExecuteUpdateStatementArgs) writeField1(ctx context.Co return err } -func (p *IClientRPCServiceExecuteUpdateStatementArgs) String() string { +func (p *IClientRPCServiceCancelOperationArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceCancelOperationArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceExecuteUpdateStatementResult struct { - Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceCancelOperationResult struct { + Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceExecuteUpdateStatementResult() *IClientRPCServiceExecuteUpdateStatementResult { - return &IClientRPCServiceExecuteUpdateStatementResult{} +func NewIClientRPCServiceCancelOperationResult() *IClientRPCServiceCancelOperationResult { + return &IClientRPCServiceCancelOperationResult{} } -var IClientRPCServiceExecuteUpdateStatementResult_Success_DEFAULT *TSExecuteStatementResp -func (p *IClientRPCServiceExecuteUpdateStatementResult) GetSuccess() *TSExecuteStatementResp { +var IClientRPCServiceCancelOperationResult_Success_DEFAULT *common.TSStatus +func (p *IClientRPCServiceCancelOperationResult) GetSuccess() *common.TSStatus { if !p.IsSetSuccess() { - return IClientRPCServiceExecuteUpdateStatementResult_Success_DEFAULT + return IClientRPCServiceCancelOperationResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceExecuteUpdateStatementResult) IsSetSuccess() bool { +func (p *IClientRPCServiceCancelOperationResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceExecuteUpdateStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceCancelOperationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28514,16 +30238,16 @@ func (p *IClientRPCServiceExecuteUpdateStatementResult) Read(ctx context.Context return nil } -func (p *IClientRPCServiceExecuteUpdateStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSExecuteStatementResp{} +func (p *IClientRPCServiceCancelOperationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &common.TSStatus{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceExecuteUpdateStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "executeUpdateStatement_result"); err != nil { +func (p *IClientRPCServiceCancelOperationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "cancelOperation_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -28535,7 +30259,7 @@ func (p *IClientRPCServiceExecuteUpdateStatementResult) Write(ctx context.Contex return nil } -func (p *IClientRPCServiceExecuteUpdateStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceCancelOperationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -28548,35 +30272,35 @@ func (p *IClientRPCServiceExecuteUpdateStatementResult) writeField0(ctx context. return err } -func (p *IClientRPCServiceExecuteUpdateStatementResult) String() string { +func (p *IClientRPCServiceCancelOperationResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceExecuteUpdateStatementResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceCancelOperationResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceFetchResultsArgs struct { - Req *TSFetchResultsReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceCloseOperationArgs struct { + Req *TSCloseOperationReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceFetchResultsArgs() *IClientRPCServiceFetchResultsArgs { - return &IClientRPCServiceFetchResultsArgs{} +func NewIClientRPCServiceCloseOperationArgs() *IClientRPCServiceCloseOperationArgs { + return &IClientRPCServiceCloseOperationArgs{} } -var IClientRPCServiceFetchResultsArgs_Req_DEFAULT *TSFetchResultsReq -func (p *IClientRPCServiceFetchResultsArgs) GetReq() *TSFetchResultsReq { +var IClientRPCServiceCloseOperationArgs_Req_DEFAULT *TSCloseOperationReq +func (p *IClientRPCServiceCloseOperationArgs) GetReq() *TSCloseOperationReq { if !p.IsSetReq() { - return IClientRPCServiceFetchResultsArgs_Req_DEFAULT + return IClientRPCServiceCloseOperationArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceFetchResultsArgs) IsSetReq() bool { +func (p *IClientRPCServiceCloseOperationArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceFetchResultsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceCloseOperationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28614,16 +30338,16 @@ func (p *IClientRPCServiceFetchResultsArgs) Read(ctx context.Context, iprot thri return nil } -func (p *IClientRPCServiceFetchResultsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSFetchResultsReq{} +func (p *IClientRPCServiceCloseOperationArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSCloseOperationReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceFetchResultsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "fetchResults_args"); err != nil { +func (p *IClientRPCServiceCloseOperationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "closeOperation_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -28635,7 +30359,7 @@ func (p *IClientRPCServiceFetchResultsArgs) Write(ctx context.Context, oprot thr return nil } -func (p *IClientRPCServiceFetchResultsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceCloseOperationArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -28646,35 +30370,35 @@ func (p *IClientRPCServiceFetchResultsArgs) writeField1(ctx context.Context, opr return err } -func (p *IClientRPCServiceFetchResultsArgs) String() string { +func (p *IClientRPCServiceCloseOperationArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceFetchResultsArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceCloseOperationArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceFetchResultsResult struct { - Success *TSFetchResultsResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceCloseOperationResult struct { + Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceFetchResultsResult() *IClientRPCServiceFetchResultsResult { - return &IClientRPCServiceFetchResultsResult{} +func NewIClientRPCServiceCloseOperationResult() *IClientRPCServiceCloseOperationResult { + return &IClientRPCServiceCloseOperationResult{} } -var IClientRPCServiceFetchResultsResult_Success_DEFAULT *TSFetchResultsResp -func (p *IClientRPCServiceFetchResultsResult) GetSuccess() *TSFetchResultsResp { +var IClientRPCServiceCloseOperationResult_Success_DEFAULT *common.TSStatus +func (p *IClientRPCServiceCloseOperationResult) GetSuccess() *common.TSStatus { if !p.IsSetSuccess() { - return IClientRPCServiceFetchResultsResult_Success_DEFAULT + return IClientRPCServiceCloseOperationResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceFetchResultsResult) IsSetSuccess() bool { +func (p *IClientRPCServiceCloseOperationResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceFetchResultsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceCloseOperationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28712,16 +30436,16 @@ func (p *IClientRPCServiceFetchResultsResult) Read(ctx context.Context, iprot th return nil } -func (p *IClientRPCServiceFetchResultsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSFetchResultsResp{} +func (p *IClientRPCServiceCloseOperationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &common.TSStatus{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceFetchResultsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "fetchResults_result"); err != nil { +func (p *IClientRPCServiceCloseOperationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "closeOperation_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -28733,7 +30457,7 @@ func (p *IClientRPCServiceFetchResultsResult) Write(ctx context.Context, oprot t return nil } -func (p *IClientRPCServiceFetchResultsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceCloseOperationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -28746,35 +30470,35 @@ func (p *IClientRPCServiceFetchResultsResult) writeField0(ctx context.Context, o return err } -func (p *IClientRPCServiceFetchResultsResult) String() string { +func (p *IClientRPCServiceCloseOperationResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceFetchResultsResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceCloseOperationResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceFetchMetadataArgs struct { - Req *TSFetchMetadataReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServicePrepareStatementArgs struct { + Req *TSPrepareReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceFetchMetadataArgs() *IClientRPCServiceFetchMetadataArgs { - return &IClientRPCServiceFetchMetadataArgs{} +func NewIClientRPCServicePrepareStatementArgs() *IClientRPCServicePrepareStatementArgs { + return &IClientRPCServicePrepareStatementArgs{} } -var IClientRPCServiceFetchMetadataArgs_Req_DEFAULT *TSFetchMetadataReq -func (p *IClientRPCServiceFetchMetadataArgs) GetReq() *TSFetchMetadataReq { +var IClientRPCServicePrepareStatementArgs_Req_DEFAULT *TSPrepareReq +func (p *IClientRPCServicePrepareStatementArgs) GetReq() *TSPrepareReq { if !p.IsSetReq() { - return IClientRPCServiceFetchMetadataArgs_Req_DEFAULT + return IClientRPCServicePrepareStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceFetchMetadataArgs) IsSetReq() bool { +func (p *IClientRPCServicePrepareStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceFetchMetadataArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServicePrepareStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28812,16 +30536,16 @@ func (p *IClientRPCServiceFetchMetadataArgs) Read(ctx context.Context, iprot thr return nil } -func (p *IClientRPCServiceFetchMetadataArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSFetchMetadataReq{} +func (p *IClientRPCServicePrepareStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSPrepareReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceFetchMetadataArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "fetchMetadata_args"); err != nil { +func (p *IClientRPCServicePrepareStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "prepareStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -28833,7 +30557,7 @@ func (p *IClientRPCServiceFetchMetadataArgs) Write(ctx context.Context, oprot th return nil } -func (p *IClientRPCServiceFetchMetadataArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServicePrepareStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -28844,35 +30568,35 @@ func (p *IClientRPCServiceFetchMetadataArgs) writeField1(ctx context.Context, op return err } -func (p *IClientRPCServiceFetchMetadataArgs) String() string { +func (p *IClientRPCServicePrepareStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceFetchMetadataArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServicePrepareStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceFetchMetadataResult struct { - Success *TSFetchMetadataResp `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServicePrepareStatementResult struct { + Success *TSPrepareResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceFetchMetadataResult() *IClientRPCServiceFetchMetadataResult { - return &IClientRPCServiceFetchMetadataResult{} +func NewIClientRPCServicePrepareStatementResult() *IClientRPCServicePrepareStatementResult { + return &IClientRPCServicePrepareStatementResult{} } -var IClientRPCServiceFetchMetadataResult_Success_DEFAULT *TSFetchMetadataResp -func (p *IClientRPCServiceFetchMetadataResult) GetSuccess() *TSFetchMetadataResp { +var IClientRPCServicePrepareStatementResult_Success_DEFAULT *TSPrepareResp +func (p *IClientRPCServicePrepareStatementResult) GetSuccess() *TSPrepareResp { if !p.IsSetSuccess() { - return IClientRPCServiceFetchMetadataResult_Success_DEFAULT + return IClientRPCServicePrepareStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceFetchMetadataResult) IsSetSuccess() bool { +func (p *IClientRPCServicePrepareStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceFetchMetadataResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServicePrepareStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -28910,16 +30634,16 @@ func (p *IClientRPCServiceFetchMetadataResult) Read(ctx context.Context, iprot t return nil } -func (p *IClientRPCServiceFetchMetadataResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &TSFetchMetadataResp{} +func (p *IClientRPCServicePrepareStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSPrepareResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceFetchMetadataResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "fetchMetadata_result"); err != nil { +func (p *IClientRPCServicePrepareStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "prepareStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -28931,7 +30655,7 @@ func (p *IClientRPCServiceFetchMetadataResult) Write(ctx context.Context, oprot return nil } -func (p *IClientRPCServiceFetchMetadataResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServicePrepareStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -28944,35 +30668,35 @@ func (p *IClientRPCServiceFetchMetadataResult) writeField0(ctx context.Context, return err } -func (p *IClientRPCServiceFetchMetadataResult) String() string { +func (p *IClientRPCServicePrepareStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceFetchMetadataResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServicePrepareStatementResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceCancelOperationArgs struct { - Req *TSCancelOperationReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceExecutePreparedStatementArgs struct { + Req *TSExecutePreparedReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceCancelOperationArgs() *IClientRPCServiceCancelOperationArgs { - return &IClientRPCServiceCancelOperationArgs{} +func NewIClientRPCServiceExecutePreparedStatementArgs() *IClientRPCServiceExecutePreparedStatementArgs { + return &IClientRPCServiceExecutePreparedStatementArgs{} } -var IClientRPCServiceCancelOperationArgs_Req_DEFAULT *TSCancelOperationReq -func (p *IClientRPCServiceCancelOperationArgs) GetReq() *TSCancelOperationReq { +var IClientRPCServiceExecutePreparedStatementArgs_Req_DEFAULT *TSExecutePreparedReq +func (p *IClientRPCServiceExecutePreparedStatementArgs) GetReq() *TSExecutePreparedReq { if !p.IsSetReq() { - return IClientRPCServiceCancelOperationArgs_Req_DEFAULT + return IClientRPCServiceExecutePreparedStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceCancelOperationArgs) IsSetReq() bool { +func (p *IClientRPCServiceExecutePreparedStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceCancelOperationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecutePreparedStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -29010,16 +30734,16 @@ func (p *IClientRPCServiceCancelOperationArgs) Read(ctx context.Context, iprot t return nil } -func (p *IClientRPCServiceCancelOperationArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSCancelOperationReq{} +func (p *IClientRPCServiceExecutePreparedStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSExecutePreparedReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceCancelOperationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "cancelOperation_args"); err != nil { +func (p *IClientRPCServiceExecutePreparedStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executePreparedStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -29031,7 +30755,7 @@ func (p *IClientRPCServiceCancelOperationArgs) Write(ctx context.Context, oprot return nil } -func (p *IClientRPCServiceCancelOperationArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecutePreparedStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -29042,35 +30766,35 @@ func (p *IClientRPCServiceCancelOperationArgs) writeField1(ctx context.Context, return err } -func (p *IClientRPCServiceCancelOperationArgs) String() string { +func (p *IClientRPCServiceExecutePreparedStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceCancelOperationArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecutePreparedStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceCancelOperationResult struct { - Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` +type IClientRPCServiceExecutePreparedStatementResult struct { + Success *TSExecuteStatementResp `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceCancelOperationResult() *IClientRPCServiceCancelOperationResult { - return &IClientRPCServiceCancelOperationResult{} +func NewIClientRPCServiceExecutePreparedStatementResult() *IClientRPCServiceExecutePreparedStatementResult { + return &IClientRPCServiceExecutePreparedStatementResult{} } -var IClientRPCServiceCancelOperationResult_Success_DEFAULT *common.TSStatus -func (p *IClientRPCServiceCancelOperationResult) GetSuccess() *common.TSStatus { +var IClientRPCServiceExecutePreparedStatementResult_Success_DEFAULT *TSExecuteStatementResp +func (p *IClientRPCServiceExecutePreparedStatementResult) GetSuccess() *TSExecuteStatementResp { if !p.IsSetSuccess() { - return IClientRPCServiceCancelOperationResult_Success_DEFAULT + return IClientRPCServiceExecutePreparedStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceCancelOperationResult) IsSetSuccess() bool { +func (p *IClientRPCServiceExecutePreparedStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceCancelOperationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceExecutePreparedStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -29108,16 +30832,16 @@ func (p *IClientRPCServiceCancelOperationResult) Read(ctx context.Context, iprot return nil } -func (p *IClientRPCServiceCancelOperationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - p.Success = &common.TSStatus{} +func (p *IClientRPCServiceExecutePreparedStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + p.Success = &TSExecuteStatementResp{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *IClientRPCServiceCancelOperationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "cancelOperation_result"); err != nil { +func (p *IClientRPCServiceExecutePreparedStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "executePreparedStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -29129,7 +30853,7 @@ func (p *IClientRPCServiceCancelOperationResult) Write(ctx context.Context, opro return nil } -func (p *IClientRPCServiceCancelOperationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceExecutePreparedStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -29142,35 +30866,35 @@ func (p *IClientRPCServiceCancelOperationResult) writeField0(ctx context.Context return err } -func (p *IClientRPCServiceCancelOperationResult) String() string { +func (p *IClientRPCServiceExecutePreparedStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceCancelOperationResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceExecutePreparedStatementResult(%+v)", *p) } // Attributes: // - Req -type IClientRPCServiceCloseOperationArgs struct { - Req *TSCloseOperationReq `thrift:"req,1" db:"req" json:"req"` +type IClientRPCServiceDeallocatePreparedStatementArgs struct { + Req *TSDeallocatePreparedReq `thrift:"req,1" db:"req" json:"req"` } -func NewIClientRPCServiceCloseOperationArgs() *IClientRPCServiceCloseOperationArgs { - return &IClientRPCServiceCloseOperationArgs{} +func NewIClientRPCServiceDeallocatePreparedStatementArgs() *IClientRPCServiceDeallocatePreparedStatementArgs { + return &IClientRPCServiceDeallocatePreparedStatementArgs{} } -var IClientRPCServiceCloseOperationArgs_Req_DEFAULT *TSCloseOperationReq -func (p *IClientRPCServiceCloseOperationArgs) GetReq() *TSCloseOperationReq { +var IClientRPCServiceDeallocatePreparedStatementArgs_Req_DEFAULT *TSDeallocatePreparedReq +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) GetReq() *TSDeallocatePreparedReq { if !p.IsSetReq() { - return IClientRPCServiceCloseOperationArgs_Req_DEFAULT + return IClientRPCServiceDeallocatePreparedStatementArgs_Req_DEFAULT } return p.Req } -func (p *IClientRPCServiceCloseOperationArgs) IsSetReq() bool { +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) IsSetReq() bool { return p.Req != nil } -func (p *IClientRPCServiceCloseOperationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -29208,16 +30932,16 @@ func (p *IClientRPCServiceCloseOperationArgs) Read(ctx context.Context, iprot th return nil } -func (p *IClientRPCServiceCloseOperationArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Req = &TSCloseOperationReq{} +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Req = &TSDeallocatePreparedReq{} if err := p.Req.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err) } return nil } -func (p *IClientRPCServiceCloseOperationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "closeOperation_args"); err != nil { +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "deallocatePreparedStatement_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } @@ -29229,7 +30953,7 @@ func (p *IClientRPCServiceCloseOperationArgs) Write(ctx context.Context, oprot t return nil } -func (p *IClientRPCServiceCloseOperationArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin(ctx, "req", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err) } if err := p.Req.Write(ctx, oprot); err != nil { @@ -29240,35 +30964,35 @@ func (p *IClientRPCServiceCloseOperationArgs) writeField1(ctx context.Context, o return err } -func (p *IClientRPCServiceCloseOperationArgs) String() string { +func (p *IClientRPCServiceDeallocatePreparedStatementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceCloseOperationArgs(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceDeallocatePreparedStatementArgs(%+v)", *p) } // Attributes: // - Success -type IClientRPCServiceCloseOperationResult struct { +type IClientRPCServiceDeallocatePreparedStatementResult struct { Success *common.TSStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } -func NewIClientRPCServiceCloseOperationResult() *IClientRPCServiceCloseOperationResult { - return &IClientRPCServiceCloseOperationResult{} +func NewIClientRPCServiceDeallocatePreparedStatementResult() *IClientRPCServiceDeallocatePreparedStatementResult { + return &IClientRPCServiceDeallocatePreparedStatementResult{} } -var IClientRPCServiceCloseOperationResult_Success_DEFAULT *common.TSStatus -func (p *IClientRPCServiceCloseOperationResult) GetSuccess() *common.TSStatus { +var IClientRPCServiceDeallocatePreparedStatementResult_Success_DEFAULT *common.TSStatus +func (p *IClientRPCServiceDeallocatePreparedStatementResult) GetSuccess() *common.TSStatus { if !p.IsSetSuccess() { - return IClientRPCServiceCloseOperationResult_Success_DEFAULT + return IClientRPCServiceDeallocatePreparedStatementResult_Success_DEFAULT } return p.Success } -func (p *IClientRPCServiceCloseOperationResult) IsSetSuccess() bool { +func (p *IClientRPCServiceDeallocatePreparedStatementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *IClientRPCServiceCloseOperationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceDeallocatePreparedStatementResult) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -29306,7 +31030,7 @@ func (p *IClientRPCServiceCloseOperationResult) Read(ctx context.Context, iprot return nil } -func (p *IClientRPCServiceCloseOperationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { +func (p *IClientRPCServiceDeallocatePreparedStatementResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &common.TSStatus{} if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) @@ -29314,8 +31038,8 @@ func (p *IClientRPCServiceCloseOperationResult) ReadField0(ctx context.Context, return nil } -func (p *IClientRPCServiceCloseOperationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "closeOperation_result"); err != nil { +func (p *IClientRPCServiceDeallocatePreparedStatementResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "deallocatePreparedStatement_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField0(ctx, oprot); err != nil { return err } @@ -29327,7 +31051,7 @@ func (p *IClientRPCServiceCloseOperationResult) Write(ctx context.Context, oprot return nil } -func (p *IClientRPCServiceCloseOperationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { +func (p *IClientRPCServiceDeallocatePreparedStatementResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } @@ -29340,11 +31064,11 @@ func (p *IClientRPCServiceCloseOperationResult) writeField0(ctx context.Context, return err } -func (p *IClientRPCServiceCloseOperationResult) String() string { +func (p *IClientRPCServiceDeallocatePreparedStatementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("IClientRPCServiceCloseOperationResult(%+v)", *p) + return fmt.Sprintf("IClientRPCServiceDeallocatePreparedStatementResult(%+v)", *p) } // Attributes: @@ -30793,13 +32517,13 @@ func (p *IClientRPCServiceDeleteTimeseriesArgs) ReadField2(ctx context.Context, tSlice := make([]string, 0, size) p.Path = tSlice for i := 0; i < size; i ++ { -var _elem397 string +var _elem406 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem397 = v + _elem406 = v } - p.Path = append(p.Path, _elem397) + p.Path = append(p.Path, _elem406) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -31041,13 +32765,13 @@ func (p *IClientRPCServiceDeleteStorageGroupsArgs) ReadField2(ctx context.Conte tSlice := make([]string, 0, size) p.StorageGroup = tSlice for i := 0; i < size; i ++ { -var _elem398 string +var _elem407 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem398 = v + _elem407 = v } - p.StorageGroup = append(p.StorageGroup, _elem398) + p.StorageGroup = append(p.StorageGroup, _elem407) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) diff --git a/test/e2e/e2e_table_test.go b/test/e2e/e2e_table_test.go index b5c092a..e56ce95 100644 --- a/test/e2e/e2e_table_test.go +++ b/test/e2e/e2e_table_test.go @@ -245,6 +245,63 @@ func (s *e2eTableTestSuite) Test_GetSessionFromSessionPoolWithSpecificDatabase() wg.Wait() } +func (s *e2eTableTestSuite) Test_ErrInTableSessionPool() { + assert := s.Require() + poolConfig := &client.PoolConfig{ + Host: host, + Port: port, + UserName: username, + Password: password, + Database: database, + } + sessionPool := client.NewTableSessionPool(poolConfig, 3, 10000, 3000, false) + defer sessionPool.Close() + + session1, err := sessionPool.GetSession() + assert.NoError(err) + s.checkError(session1.ExecuteNonQueryStatement("create table test_timeout(tag1 string tag, tag2 string tag, s1 text field, s2 text field)")) + + timeoutInMs := int64(1) + dataSet, err := session1.ExecuteQueryStatement("select * from test_timeout", &timeoutInMs) + if err == nil { + dataSet.Close() + err = session1.Close() + assert.NoError(err) + return + } + err = session1.Close() + assert.NoError(err) + // test repeated close + err = session1.Close() + assert.NoError(err) + + timeoutInMs = int64(60000) + + session1, err = sessionPool.GetSession() + assert.NoError(err) + defer session1.Close() + dataSet, err = session1.ExecuteQueryStatement("show tables", &timeoutInMs) + assert.NoError(err) + dataSet.Close() + + session2, err := sessionPool.GetSession() + assert.NoError(err) + defer session2.Close() + dataSet, err = session2.ExecuteQueryStatement("show tables", &timeoutInMs) + assert.NoError(err) + dataSet.Close() + + session3, err := sessionPool.GetSession() + assert.NoError(err) + defer session3.Close() + dataSet, err = session3.ExecuteQueryStatement("show tables", &timeoutInMs) + assert.NoError(err) + dataSet.Close() + + _, err = sessionPool.GetSession() + assert.NotNil(err) +} + func (s *e2eTableTestSuite) Test_InsertTabletAndQuery() { assert := s.Require() s.checkError(s.session.ExecuteNonQueryStatement("create table t1 (tag1 string tag, tag2 string tag, s1 text field, s2 text field)")) From cec2d7ea5c2d876fa2584c5a650f2a488350e5a0 Mon Sep 17 00:00:00 2001 From: Zane <44780287+betterlmy@users.noreply.github.com> Date: Thu, 12 Mar 2026 19:00:51 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20fix=20EOF=20error=20when=20decoding?= =?UTF-8?q?=20columns=20with=20empty=20string=20or=20zero=20po=E2=80=A6=20?= =?UTF-8?q?(#155)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: fix EOF error when decoding columns with empty string or zero positionCount * Update column_decoder_test.go 增加license header * fix: return error when resp is nil after reconnect * fix: GetCurrentRowTime returns time.Time to avoid precision ambiguity --- client/column_decoder.go | 49 ++++++++- client/column_decoder_test.go | 200 ++++++++++++++++++++++++++++++++++ client/session.go | 52 ++++++--- client/sessiondataset.go | 4 + 4 files changed, 284 insertions(+), 21 deletions(-) create mode 100644 client/column_decoder_test.go diff --git a/client/column_decoder.go b/client/column_decoder.go index e943541..0898c4f 100644 --- a/client/column_decoder.go +++ b/client/column_decoder.go @@ -95,6 +95,18 @@ func (decoder *Int32ArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataTyp // +---------------+-----------------+-------------+ // | byte | list[byte] | list[int32] | // +---------------+-----------------+-------------+ + + if positionCount == 0 { + switch dataType { + case INT32, DATE: + return NewIntColumn(0, 0, nil, []int32{}) + case FLOAT: + return NewFloatColumn(0, 0, nil, []float32{}) + default: + return nil, fmt.Errorf("invalid data type: %v", dataType) + } + } + nullIndicators, err := deserializeNullIndicators(reader, positionCount) if err != nil { return nil, err @@ -139,6 +151,18 @@ func (decoder *Int64ArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataTyp // +---------------+-----------------+-------------+ // | byte | list[byte] | list[int64] | // +---------------+-----------------+-------------+ + + if positionCount == 0 { + switch dataType { + case INT64, TIMESTAMP: + return NewLongColumn(0, 0, nil, []int64{}) + case DOUBLE: + return NewDoubleColumn(0, 0, nil, []float64{}) + default: + return nil, fmt.Errorf("invalid data type: %v", dataType) + } + } + nullIndicators, err := deserializeNullIndicators(reader, positionCount) if err != nil { return nil, err @@ -185,6 +209,11 @@ func (decoder *ByteArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataType if dataType != BOOLEAN { return nil, fmt.Errorf("invalid data type: %v", dataType) } + + if positionCount == 0 { + return NewBooleanColumn(0, 0, nil, []bool{}) + } + nullIndicators, err := deserializeNullIndicators(reader, positionCount) if err != nil { return nil, err @@ -218,6 +247,11 @@ func (decoder *BinaryArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataTy if TEXT != dataType { return nil, fmt.Errorf("invalid data type: %v", dataType) } + + if positionCount == 0 { + return NewBinaryColumn(0, 0, nil, []*Binary{}) + } + nullIndicators, err := deserializeNullIndicators(reader, positionCount) if err != nil { return nil, err @@ -232,12 +266,17 @@ func (decoder *BinaryArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataTy if err != nil { return nil, err } - value := make([]byte, length) - _, err = reader.Read(value) - if err != nil { - return nil, err + + if length == 0 { + values[i] = NewBinary([]byte{}) + } else { + value := make([]byte, length) + _, err = reader.Read(value) + if err != nil { + return nil, err + } + values[i] = NewBinary(value) } - values[i] = NewBinary(value) } return NewBinaryColumn(0, positionCount, nullIndicators, values) } diff --git a/client/column_decoder_test.go b/client/column_decoder_test.go new file mode 100644 index 0000000..dc5d433 --- /dev/null +++ b/client/column_decoder_test.go @@ -0,0 +1,200 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package client + +import ( + "bytes" + "encoding/binary" + "testing" +) + +func buildNullIndicatorBytes(nulls []bool) []byte { + var buf bytes.Buffer + hasNull := false + for _, n := range nulls { + if n { + hasNull = true + break + } + } + if !hasNull { + buf.WriteByte(0) + return buf.Bytes() + } + buf.WriteByte(1) + packed := make([]byte, (len(nulls)+7)/8) + for i, n := range nulls { + if n { + packed[i/8] |= 0b10000000 >> (uint(i) % 8) + } + } + buf.Write(packed) + return buf.Bytes() +} + +func TestBinaryArrayColumnDecoder_EmptyString(t *testing.T) { + var buf bytes.Buffer + buf.Write(buildNullIndicatorBytes([]bool{false})) + _ = binary.Write(&buf, binary.BigEndian, int32(0)) + + col, err := (&BinaryArrayColumnDecoder{}).ReadColumn(bytes.NewReader(buf.Bytes()), TEXT, 1) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.GetPositionCount() != 1 { + t.Fatalf("expected positionCount=1, got %d", col.GetPositionCount()) + } + if col.IsNull(0) { + t.Fatal("row 0 should not be null") + } + val, err := col.GetBinary(0) + if err != nil { + t.Fatalf("GetBinary(0) failed: %v", err) + } + if len(val.values) != 0 { + t.Fatalf("expected empty string, got %q", string(val.values)) + } +} + +func TestBinaryArrayColumnDecoder_NullThenEmptyString(t *testing.T) { + var buf bytes.Buffer + buf.Write(buildNullIndicatorBytes([]bool{true, false})) + _ = binary.Write(&buf, binary.BigEndian, int32(0)) + + col, err := (&BinaryArrayColumnDecoder{}).ReadColumn(bytes.NewReader(buf.Bytes()), TEXT, 2) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if !col.IsNull(0) { + t.Error("row 0 should be null") + } + if col.IsNull(1) { + t.Error("row 1 should not be null") + } + val, err := col.GetBinary(1) + if err != nil { + t.Fatalf("GetBinary(1) failed: %v", err) + } + if len(val.values) != 0 { + t.Fatalf("expected empty string, got %q", string(val.values)) + } +} + +func TestBinaryArrayColumnDecoder_WithNull(t *testing.T) { + var buf bytes.Buffer + buf.Write(buildNullIndicatorBytes([]bool{false, true, false})) + writeText := func(s string) { + _ = binary.Write(&buf, binary.BigEndian, int32(len(s))) + buf.WriteString(s) + } + writeText("hello") + writeText("world") + + col, err := (&BinaryArrayColumnDecoder{}).ReadColumn(bytes.NewReader(buf.Bytes()), TEXT, 3) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.IsNull(0) { + t.Error("row 0 should not be null") + } + if v, _ := col.GetBinary(0); string(v.values) != "hello" { + t.Errorf("row 0: expected \"hello\", got %q", string(v.values)) + } + if !col.IsNull(1) { + t.Error("row 1 should be null") + } + if col.IsNull(2) { + t.Error("row 2 should not be null") + } + if v, _ := col.GetBinary(2); string(v.values) != "world" { + t.Errorf("row 2: expected \"world\", got %q", string(v.values)) + } +} + +func TestInt64ArrayColumnDecoder_WithNull(t *testing.T) { + var buf bytes.Buffer + buf.Write(buildNullIndicatorBytes([]bool{false, true, false})) + _ = binary.Write(&buf, binary.BigEndian, int64(100)) + _ = binary.Write(&buf, binary.BigEndian, int64(200)) + + col, err := (&Int64ArrayColumnDecoder{}).ReadColumn(bytes.NewReader(buf.Bytes()), INT64, 3) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.IsNull(0) { + t.Error("row 0 should not be null") + } + if v, _ := col.GetLong(0); v != 100 { + t.Errorf("row 0: expected 100, got %d", v) + } + if !col.IsNull(1) { + t.Error("row 1 should be null") + } + if col.IsNull(2) { + t.Error("row 2 should not be null") + } + if v, _ := col.GetLong(2); v != 200 { + t.Errorf("row 2: expected 200, got %d", v) + } +} + +func TestColumnDecoder_ZeroPositionCount(t *testing.T) { + empty := func() *bytes.Reader { return bytes.NewReader([]byte{}) } + + t.Run("Int32ArrayColumnDecoder", func(t *testing.T) { + col, err := (&Int32ArrayColumnDecoder{}).ReadColumn(empty(), INT32, 0) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.GetPositionCount() != 0 { + t.Errorf("expected positionCount=0, got %d", col.GetPositionCount()) + } + }) + + t.Run("Int64ArrayColumnDecoder", func(t *testing.T) { + col, err := (&Int64ArrayColumnDecoder{}).ReadColumn(empty(), INT64, 0) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.GetPositionCount() != 0 { + t.Errorf("expected positionCount=0, got %d", col.GetPositionCount()) + } + }) + + t.Run("ByteArrayColumnDecoder", func(t *testing.T) { + col, err := (&ByteArrayColumnDecoder{}).ReadColumn(empty(), BOOLEAN, 0) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.GetPositionCount() != 0 { + t.Errorf("expected positionCount=0, got %d", col.GetPositionCount()) + } + }) + + t.Run("BinaryArrayColumnDecoder", func(t *testing.T) { + col, err := (&BinaryArrayColumnDecoder{}).ReadColumn(empty(), TEXT, 0) + if err != nil { + t.Fatalf("ReadColumn failed: %v", err) + } + if col.GetPositionCount() != 0 { + t.Errorf("expected positionCount=0, got %d", col.GetPositionCount()) + } + }) +} diff --git a/client/session.go b/client/session.go index b604d2b..c4a1bc4 100644 --- a/client/session.go +++ b/client/session.go @@ -580,10 +580,15 @@ func (s *Session) ExecuteQueryStatement(sql string, timeoutMs *int64) (*SessionD request.SessionId = s.sessionId request.StatementId = s.requestStatementId resp, err = s.client.ExecuteQueryStatementV2(context.Background(), &request) - if statusErr := VerifySuccess(resp.Status); statusErr == nil { - return NewSessionDataSet(sql, resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) - } else { - return nil, statusErr + if err == nil { + if resp == nil { + return nil, fmt.Errorf("received nil response after reconnect") + } + if statusErr := VerifySuccess(resp.Status); statusErr == nil { + return NewSessionDataSet(sql, resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) + } else { + return nil, statusErr + } } } return nil, err @@ -608,10 +613,15 @@ func (s *Session) ExecuteAggregationQuery(paths []string, aggregations []common. if s.reconnect() { request.SessionId = s.sessionId resp, err = s.client.ExecuteAggregationQueryV2(context.Background(), &request) - if statusErr := VerifySuccess(resp.Status); statusErr == nil { - return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) - } else { - return nil, statusErr + if err == nil { + if resp == nil { + return nil, fmt.Errorf("received nil response after reconnect") + } + if statusErr := VerifySuccess(resp.Status); statusErr == nil { + return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) + } else { + return nil, statusErr + } } } return nil, err @@ -637,10 +647,15 @@ func (s *Session) ExecuteAggregationQueryWithLegalNodes(paths []string, aggregat if s.reconnect() { request.SessionId = s.sessionId resp, err = s.client.ExecuteAggregationQueryV2(context.Background(), &request) - if statusErr := VerifySuccess(resp.Status); statusErr == nil { - return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) - } else { - return nil, statusErr + if err == nil { + if resp == nil { + return nil, fmt.Errorf("received nil response after reconnect") + } + if statusErr := VerifySuccess(resp.Status); statusErr == nil { + return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) + } else { + return nil, statusErr + } } } return nil, err @@ -664,10 +679,15 @@ func (s *Session) ExecuteFastLastDataQueryForOnePrefixPath(prefixes []string, ti if s.reconnect() { request.SessionId = s.sessionId resp, err = s.client.ExecuteFastLastDataQueryForOnePrefixPath(context.Background(), &request) - if statusErr := VerifySuccess(resp.Status); statusErr == nil { - return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) - } else { - return nil, statusErr + if err == nil { + if resp == nil { + return nil, fmt.Errorf("received nil response after reconnect") + } + if statusErr := VerifySuccess(resp.Status); statusErr == nil { + return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.requestStatementId, s.client, s.sessionId, resp.QueryResult_, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, timeoutMs, *resp.MoreData, s.config.FetchSize, s.config.TimeZone, s.timeFactor, resp.GetColumnIndex2TsBlockColumnIndexList()) + } else { + return nil, statusErr + } } } return nil, err diff --git a/client/sessiondataset.go b/client/sessiondataset.go index ef3faba..66ffab1 100644 --- a/client/sessiondataset.go +++ b/client/sessiondataset.go @@ -125,3 +125,7 @@ func (s *SessionDataSet) GetColumnNames() []string { func (s *SessionDataSet) GetColumnTypes() []string { return s.ioTDBRpcDataSet.columnTypeList } + +func (s *SessionDataSet) GetCurrentRowTime() time.Time { + return convertToTimestamp(s.ioTDBRpcDataSet.GetCurrentRowTime(), s.ioTDBRpcDataSet.timeFactor) +} From ebd4a915144fde4a7e7ec67393974bce811097e9 Mon Sep 17 00:00:00 2001 From: zhanglei <357733652@qq.com> Date: Sun, 15 Mar 2026 19:31:49 +0800 Subject: [PATCH 4/4] feat: Upgrade the Go version --- .github/workflows/go.yml | 4 ++-- go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 252044b..a4494de 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -25,10 +25,10 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - go: ['1.13', 'stable'] + go: ['1.20', 'stable'] exclude: - os: macos-latest - go: '1.13' + go: '1.20' steps: - name: Check out code into the Go module directory diff --git a/go.mod b/go.mod index a2a1faf..4c9d4c2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/apache/iotdb-client-go/v2 -go 1.24.3 +go 1.20 require ( github.com/apache/thrift v0.15.0