From 0aa3c88d86f4235fce79a73ab0d86a1613199335 Mon Sep 17 00:00:00 2001 From: Muxian Wu Date: Thu, 27 Sep 2018 15:16:26 +0800 Subject: [PATCH 01/28] changed the unmarshalling behaviour for unmarshalling {"key": []} into map[string]interface{}. The value for "key" in the map will be an empty slice instead of a nil slice. --- jlexer/lexer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jlexer/lexer.go b/jlexer/lexer.go index 51f0566..514c894 100644 --- a/jlexer/lexer.go +++ b/jlexer/lexer.go @@ -1151,7 +1151,7 @@ func (r *Lexer) Interface() interface{} { } else if r.token.delimValue == '[' { r.consume() - var ret []interface{} + ret := []interface{}{} for !r.IsDelim(']') { ret = append(ret, r.Interface()) r.WantComma() From a402cc944c4f6e5fcf215c6012c5c98b29e9b9c1 Mon Sep 17 00:00:00 2001 From: Muxian Wu Date: Fri, 28 Sep 2018 09:14:50 +0800 Subject: [PATCH 02/28] fixed the test case --- jlexer/lexer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jlexer/lexer_test.go b/jlexer/lexer_test.go index 3149ce4..fcf9780 100644 --- a/jlexer/lexer_test.go +++ b/jlexer/lexer_test.go @@ -194,7 +194,7 @@ func TestInterface(t *testing.T) { {toParse: "5", want: float64(5)}, {toParse: `{}`, want: map[string]interface{}{}}, - {toParse: `[]`, want: []interface{}(nil)}, + {toParse: `[]`, want: []interface{}{}}, {toParse: `{"a": "b"}`, want: map[string]interface{}{"a": "b"}}, {toParse: `[5]`, want: []interface{}{float64(5)}}, From 24b3ef1d37af71b48553a27631aae8bc3ca51597 Mon Sep 17 00:00:00 2001 From: rappleyard_depoel Date: Tue, 2 Apr 2019 14:32:02 +0100 Subject: [PATCH 03/28] Issue #217: handling of _test.go files If a directory is passed to the command line tool, the directory includes test files, and those test files specify types that the tool is interested in (e.g. struct types) then it will trigger a compiler error, fail to generate, and leave some detritus in the target directory. We should filter out test files from consideration to prevent this error from occuring. Future development could include a command line option to process test files, if anyone wants that (unlikely). --- parser/parser.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parser/parser.go b/parser/parser.go index 3639ed0..6f7cc22 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -5,6 +5,7 @@ import ( "go/ast" "go/parser" "go/token" + "os" "os/exec" "strings" ) @@ -73,7 +74,7 @@ func (p *Parser) Parse(fname string, isDir bool) error { fset := token.NewFileSet() if isDir { - packages, err := parser.ParseDir(fset, fname, nil, parser.ParseComments) + packages, err := parser.ParseDir(fset, fname, excludeTestFiles, parser.ParseComments) if err != nil { return err } @@ -96,3 +97,7 @@ func getDefaultGoPath() (string, error) { output, err := exec.Command("go", "env", "GOPATH").Output() return string(bytes.TrimSpace(output)), err } + +func excludeTestFiles(fi os.FileInfo) bool { + return !strings.HasSuffix(fi.Name(), "_test.go") +} From 6b5a421538be65f52b65f759e7cef27d749dd6fc Mon Sep 17 00:00:00 2001 From: Aleksandr Petrukhin Date: Wed, 3 Apr 2019 15:32:09 +0000 Subject: [PATCH 04/28] [encoder] implemented encoding.Marshaler for map keys --- gen/encoder.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gen/encoder.go b/gen/encoder.go index b2be743..037efce 100644 --- a/gen/encoder.go +++ b/gen/encoder.go @@ -223,7 +223,9 @@ func (g *Generator) genTypeEncoderNoCheck(t reflect.Type, in string, tags fieldT fmt.Fprintln(g.out, ws+" "+tmpVar+"First := true") fmt.Fprintln(g.out, ws+" for "+tmpVar+"Name, "+tmpVar+"Value := range "+in+" {") fmt.Fprintln(g.out, ws+" if "+tmpVar+"First { "+tmpVar+"First = false } else { out.RawByte(',') }") - if keyEnc != "" { + if key.Implements(reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()) { + fmt.Fprintln(g.out, ws+" "+fmt.Sprintf("out.RawText(("+tmpVar+"Name).MarshalText()"+")")) + } else if keyEnc != "" { fmt.Fprintln(g.out, ws+" "+fmt.Sprintf(keyEnc, tmpVar+"Name")) } else { if err := g.genTypeEncoder(key, tmpVar+"Name", tags, indent+2, false); err != nil { From a0e09156bbed0881be600fdc5cdaef85573560b0 Mon Sep 17 00:00:00 2001 From: Aleksandr Petrukhin Date: Wed, 3 Apr 2019 16:25:01 +0000 Subject: [PATCH 05/28] [decoder] implemented encoding.Marshaler for map keys --- gen/decoder.go | 8 +++++++- gen/encoder.go | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gen/decoder.go b/gen/decoder.go index 02a3dfa..ab79869 100644 --- a/gen/decoder.go +++ b/gen/decoder.go @@ -240,7 +240,13 @@ func (g *Generator) genTypeDecoderNoCheck(t reflect.Type, out string, tags field fmt.Fprintln(g.out, ws+" }") fmt.Fprintln(g.out, ws+" for !in.IsDelim('}') {") - if keyDec != "" { + // NOTE: extra check for TextUnmarshaler. It overrides default methods. + if reflect.PtrTo(key).Implements(reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()) { + fmt.Fprintln(g.out, ws+" var key "+g.getType(key)) + fmt.Fprintln(g.out, ws+"if data := in.UnsafeBytes(); in.Ok() {") + fmt.Fprintln(g.out, ws+" in.AddError(key.UnmarshalText(data) )") + fmt.Fprintln(g.out, ws+"}") + } else if keyDec != "" { fmt.Fprintln(g.out, ws+" key := "+g.getType(key)+"("+keyDec+")") } else { fmt.Fprintln(g.out, ws+" var key "+g.getType(key)) diff --git a/gen/encoder.go b/gen/encoder.go index 037efce..5c29a8a 100644 --- a/gen/encoder.go +++ b/gen/encoder.go @@ -223,7 +223,9 @@ func (g *Generator) genTypeEncoderNoCheck(t reflect.Type, in string, tags fieldT fmt.Fprintln(g.out, ws+" "+tmpVar+"First := true") fmt.Fprintln(g.out, ws+" for "+tmpVar+"Name, "+tmpVar+"Value := range "+in+" {") fmt.Fprintln(g.out, ws+" if "+tmpVar+"First { "+tmpVar+"First = false } else { out.RawByte(',') }") - if key.Implements(reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()) { + + // NOTE: extra check for TextMarshaler. It overrides default methods. + if reflect.PtrTo(key).Implements(reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()) { fmt.Fprintln(g.out, ws+" "+fmt.Sprintf("out.RawText(("+tmpVar+"Name).MarshalText()"+")")) } else if keyEnc != "" { fmt.Fprintln(g.out, ws+" "+fmt.Sprintf(keyEnc, tmpVar+"Name")) From 7169726fa79fae1842ecc98939a87b3e572c8f7b Mon Sep 17 00:00:00 2001 From: Aleksandr Petrukhin Date: Wed, 3 Apr 2019 16:56:06 +0000 Subject: [PATCH 06/28] [tests] added tests for key text marshaler --- Makefile | 3 ++- tests/basic_test.go | 1 + tests/key_marshaler_map.go | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/key_marshaler_map.go diff --git a/Makefile b/Makefile index 18c6687..1604dfa 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ generate: root build .root/src/$(PKG)/tests/named_type.go \ .root/src/$(PKG)/tests/custom_map_key_type.go \ .root/src/$(PKG)/tests/embedded_type.go \ - .root/src/$(PKG)/tests/reference_to_pointer.go + .root/src/$(PKG)/tests/reference_to_pointer.go \ .root/bin/easyjson -all .root/src/$(PKG)/tests/data.go .root/bin/easyjson -all .root/src/$(PKG)/tests/nothing.go @@ -39,6 +39,7 @@ generate: root build .root/bin/easyjson .root/src/$(PKG)/tests/custom_map_key_type.go .root/bin/easyjson .root/src/$(PKG)/tests/embedded_type.go .root/bin/easyjson .root/src/$(PKG)/tests/reference_to_pointer.go + .root/bin/easyjson .root/src/$(PKG)/tests/key_marshaler_map.go .root/bin/easyjson -disallow_unknown_fields .root/src/$(PKG)/tests/disallow_unknown.go test: generate root diff --git a/tests/basic_test.go b/tests/basic_test.go index 3b1cc65..938add0 100644 --- a/tests/basic_test.go +++ b/tests/basic_test.go @@ -52,6 +52,7 @@ var testCases = []struct { {&intArrayStructValue, intArrayStructValueString}, {&myUInt8SliceValue, myUInt8SliceString}, {&myUInt8ArrayValue, myUInt8ArrayString}, + {&mapWithEncodingMarshaler, mapWithEncodingMarshalerString}, } func TestMarshal(t *testing.T) { diff --git a/tests/key_marshaler_map.go b/tests/key_marshaler_map.go new file mode 100644 index 0000000..e10421a --- /dev/null +++ b/tests/key_marshaler_map.go @@ -0,0 +1,20 @@ +package tests + +type KeyWithEncodingMarshaler int + +func (f KeyWithEncodingMarshaler) MarshalText() (text []byte, err error) { + return []byte("hello"), nil +} + +func (f *KeyWithEncodingMarshaler) UnmarshalText(text []byte) error { + if string(text) == "hello" { + *f = 5 + } + return nil +} + +//easyjson:json +type KeyWithEncodingMarshalers map[KeyWithEncodingMarshaler]string + +var mapWithEncodingMarshaler KeyWithEncodingMarshalers = KeyWithEncodingMarshalers{5: "hello"} +var mapWithEncodingMarshalerString = `{"hello":"hello"}` From aff6f55dba13bf861ede6d7828a9d2edb1ad1e4b Mon Sep 17 00:00:00 2001 From: SenseyeDeveloper Date: Tue, 28 May 2019 18:38:28 +0300 Subject: [PATCH 07/28] Remove unused runtime code "first" mailru/easyjson#229 --- gen/encoder.go | 39 +++++++++++++++++++++++++++------------ gen/generator.go | 13 +++++++------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/gen/encoder.go b/gen/encoder.go index 5c29a8a..ebd01f8 100644 --- a/gen/encoder.go +++ b/gen/encoder.go @@ -290,32 +290,43 @@ func (g *Generator) notEmptyCheck(t reflect.Type, v string) string { } } -func (g *Generator) genStructFieldEncoder(t reflect.Type, f reflect.StructField) error { +func (g *Generator) genStructFieldEncoder(t reflect.Type, f reflect.StructField, first bool) (bool, error) { jsonName := g.fieldNamer.GetJSONFieldName(t, f) tags := parseFieldTags(f) if tags.omit { - return nil + return first, nil } + + toggleFirst := first + noOmitEmpty := (!tags.omitEmpty && !g.omitEmpty) || tags.noOmitEmpty if noOmitEmpty { fmt.Fprintln(g.out, " {") + toggleFirst = false } else { fmt.Fprintln(g.out, " if", g.notEmptyCheck(f.Type, "in."+f.Name), "{") + // can be any in runtime, so toggleFirst stay as is + } + + if first { + fmt.Fprintf(g.out, " const prefix string = %q\n", ","+strconv.Quote(jsonName)+":") + fmt.Fprintln(g.out, " if first {") + fmt.Fprintln(g.out, " first = false") + fmt.Fprintln(g.out, " out.RawString(prefix[1:])") + fmt.Fprintln(g.out, " } else {") + fmt.Fprintln(g.out, " out.RawString(prefix)") + fmt.Fprintln(g.out, " }") + } else { + fmt.Fprintf(g.out, " const prefix string = %q\n", ","+strconv.Quote(jsonName)+":") + fmt.Fprintln(g.out, " out.RawString(prefix)") } - fmt.Fprintf(g.out, " const prefix string = %q\n", ","+strconv.Quote(jsonName)+":") - fmt.Fprintln(g.out, " if first {") - fmt.Fprintln(g.out, " first = false") - fmt.Fprintln(g.out, " out.RawString(prefix[1:])") - fmt.Fprintln(g.out, " } else {") - fmt.Fprintln(g.out, " out.RawString(prefix)") - fmt.Fprintln(g.out, " }") if err := g.genTypeEncoder(f.Type, "in."+f.Name, tags, 2, !noOmitEmpty); err != nil { - return err + return toggleFirst, err } fmt.Fprintln(g.out, " }") - return nil + return toggleFirst, nil } func (g *Generator) genEncoder(t reflect.Type) error { @@ -363,8 +374,12 @@ func (g *Generator) genStructEncoder(t reflect.Type) error { if err != nil { return fmt.Errorf("cannot generate encoder for %v: %v", t, err) } + + first := true for _, f := range fs { - if err := g.genStructFieldEncoder(t, f); err != nil { + first, err = g.genStructFieldEncoder(t, f, first) + + if err != nil { return err } } diff --git a/gen/generator.go b/gen/generator.go index 13c54c4..4a8f5a8 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -156,8 +156,9 @@ func (g *Generator) printHeader() { fmt.Println("package ", g.pkgName) fmt.Println() - byAlias := map[string]string{} - var aliases []string + byAlias := make(map[string]string, len(g.imports)) + aliases := make([]string, 0, len(g.imports)) + for path, alias := range g.imports { aliases = append(aliases, alias) byAlias[alias] = path @@ -388,9 +389,9 @@ func (DefaultFieldNamer) GetJSONFieldName(t reflect.Type, f reflect.StructField) jsonName := strings.Split(f.Tag.Get("json"), ",")[0] if jsonName != "" { return jsonName - } else { - return f.Name } + + return f.Name } // LowerCamelCaseFieldNamer @@ -454,9 +455,9 @@ func (LowerCamelCaseFieldNamer) GetJSONFieldName(t reflect.Type, f reflect.Struc jsonName := strings.Split(f.Tag.Get("json"), ",")[0] if jsonName != "" { return jsonName - } else { - return lowerFirst(f.Name) } + + return lowerFirst(f.Name) } // SnakeCaseFieldNamer implements CamelCase to snake_case conversion for fields names. From 35d79224b1c5044c4ff8424e3152ea9fe21139bb Mon Sep 17 00:00:00 2001 From: SenseyeDeveloper Date: Thu, 20 Jun 2019 13:41:30 +0300 Subject: [PATCH 08/28] remove condition "if first" when is really first from "Code generated by easyjson" --- gen/encoder.go | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/gen/encoder.go b/gen/encoder.go index ebd01f8..e86d531 100644 --- a/gen/encoder.go +++ b/gen/encoder.go @@ -126,7 +126,9 @@ func (g *Generator) genTypeEncoderNoCheck(t reflect.Type, in string, tags fieldT if enc := primitiveStringEncoders[t.Kind()]; enc != "" && tags.asString { fmt.Fprintf(g.out, ws+enc+"\n", in) return nil - } else if enc := primitiveEncoders[t.Kind()]; enc != "" { + } + + if enc := primitiveEncoders[t.Kind()]; enc != "" { fmt.Fprintf(g.out, ws+enc+"\n", in) return nil } @@ -290,43 +292,50 @@ func (g *Generator) notEmptyCheck(t reflect.Type, v string) string { } } -func (g *Generator) genStructFieldEncoder(t reflect.Type, f reflect.StructField, first bool) (bool, error) { +func (g *Generator) genStructFieldEncoder(t reflect.Type, f reflect.StructField, first, firstCondition bool) (bool, error) { jsonName := g.fieldNamer.GetJSONFieldName(t, f) tags := parseFieldTags(f) if tags.omit { - return first, nil + return firstCondition, nil } - toggleFirst := first + toggleFirstCondition := firstCondition noOmitEmpty := (!tags.omitEmpty && !g.omitEmpty) || tags.noOmitEmpty if noOmitEmpty { fmt.Fprintln(g.out, " {") - toggleFirst = false + toggleFirstCondition = false } else { fmt.Fprintln(g.out, " if", g.notEmptyCheck(f.Type, "in."+f.Name), "{") - // can be any in runtime, so toggleFirst stay as is + // can be any in runtime, so toggleFirstCondition stay as is } - if first { + if firstCondition { fmt.Fprintf(g.out, " const prefix string = %q\n", ","+strconv.Quote(jsonName)+":") - fmt.Fprintln(g.out, " if first {") - fmt.Fprintln(g.out, " first = false") - fmt.Fprintln(g.out, " out.RawString(prefix[1:])") - fmt.Fprintln(g.out, " } else {") - fmt.Fprintln(g.out, " out.RawString(prefix)") - fmt.Fprintln(g.out, " }") + if first { + if !noOmitEmpty { + fmt.Fprintln(g.out, " first = false") + } + fmt.Fprintln(g.out, " out.RawString(prefix[1:])") + } else { + fmt.Fprintln(g.out, " if first {") + fmt.Fprintln(g.out, " first = false") + fmt.Fprintln(g.out, " out.RawString(prefix[1:])") + fmt.Fprintln(g.out, " } else {") + fmt.Fprintln(g.out, " out.RawString(prefix)") + fmt.Fprintln(g.out, " }") + } } else { fmt.Fprintf(g.out, " const prefix string = %q\n", ","+strconv.Quote(jsonName)+":") fmt.Fprintln(g.out, " out.RawString(prefix)") } if err := g.genTypeEncoder(f.Type, "in."+f.Name, tags, 2, !noOmitEmpty); err != nil { - return toggleFirst, err + return toggleFirstCondition, err } fmt.Fprintln(g.out, " }") - return toggleFirst, nil + return toggleFirstCondition, nil } func (g *Generator) genEncoder(t reflect.Type) error { @@ -375,9 +384,9 @@ func (g *Generator) genStructEncoder(t reflect.Type) error { return fmt.Errorf("cannot generate encoder for %v: %v", t, err) } - first := true - for _, f := range fs { - first, err = g.genStructFieldEncoder(t, f, first) + firstCondition := true + for i, f := range fs { + firstCondition, err = g.genStructFieldEncoder(t, f, i == 0, firstCondition) if err != nil { return err From b2ccc519800e761ac8000b95e5d57c80a897ff9e Mon Sep 17 00:00:00 2001 From: Vasily Romanov Date: Wed, 26 Jun 2019 12:21:58 +0300 Subject: [PATCH 09/28] added info about main package --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7fd7686..3bdcf2d 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,9 @@ for more information. typically for many uses/protocols the final, marshaled length of the JSON needs to be known prior to sending the data. Currently this is not possible with easyjson's architecture. + +* easyjson parser and codegen based on reflection, so it wont works on `package main` + files, because they cant be imported by parser. ## Benchmarks From e7194680058e86234b2dfe4e92223e084290207b Mon Sep 17 00:00:00 2001 From: Bogdan D Date: Thu, 8 Aug 2019 13:08:02 +0300 Subject: [PATCH 10/28] fix panic divide by zero --- gen/decoder.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gen/decoder.go b/gen/decoder.go index ab79869..6a1cbd1 100644 --- a/gen/decoder.go +++ b/gen/decoder.go @@ -124,9 +124,9 @@ func (g *Generator) genTypeDecoderNoCheck(t reflect.Type, out string, tags field } else { - capacity := minSliceBytes / elem.Size() - if capacity == 0 { - capacity = 1 + capacity := 1 + if elem.Size() > 0 { + capacity = minSliceBytes / int(elem.Size()) } fmt.Fprintln(g.out, ws+"if in.IsNull() {") From dde7f5d74853b5f8a5936f3d00f9e8e469852d9a Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Thu, 29 Aug 2019 18:26:29 +0300 Subject: [PATCH 11/28] use go modules --- .travis.yml | 9 ++++-- Makefile | 84 ++++++++++++++++++++++-------------------------- benchmark/go.mod | 12 +++++++ benchmark/go.sum | 21 ++++++++++++ go.mod | 3 ++ 5 files changed, 80 insertions(+), 49 deletions(-) create mode 100644 benchmark/go.mod create mode 100644 benchmark/go.sum create mode 100644 go.mod diff --git a/.travis.yml b/.travis.yml index 7789141..0ececa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,11 @@ language: go go: - tip + - stable + +matrix: + allow_failures: + - go: tip + install: - - go get github.com/ugorji/go/codec - - go get github.com/pquerna/ffjson/fflib/v1 - - go get github.com/json-iterator/go - go get golang.org/x/lint/golint diff --git a/Makefile b/Makefile index 1604dfa..2938f0f 100644 --- a/Makefile +++ b/Makefile @@ -1,64 +1,56 @@ -PKG=github.com/mailru/easyjson -GOPATH:=$(PWD)/.root:$(GOPATH) -export GOPATH - all: test -.root/src/$(PKG): - mkdir -p $@ - for i in $$PWD/* ; do ln -s $$i $@/`basename $$i` ; done - -root: .root/src/$(PKG) - clean: rm -rf .root rm -rf tests/*_easyjson.go + rm -rf benchmark/*_easyjson.go build: - go build -i -o .root/bin/easyjson $(PKG)/easyjson + go build -i -o .root/bin/easyjson ./easyjson -generate: root build +generate: build .root/bin/easyjson -stubs \ - .root/src/$(PKG)/tests/snake.go \ - .root/src/$(PKG)/tests/data.go \ - .root/src/$(PKG)/tests/omitempty.go \ - .root/src/$(PKG)/tests/nothing.go \ - .root/src/$(PKG)/tests/named_type.go \ - .root/src/$(PKG)/tests/custom_map_key_type.go \ - .root/src/$(PKG)/tests/embedded_type.go \ - .root/src/$(PKG)/tests/reference_to_pointer.go \ + ./tests/snake.go \ + ./tests/data.go \ + ./tests/omitempty.go \ + ./tests/nothing.go \ + ./tests/named_type.go \ + ./tests/custom_map_key_type.go \ + ./tests/embedded_type.go \ + ./tests/reference_to_pointer.go \ - .root/bin/easyjson -all .root/src/$(PKG)/tests/data.go - .root/bin/easyjson -all .root/src/$(PKG)/tests/nothing.go - .root/bin/easyjson -all .root/src/$(PKG)/tests/errors.go - .root/bin/easyjson -snake_case .root/src/$(PKG)/tests/snake.go - .root/bin/easyjson -omit_empty .root/src/$(PKG)/tests/omitempty.go - .root/bin/easyjson -build_tags=use_easyjson .root/src/$(PKG)/benchmark/data.go - .root/bin/easyjson .root/src/$(PKG)/tests/nested_easy.go - .root/bin/easyjson .root/src/$(PKG)/tests/named_type.go - .root/bin/easyjson .root/src/$(PKG)/tests/custom_map_key_type.go - .root/bin/easyjson .root/src/$(PKG)/tests/embedded_type.go - .root/bin/easyjson .root/src/$(PKG)/tests/reference_to_pointer.go - .root/bin/easyjson .root/src/$(PKG)/tests/key_marshaler_map.go - .root/bin/easyjson -disallow_unknown_fields .root/src/$(PKG)/tests/disallow_unknown.go + .root/bin/easyjson -all ./tests/data.go + .root/bin/easyjson -all ./tests/nothing.go + .root/bin/easyjson -all ./tests/errors.go + .root/bin/easyjson -snake_case ./tests/snake.go + .root/bin/easyjson -omit_empty ./tests/omitempty.go + .root/bin/easyjson -build_tags=use_easyjson ./benchmark/data.go + .root/bin/easyjson ./tests/nested_easy.go + .root/bin/easyjson ./tests/named_type.go + .root/bin/easyjson ./tests/custom_map_key_type.go + .root/bin/easyjson ./tests/embedded_type.go + .root/bin/easyjson ./tests/reference_to_pointer.go + .root/bin/easyjson ./tests/key_marshaler_map.go + .root/bin/easyjson -disallow_unknown_fields ./tests/disallow_unknown.go -test: generate root +test: generate go test \ - $(PKG)/tests \ - $(PKG)/jlexer \ - $(PKG)/gen \ - $(PKG)/buffer - go test -benchmem -tags use_easyjson -bench . $(PKG)/benchmark - golint -set_exit_status .root/src/$(PKG)/tests/*_easyjson.go + ./tests \ + ./jlexer \ + ./gen \ + ./buffer + cd benchmark && go test -benchmem -tags use_easyjson -bench . + golint -set_exit_status ./tests/*_easyjson.go -bench-other: generate root - @go test -benchmem -bench . $(PKG)/benchmark - @go test -benchmem -tags use_ffjson -bench . $(PKG)/benchmark - @go test -benchmem -tags use_jsoniter -bench . $(PKG)/benchmark - @go test -benchmem -tags use_codec -bench . $(PKG)/benchmark +bench-other: generate + cd benchmark + @go test -benchmem -bench . + @go test -benchmem -tags use_ffjson -bench . + @go test -benchmem -tags use_jsoniter -bench . + @go test -benchmem -tags use_codec -bench . bench-python: benchmark/ujson.sh -.PHONY: root clean generate test build +.PHONY: clean generate test build diff --git a/benchmark/go.mod b/benchmark/go.mod new file mode 100644 index 0000000..72e3fdf --- /dev/null +++ b/benchmark/go.mod @@ -0,0 +1,12 @@ +module github.com/mailru/easyjson/benchmark + +go 1.12 + +require ( + github.com/json-iterator/go v1.1.7 + github.com/mailru/easyjson v0.0.0 + github.com/pquerna/ffjson v0.0.0-20190813045741-dac163c6c0a9 + github.com/ugorji/go/codec v1.1.7 +) + +replace github.com/mailru/easyjson => ../ diff --git a/benchmark/go.sum b/benchmark/go.sum new file mode 100644 index 0000000..f2a0ff9 --- /dev/null +++ b/benchmark/go.sum @@ -0,0 +1,21 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +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/pquerna/ffjson v0.0.0-20190813045741-dac163c6c0a9 h1:kyf9snWXHvQc+yxE9imhdI8YAm4oKeZISlaAR+x73zs= +github.com/pquerna/ffjson v0.0.0-20190813045741-dac163c6c0a9/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..7bc4a65 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/mailru/easyjson + +go 1.12 From aef59a06fb52526b624d368de66dd1fcfbbe0d42 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Thu, 29 Aug 2019 18:48:49 +0300 Subject: [PATCH 12/28] fix bench-other * Update bench-other make command * Update benchmark dependencies * Re-generate data_{codec,ffjson}.go as they were broken --- Makefile | 6 +- benchmark/Makefile | 5 + benchmark/data_codec.go | 9890 ++++++++++++++------------------------ benchmark/data_ffjson.go | 4072 ++++++++-------- benchmark/go.mod | 2 + benchmark/go.sum | 10 + benchmark/tools.go | 7 + 7 files changed, 5595 insertions(+), 8397 deletions(-) create mode 100644 benchmark/Makefile create mode 100644 benchmark/tools.go diff --git a/Makefile b/Makefile index 2938f0f..f484d04 100644 --- a/Makefile +++ b/Makefile @@ -43,11 +43,7 @@ test: generate golint -set_exit_status ./tests/*_easyjson.go bench-other: generate - cd benchmark - @go test -benchmem -bench . - @go test -benchmem -tags use_ffjson -bench . - @go test -benchmem -tags use_jsoniter -bench . - @go test -benchmem -tags use_codec -bench . + cd benchmark && make bench-python: benchmark/ujson.sh diff --git a/benchmark/Makefile b/benchmark/Makefile new file mode 100644 index 0000000..f82be07 --- /dev/null +++ b/benchmark/Makefile @@ -0,0 +1,5 @@ +all: + go test -benchmem -bench . + go test -benchmem -tags use_ffjson -bench . + go test -benchmem -tags use_jsoniter -bench . + go test -benchmem -tags use_codec -bench . diff --git a/benchmark/data_codec.go b/benchmark/data_codec.go index d2d83fa..ffb09fc 100644 --- a/benchmark/data_codec.go +++ b/benchmark/data_codec.go @@ -1,310 +1,163 @@ -//+build use_codec -//+build !easyjson_nounsafe -//+build !appengine +// +build go1.6 +// +build use_codec +// +build !easyjson_nounsafe +// +build !appengine -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED BY codecgen. -// ************************************************************ +// Code generated by codecgen - DO NOT EDIT. package benchmark import ( "errors" - "fmt" - "reflect" - "runtime" - "unsafe" - codec1978 "github.com/ugorji/go/codec" + "runtime" + "strconv" ) const ( // ----- content types ---- - codecSelferC_UTF89225 = 1 - codecSelferC_RAW9225 = 0 + codecSelferCcUTF82736 = 1 + codecSelferCcRAW2736 = 255 // ----- value types used ---- - codecSelferValueTypeArray9225 = 10 - codecSelferValueTypeMap9225 = 9 - // ----- containerStateValues ---- - codecSelfer_containerMapKey9225 = 2 - codecSelfer_containerMapValue9225 = 3 - codecSelfer_containerMapEnd9225 = 4 - codecSelfer_containerArrayElem9225 = 6 - codecSelfer_containerArrayEnd9225 = 7 + codecSelferValueTypeArray2736 = 10 + codecSelferValueTypeMap2736 = 9 + codecSelferValueTypeString2736 = 6 + codecSelferValueTypeInt2736 = 2 + codecSelferValueTypeUint2736 = 3 + codecSelferValueTypeFloat2736 = 4 + codecSelferValueTypeNil2736 = 1 + codecSelferBitsize2736 = uint8(32 << (^uint(0) >> 63)) + codecSelferDecContainerLenNil2736 = -2147483648 ) var ( - codecSelferBitsize9225 = uint8(reflect.TypeOf(uint(0)).Bits()) - codecSelferOnlyMapOrArrayEncodeToStructErr9225 = errors.New(`only encoded map or array can be decoded into a struct`) + errCodecSelferOnlyMapOrArrayEncodeToStruct2736 = errors.New(`only encoded map or array can be decoded into a struct`) ) -type codecSelferUnsafeString9225 struct { - Data uintptr - Len int -} +type codecSelfer2736 struct{} -type codecSelfer9225 struct{} +func codecSelfer2736False() bool { return false } func init() { - if codec1978.GenVersion != 5 { + if codec1978.GenVersion != 16 { _, file, _, _ := runtime.Caller(0) - err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 5, codec1978.GenVersion, file) - panic(err) - } - if false { // reference the types, but skip this branch at build/run time - var v0 unsafe.Pointer - _ = v0 + ver := strconv.FormatInt(int64(codec1978.GenVersion), 10) + panic("codecgen version mismatch: current: 16, need " + ver + ". Re-generate file: " + file) } } func (x *SearchMetadata) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { r.EncodeNil() } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(9) + z.EncWriteArrayElem() + r.EncodeFloat64(float64(x.CompletedIn)) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.Count)) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.MaxID)) + z.EncWriteArrayElem() + r.EncodeString(string(x.MaxIDStr)) + z.EncWriteArrayElem() + r.EncodeString(string(x.NextResults)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Query)) + z.EncWriteArrayElem() + r.EncodeString(string(x.RefreshURL)) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.SinceID)) + z.EncWriteArrayElem() + r.EncodeString(string(x.SinceIDStr)) + z.EncWriteArrayEnd() } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [9]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(9) + z.EncWriteMapStart(9) + z.EncWriteMapElemKey() + r.EncodeString(`completed_in`) + z.EncWriteMapElemValue() + r.EncodeFloat64(float64(x.CompletedIn)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"count\"") } else { - yynn2 = 9 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 + r.EncodeString(`count`) } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeFloat64(float64(x.CompletedIn)) - } + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.Count)) + z.EncWriteMapElemKey() + r.EncodeString(`max_id`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.MaxID)) + z.EncWriteMapElemKey() + r.EncodeString(`max_id_str`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.MaxIDStr)) + z.EncWriteMapElemKey() + r.EncodeString(`next_results`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.NextResults)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"query\"") } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("completed_in")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeFloat64(float64(x.CompletedIn)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeInt(int64(x.Count)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeInt(int64(x.Count)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeInt(int64(x.MaxID)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("max_id")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeInt(int64(x.MaxID)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.MaxIDStr)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("max_id_str")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.MaxIDStr)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.NextResults)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("next_results")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.NextResults)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym19 := z.EncBinary() - _ = yym19 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Query)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("query")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Query)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym22 := z.EncBinary() - _ = yym22 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.RefreshURL)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("refresh_url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym23 := z.EncBinary() - _ = yym23 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.RefreshURL)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym25 := z.EncBinary() - _ = yym25 - if false { - } else { - r.EncodeInt(int64(x.SinceID)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("since_id")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym26 := z.EncBinary() - _ = yym26 - if false { - } else { - r.EncodeInt(int64(x.SinceID)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym28 := z.EncBinary() - _ = yym28 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.SinceIDStr)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("since_id_str")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym29 := z.EncBinary() - _ = yym29 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.SinceIDStr)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) + r.EncodeString(`query`) } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Query)) + z.EncWriteMapElemKey() + r.EncodeString(`refresh_url`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.RefreshURL)) + z.EncWriteMapElemKey() + r.EncodeString(`since_id`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.SinceID)) + z.EncWriteMapElemKey() + r.EncodeString(`since_id_str`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.SinceIDStr)) + z.EncWriteMapEnd() } } } func (x *SearchMetadata) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = SearchMetadata{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) + x.codecDecodeSelfFromMap(yyl2, d) } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) } } func (x *SearchMetadata) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc var yyhl3 bool = l >= 0 for yyj3 := 0; ; yyj3++ { if yyhl3 { @@ -312,473 +165,246 @@ func (x *SearchMetadata) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } else { - if r.CheckBreak() { + if z.DecCheckBreak() { break } } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() switch yys3 { case "completed_in": - if r.TryDecodeAsNil() { - x.CompletedIn = 0 - } else { - yyv4 := &x.CompletedIn - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*float64)(yyv4)) = float64(r.DecodeFloat(false)) - } - } + x.CompletedIn = (float64)(r.DecodeFloat64()) case "count": - if r.TryDecodeAsNil() { - x.Count = 0 - } else { - yyv6 := &x.Count - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*int)(yyv6)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } + x.Count = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) case "max_id": - if r.TryDecodeAsNil() { - x.MaxID = 0 - } else { - yyv8 := &x.MaxID - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*int)(yyv8)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } + x.MaxID = (int64)(r.DecodeInt64()) case "max_id_str": - if r.TryDecodeAsNil() { - x.MaxIDStr = "" - } else { - yyv10 := &x.MaxIDStr - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*string)(yyv10)) = r.DecodeString() - } - } + x.MaxIDStr = (string)(string(r.DecodeStringAsBytes())) case "next_results": - if r.TryDecodeAsNil() { - x.NextResults = "" - } else { - yyv12 := &x.NextResults - yym13 := z.DecBinary() - _ = yym13 - if false { - } else { - *((*string)(yyv12)) = r.DecodeString() - } - } + x.NextResults = (string)(string(r.DecodeStringAsBytes())) case "query": - if r.TryDecodeAsNil() { - x.Query = "" - } else { - yyv14 := &x.Query - yym15 := z.DecBinary() - _ = yym15 - if false { - } else { - *((*string)(yyv14)) = r.DecodeString() - } - } + x.Query = (string)(string(r.DecodeStringAsBytes())) case "refresh_url": - if r.TryDecodeAsNil() { - x.RefreshURL = "" - } else { - yyv16 := &x.RefreshURL - yym17 := z.DecBinary() - _ = yym17 - if false { - } else { - *((*string)(yyv16)) = r.DecodeString() - } - } + x.RefreshURL = (string)(string(r.DecodeStringAsBytes())) case "since_id": - if r.TryDecodeAsNil() { - x.SinceID = 0 - } else { - yyv18 := &x.SinceID - yym19 := z.DecBinary() - _ = yym19 - if false { - } else { - *((*int)(yyv18)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } + x.SinceID = (int64)(r.DecodeInt64()) case "since_id_str": - if r.TryDecodeAsNil() { - x.SinceIDStr = "" - } else { - yyv20 := &x.SinceIDStr - yym21 := z.DecBinary() - _ = yym21 - if false { - } else { - *((*string)(yyv20)) = r.DecodeString() - } - } + x.SinceIDStr = (string)(string(r.DecodeStringAsBytes())) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) } func (x *SearchMetadata) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj22 int - var yyb22 bool - var yyhl22 bool = l >= 0 - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb22 = r.CheckBreak() + yyb13 = z.DecCheckBreak() } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.CompletedIn = 0 + z.DecReadArrayElem() + x.CompletedIn = (float64)(r.DecodeFloat64()) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv23 := &x.CompletedIn - yym24 := z.DecBinary() - _ = yym24 - if false { - } else { - *((*float64)(yyv23)) = float64(r.DecodeFloat(false)) - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Count = 0 + z.DecReadArrayElem() + x.Count = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv25 := &x.Count - yym26 := z.DecBinary() - _ = yym26 - if false { - } else { - *((*int)(yyv25)) = int(r.DecodeInt(codecSelferBitsize9225)) - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.MaxID = 0 + z.DecReadArrayElem() + x.MaxID = (int64)(r.DecodeInt64()) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv27 := &x.MaxID - yym28 := z.DecBinary() - _ = yym28 - if false { - } else { - *((*int)(yyv27)) = int(r.DecodeInt(codecSelferBitsize9225)) - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.MaxIDStr = "" + z.DecReadArrayElem() + x.MaxIDStr = (string)(string(r.DecodeStringAsBytes())) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv29 := &x.MaxIDStr - yym30 := z.DecBinary() - _ = yym30 - if false { - } else { - *((*string)(yyv29)) = r.DecodeString() - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.NextResults = "" + z.DecReadArrayElem() + x.NextResults = (string)(string(r.DecodeStringAsBytes())) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv31 := &x.NextResults - yym32 := z.DecBinary() - _ = yym32 - if false { - } else { - *((*string)(yyv31)) = r.DecodeString() - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Query = "" + z.DecReadArrayElem() + x.Query = (string)(string(r.DecodeStringAsBytes())) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv33 := &x.Query - yym34 := z.DecBinary() - _ = yym34 - if false { - } else { - *((*string)(yyv33)) = r.DecodeString() - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.RefreshURL = "" + z.DecReadArrayElem() + x.RefreshURL = (string)(string(r.DecodeStringAsBytes())) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv35 := &x.RefreshURL - yym36 := z.DecBinary() - _ = yym36 - if false { - } else { - *((*string)(yyv35)) = r.DecodeString() - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.SinceID = 0 + z.DecReadArrayElem() + x.SinceID = (int64)(r.DecodeInt64()) + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyv37 := &x.SinceID - yym38 := z.DecBinary() - _ = yym38 - if false { - } else { - *((*int)(yyv37)) = int(r.DecodeInt(codecSelferBitsize9225)) - } + yyb13 = z.DecCheckBreak() } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + if yyb13 { + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.SinceIDStr = "" - } else { - yyv39 := &x.SinceIDStr - yym40 := z.DecBinary() - _ = yym40 - if false { - } else { - *((*string)(yyv39)) = r.DecodeString() - } - } + z.DecReadArrayElem() + x.SinceIDStr = (string)(string(r.DecodeStringAsBytes())) for { - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb22 = r.CheckBreak() + yyb13 = z.DecCheckBreak() } - if yyb22 { + if yyb13 { break } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj22-1, "") + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj13-1, "") } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) } func (x *Hashtag) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { r.EncodeNil() } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(2) + z.EncWriteArrayElem() + if x.Indices == nil { + r.EncodeNil() + } else { + z.F.EncSliceIntV(x.Indices, e) + } // end block: if x.Indices slice == nil + z.EncWriteArrayElem() + r.EncodeString(string(x.Text)) + z.EncWriteArrayEnd() } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [2]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(2) + z.EncWriteMapStart(2) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"indices\"") } else { - yynn2 = 2 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 + r.EncodeString(`indices`) } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Indices == nil { - r.EncodeNil() - } else { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - z.F.EncSliceIntV(x.Indices, false, e) - } - } + z.EncWriteMapElemValue() + if x.Indices == nil { + r.EncodeNil() } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("indices")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Indices == nil { - r.EncodeNil() - } else { - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - z.F.EncSliceIntV(x.Indices, false, e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Text)) - } + z.F.EncSliceIntV(x.Indices, e) + } // end block: if x.Indices slice == nil + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"text\"") } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("text")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Text)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) + r.EncodeString(`text`) } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Text)) + z.EncWriteMapEnd() } } } func (x *Hashtag) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = Hashtag{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) + x.codecDecodeSelfFromMap(yyl2, d) } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) } } func (x *Hashtag) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc var yyhl3 bool = l >= 0 for yyj3 := 0; ; yyj3++ { if yyhl3 { @@ -786,5256 +412,26 @@ func (x *Hashtag) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } else { - if r.CheckBreak() { + if z.DecCheckBreak() { break } } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() switch yys3 { case "indices": - if r.TryDecodeAsNil() { - x.Indices = nil - } else { - yyv4 := &x.Indices - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - z.F.DecSliceIntX(yyv4, false, d) - } - } + z.F.DecSliceIntX(&x.Indices, d) case "text": - if r.TryDecodeAsNil() { - x.Text = "" - } else { - yyv6 := &x.Text - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } + x.Text = (string)(string(r.DecodeStringAsBytes())) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) } func (x *Hashtag) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Indices = nil - } else { - yyv9 := &x.Indices - yym10 := z.DecBinary() - _ = yym10 - if false { - } else { - z.F.DecSliceIntX(yyv9, false, d) - } - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Text = "" - } else { - yyv11 := &x.Text - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*string)(yyv11)) = r.DecodeString() - } - } - for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj8-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *Entities) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) - } else { - yynn2 = 3 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Hashtags == nil { - r.EncodeNil() - } else { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - h.encSliceHashtag(([]Hashtag)(x.Hashtags), e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("hashtags")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Hashtags == nil { - r.EncodeNil() - } else { - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - h.encSliceHashtag(([]Hashtag)(x.Hashtags), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Urls == nil { - r.EncodeNil() - } else { - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - h.encSlicePtrtostring(([]*string)(x.Urls), e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("urls")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Urls == nil { - r.EncodeNil() - } else { - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - h.encSlicePtrtostring(([]*string)(x.Urls), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.UserMentions == nil { - r.EncodeNil() - } else { - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - h.encSlicePtrtostring(([]*string)(x.UserMentions), e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("user_mentions")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.UserMentions == nil { - r.EncodeNil() - } else { - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - h.encSlicePtrtostring(([]*string)(x.UserMentions), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *Entities) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *Entities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "hashtags": - if r.TryDecodeAsNil() { - x.Hashtags = nil - } else { - yyv4 := &x.Hashtags - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - h.decSliceHashtag((*[]Hashtag)(yyv4), d) - } - } - case "urls": - if r.TryDecodeAsNil() { - x.Urls = nil - } else { - yyv6 := &x.Urls - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - h.decSlicePtrtostring((*[]*string)(yyv6), d) - } - } - case "user_mentions": - if r.TryDecodeAsNil() { - x.UserMentions = nil - } else { - yyv8 := &x.UserMentions - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - h.decSlicePtrtostring((*[]*string)(yyv8), d) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *Entities) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj10 int - var yyb10 bool - var yyhl10 bool = l >= 0 - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Hashtags = nil - } else { - yyv11 := &x.Hashtags - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - h.decSliceHashtag((*[]Hashtag)(yyv11), d) - } - } - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Urls = nil - } else { - yyv13 := &x.Urls - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - h.decSlicePtrtostring((*[]*string)(yyv13), d) - } - } - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.UserMentions = nil - } else { - yyv15 := &x.UserMentions - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - h.decSlicePtrtostring((*[]*string)(yyv15), d) - } - } - for { - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj10-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *UserEntityDescription) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [1]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(1) - } else { - yynn2 = 1 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Urls == nil { - r.EncodeNil() - } else { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - h.encSlicePtrtostring(([]*string)(x.Urls), e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("urls")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Urls == nil { - r.EncodeNil() - } else { - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - h.encSlicePtrtostring(([]*string)(x.Urls), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *UserEntityDescription) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *UserEntityDescription) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "urls": - if r.TryDecodeAsNil() { - x.Urls = nil - } else { - yyv4 := &x.Urls - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - h.decSlicePtrtostring((*[]*string)(yyv4), d) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *UserEntityDescription) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj6 int - var yyb6 bool - var yyhl6 bool = l >= 0 - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Urls = nil - } else { - yyv7 := &x.Urls - yym8 := z.DecBinary() - _ = yym8 - if false { - } else { - h.decSlicePtrtostring((*[]*string)(yyv7), d) - } - } - for { - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj6-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *URL) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) - } else { - yynn2 = 3 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.ExpandedURL == nil { - r.EncodeNil() - } else { - yy4 := *x.ExpandedURL - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy4)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("expanded_url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.ExpandedURL == nil { - r.EncodeNil() - } else { - yy6 := *x.ExpandedURL - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy6)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Indices == nil { - r.EncodeNil() - } else { - yym9 := z.EncBinary() - _ = yym9 - if false { - } else { - z.F.EncSliceIntV(x.Indices, false, e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("indices")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Indices == nil { - r.EncodeNil() - } else { - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - z.F.EncSliceIntV(x.Indices, false, e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym12 := z.EncBinary() - _ = yym12 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.URL)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.URL)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *URL) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *URL) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "expanded_url": - if r.TryDecodeAsNil() { - if x.ExpandedURL != nil { - x.ExpandedURL = nil - } - } else { - if x.ExpandedURL == nil { - x.ExpandedURL = new(string) - } - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(x.ExpandedURL)) = r.DecodeString() - } - } - case "indices": - if r.TryDecodeAsNil() { - x.Indices = nil - } else { - yyv6 := &x.Indices - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - z.F.DecSliceIntX(yyv6, false, d) - } - } - case "url": - if r.TryDecodeAsNil() { - x.URL = "" - } else { - yyv8 := &x.URL - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *URL) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj10 int - var yyb10 bool - var yyhl10 bool = l >= 0 - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.ExpandedURL != nil { - x.ExpandedURL = nil - } - } else { - if x.ExpandedURL == nil { - x.ExpandedURL = new(string) - } - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*string)(x.ExpandedURL)) = r.DecodeString() - } - } - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Indices = nil - } else { - yyv13 := &x.Indices - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - z.F.DecSliceIntX(yyv13, false, d) - } - } - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.URL = "" - } else { - yyv15 := &x.URL - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*string)(yyv15)) = r.DecodeString() - } - } - for { - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj10-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *UserEntityURL) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [1]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(1) - } else { - yynn2 = 1 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Urls == nil { - r.EncodeNil() - } else { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - h.encSliceURL(([]URL)(x.Urls), e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("urls")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Urls == nil { - r.EncodeNil() - } else { - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - h.encSliceURL(([]URL)(x.Urls), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *UserEntityURL) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *UserEntityURL) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "urls": - if r.TryDecodeAsNil() { - x.Urls = nil - } else { - yyv4 := &x.Urls - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - h.decSliceURL((*[]URL)(yyv4), d) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *UserEntityURL) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj6 int - var yyb6 bool - var yyhl6 bool = l >= 0 - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Urls = nil - } else { - yyv7 := &x.Urls - yym8 := z.DecBinary() - _ = yym8 - if false { - } else { - h.decSliceURL((*[]URL)(yyv7), d) - } - } - for { - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj6-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *UserEntities) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [2]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(2) - } else { - yynn2 = 2 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy4 := &x.Description - yy4.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("description")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy6 := &x.Description - yy6.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy9 := &x.URL - yy9.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy11 := &x.URL - yy11.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *UserEntities) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *UserEntities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "description": - if r.TryDecodeAsNil() { - x.Description = UserEntityDescription{} - } else { - yyv4 := &x.Description - yyv4.CodecDecodeSelf(d) - } - case "url": - if r.TryDecodeAsNil() { - x.URL = UserEntityURL{} - } else { - yyv5 := &x.URL - yyv5.CodecDecodeSelf(d) - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *UserEntities) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj6 int - var yyb6 bool - var yyhl6 bool = l >= 0 - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Description = UserEntityDescription{} - } else { - yyv7 := &x.Description - yyv7.CodecDecodeSelf(d) - } - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.URL = UserEntityURL{} - } else { - yyv8 := &x.URL - yyv8.CodecDecodeSelf(d) - } - for { - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj6-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *User) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [39]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(39) - } else { - yynn2 = 39 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeBool(bool(x.ContributorsEnabled)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("contributors_enabled")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeBool(bool(x.ContributorsEnabled)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.CreatedAt)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("created_at")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.CreatedAt)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeBool(bool(x.DefaultProfile)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("default_profile")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeBool(bool(x.DefaultProfile)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeBool(bool(x.DefaultProfileImage)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("default_profile_image")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeBool(bool(x.DefaultProfileImage)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Description)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("description")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Description)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy19 := &x.Entities - yy19.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("entities")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy21 := &x.Entities - yy21.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym24 := z.EncBinary() - _ = yym24 - if false { - } else { - r.EncodeInt(int64(x.FavouritesCount)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("favourites_count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym25 := z.EncBinary() - _ = yym25 - if false { - } else { - r.EncodeInt(int64(x.FavouritesCount)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.FollowRequestSent == nil { - r.EncodeNil() - } else { - yy27 := *x.FollowRequestSent - yym28 := z.EncBinary() - _ = yym28 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy27)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("follow_request_sent")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.FollowRequestSent == nil { - r.EncodeNil() - } else { - yy29 := *x.FollowRequestSent - yym30 := z.EncBinary() - _ = yym30 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy29)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym32 := z.EncBinary() - _ = yym32 - if false { - } else { - r.EncodeInt(int64(x.FollowersCount)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("followers_count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym33 := z.EncBinary() - _ = yym33 - if false { - } else { - r.EncodeInt(int64(x.FollowersCount)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Following == nil { - r.EncodeNil() - } else { - yy35 := *x.Following - yym36 := z.EncBinary() - _ = yym36 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy35)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("following")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Following == nil { - r.EncodeNil() - } else { - yy37 := *x.Following - yym38 := z.EncBinary() - _ = yym38 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy37)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym40 := z.EncBinary() - _ = yym40 - if false { - } else { - r.EncodeInt(int64(x.FriendsCount)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("friends_count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym41 := z.EncBinary() - _ = yym41 - if false { - } else { - r.EncodeInt(int64(x.FriendsCount)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym43 := z.EncBinary() - _ = yym43 - if false { - } else { - r.EncodeBool(bool(x.GeoEnabled)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("geo_enabled")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym44 := z.EncBinary() - _ = yym44 - if false { - } else { - r.EncodeBool(bool(x.GeoEnabled)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym46 := z.EncBinary() - _ = yym46 - if false { - } else { - r.EncodeInt(int64(x.ID)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("id")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym47 := z.EncBinary() - _ = yym47 - if false { - } else { - r.EncodeInt(int64(x.ID)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym49 := z.EncBinary() - _ = yym49 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.IDStr)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("id_str")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym50 := z.EncBinary() - _ = yym50 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.IDStr)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym52 := z.EncBinary() - _ = yym52 - if false { - } else { - r.EncodeBool(bool(x.IsTranslator)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("is_translator")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym53 := z.EncBinary() - _ = yym53 - if false { - } else { - r.EncodeBool(bool(x.IsTranslator)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym55 := z.EncBinary() - _ = yym55 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Lang)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("lang")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym56 := z.EncBinary() - _ = yym56 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Lang)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym58 := z.EncBinary() - _ = yym58 - if false { - } else { - r.EncodeInt(int64(x.ListedCount)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("listed_count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym59 := z.EncBinary() - _ = yym59 - if false { - } else { - r.EncodeInt(int64(x.ListedCount)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym61 := z.EncBinary() - _ = yym61 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Location)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("location")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym62 := z.EncBinary() - _ = yym62 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Location)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym64 := z.EncBinary() - _ = yym64 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Name)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("name")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym65 := z.EncBinary() - _ = yym65 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Name)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Notifications == nil { - r.EncodeNil() - } else { - yy67 := *x.Notifications - yym68 := z.EncBinary() - _ = yym68 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy67)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("notifications")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Notifications == nil { - r.EncodeNil() - } else { - yy69 := *x.Notifications - yym70 := z.EncBinary() - _ = yym70 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy69)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym72 := z.EncBinary() - _ = yym72 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileBackgroundColor)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_background_color")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym73 := z.EncBinary() - _ = yym73 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileBackgroundColor)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym75 := z.EncBinary() - _ = yym75 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileBackgroundImageURL)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_background_image_url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym76 := z.EncBinary() - _ = yym76 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileBackgroundImageURL)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym78 := z.EncBinary() - _ = yym78 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileBackgroundImageURLHTTPS)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_background_image_url_https")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym79 := z.EncBinary() - _ = yym79 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileBackgroundImageURLHTTPS)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym81 := z.EncBinary() - _ = yym81 - if false { - } else { - r.EncodeBool(bool(x.ProfileBackgroundTile)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_background_tile")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym82 := z.EncBinary() - _ = yym82 - if false { - } else { - r.EncodeBool(bool(x.ProfileBackgroundTile)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym84 := z.EncBinary() - _ = yym84 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileImageURL)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_image_url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym85 := z.EncBinary() - _ = yym85 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileImageURL)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym87 := z.EncBinary() - _ = yym87 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileImageURLHTTPS)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_image_url_https")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym88 := z.EncBinary() - _ = yym88 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileImageURLHTTPS)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym90 := z.EncBinary() - _ = yym90 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileLinkColor)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_link_color")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym91 := z.EncBinary() - _ = yym91 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileLinkColor)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym93 := z.EncBinary() - _ = yym93 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileSidebarBorderColor)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_sidebar_border_color")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym94 := z.EncBinary() - _ = yym94 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileSidebarBorderColor)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym96 := z.EncBinary() - _ = yym96 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileSidebarFillColor)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_sidebar_fill_color")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym97 := z.EncBinary() - _ = yym97 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileSidebarFillColor)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym99 := z.EncBinary() - _ = yym99 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileTextColor)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_text_color")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym100 := z.EncBinary() - _ = yym100 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ProfileTextColor)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym102 := z.EncBinary() - _ = yym102 - if false { - } else { - r.EncodeBool(bool(x.ProfileUseBackgroundImage)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("profile_use_background_image")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym103 := z.EncBinary() - _ = yym103 - if false { - } else { - r.EncodeBool(bool(x.ProfileUseBackgroundImage)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym105 := z.EncBinary() - _ = yym105 - if false { - } else { - r.EncodeBool(bool(x.Protected)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("protected")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym106 := z.EncBinary() - _ = yym106 - if false { - } else { - r.EncodeBool(bool(x.Protected)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym108 := z.EncBinary() - _ = yym108 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ScreenName)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("screen_name")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym109 := z.EncBinary() - _ = yym109 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ScreenName)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym111 := z.EncBinary() - _ = yym111 - if false { - } else { - r.EncodeBool(bool(x.ShowAllInlineMedia)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("show_all_inline_media")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym112 := z.EncBinary() - _ = yym112 - if false { - } else { - r.EncodeBool(bool(x.ShowAllInlineMedia)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym114 := z.EncBinary() - _ = yym114 - if false { - } else { - r.EncodeInt(int64(x.StatusesCount)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("statuses_count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym115 := z.EncBinary() - _ = yym115 - if false { - } else { - r.EncodeInt(int64(x.StatusesCount)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym117 := z.EncBinary() - _ = yym117 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.TimeZone)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("time_zone")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym118 := z.EncBinary() - _ = yym118 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.TimeZone)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.URL == nil { - r.EncodeNil() - } else { - yy120 := *x.URL - yym121 := z.EncBinary() - _ = yym121 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy120)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("url")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.URL == nil { - r.EncodeNil() - } else { - yy122 := *x.URL - yym123 := z.EncBinary() - _ = yym123 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy122)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym125 := z.EncBinary() - _ = yym125 - if false { - } else { - r.EncodeInt(int64(x.UtcOffset)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("utc_offset")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym126 := z.EncBinary() - _ = yym126 - if false { - } else { - r.EncodeInt(int64(x.UtcOffset)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym128 := z.EncBinary() - _ = yym128 - if false { - } else { - r.EncodeBool(bool(x.Verified)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("verified")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym129 := z.EncBinary() - _ = yym129 - if false { - } else { - r.EncodeBool(bool(x.Verified)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *User) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *User) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "contributors_enabled": - if r.TryDecodeAsNil() { - x.ContributorsEnabled = false - } else { - yyv4 := &x.ContributorsEnabled - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*bool)(yyv4)) = r.DecodeBool() - } - } - case "created_at": - if r.TryDecodeAsNil() { - x.CreatedAt = "" - } else { - yyv6 := &x.CreatedAt - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "default_profile": - if r.TryDecodeAsNil() { - x.DefaultProfile = false - } else { - yyv8 := &x.DefaultProfile - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*bool)(yyv8)) = r.DecodeBool() - } - } - case "default_profile_image": - if r.TryDecodeAsNil() { - x.DefaultProfileImage = false - } else { - yyv10 := &x.DefaultProfileImage - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*bool)(yyv10)) = r.DecodeBool() - } - } - case "description": - if r.TryDecodeAsNil() { - x.Description = "" - } else { - yyv12 := &x.Description - yym13 := z.DecBinary() - _ = yym13 - if false { - } else { - *((*string)(yyv12)) = r.DecodeString() - } - } - case "entities": - if r.TryDecodeAsNil() { - x.Entities = UserEntities{} - } else { - yyv14 := &x.Entities - yyv14.CodecDecodeSelf(d) - } - case "favourites_count": - if r.TryDecodeAsNil() { - x.FavouritesCount = 0 - } else { - yyv15 := &x.FavouritesCount - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*int)(yyv15)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "follow_request_sent": - if r.TryDecodeAsNil() { - if x.FollowRequestSent != nil { - x.FollowRequestSent = nil - } - } else { - if x.FollowRequestSent == nil { - x.FollowRequestSent = new(string) - } - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*string)(x.FollowRequestSent)) = r.DecodeString() - } - } - case "followers_count": - if r.TryDecodeAsNil() { - x.FollowersCount = 0 - } else { - yyv19 := &x.FollowersCount - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*int)(yyv19)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "following": - if r.TryDecodeAsNil() { - if x.Following != nil { - x.Following = nil - } - } else { - if x.Following == nil { - x.Following = new(string) - } - yym22 := z.DecBinary() - _ = yym22 - if false { - } else { - *((*string)(x.Following)) = r.DecodeString() - } - } - case "friends_count": - if r.TryDecodeAsNil() { - x.FriendsCount = 0 - } else { - yyv23 := &x.FriendsCount - yym24 := z.DecBinary() - _ = yym24 - if false { - } else { - *((*int)(yyv23)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "geo_enabled": - if r.TryDecodeAsNil() { - x.GeoEnabled = false - } else { - yyv25 := &x.GeoEnabled - yym26 := z.DecBinary() - _ = yym26 - if false { - } else { - *((*bool)(yyv25)) = r.DecodeBool() - } - } - case "id": - if r.TryDecodeAsNil() { - x.ID = 0 - } else { - yyv27 := &x.ID - yym28 := z.DecBinary() - _ = yym28 - if false { - } else { - *((*int)(yyv27)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "id_str": - if r.TryDecodeAsNil() { - x.IDStr = "" - } else { - yyv29 := &x.IDStr - yym30 := z.DecBinary() - _ = yym30 - if false { - } else { - *((*string)(yyv29)) = r.DecodeString() - } - } - case "is_translator": - if r.TryDecodeAsNil() { - x.IsTranslator = false - } else { - yyv31 := &x.IsTranslator - yym32 := z.DecBinary() - _ = yym32 - if false { - } else { - *((*bool)(yyv31)) = r.DecodeBool() - } - } - case "lang": - if r.TryDecodeAsNil() { - x.Lang = "" - } else { - yyv33 := &x.Lang - yym34 := z.DecBinary() - _ = yym34 - if false { - } else { - *((*string)(yyv33)) = r.DecodeString() - } - } - case "listed_count": - if r.TryDecodeAsNil() { - x.ListedCount = 0 - } else { - yyv35 := &x.ListedCount - yym36 := z.DecBinary() - _ = yym36 - if false { - } else { - *((*int)(yyv35)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "location": - if r.TryDecodeAsNil() { - x.Location = "" - } else { - yyv37 := &x.Location - yym38 := z.DecBinary() - _ = yym38 - if false { - } else { - *((*string)(yyv37)) = r.DecodeString() - } - } - case "name": - if r.TryDecodeAsNil() { - x.Name = "" - } else { - yyv39 := &x.Name - yym40 := z.DecBinary() - _ = yym40 - if false { - } else { - *((*string)(yyv39)) = r.DecodeString() - } - } - case "notifications": - if r.TryDecodeAsNil() { - if x.Notifications != nil { - x.Notifications = nil - } - } else { - if x.Notifications == nil { - x.Notifications = new(string) - } - yym42 := z.DecBinary() - _ = yym42 - if false { - } else { - *((*string)(x.Notifications)) = r.DecodeString() - } - } - case "profile_background_color": - if r.TryDecodeAsNil() { - x.ProfileBackgroundColor = "" - } else { - yyv43 := &x.ProfileBackgroundColor - yym44 := z.DecBinary() - _ = yym44 - if false { - } else { - *((*string)(yyv43)) = r.DecodeString() - } - } - case "profile_background_image_url": - if r.TryDecodeAsNil() { - x.ProfileBackgroundImageURL = "" - } else { - yyv45 := &x.ProfileBackgroundImageURL - yym46 := z.DecBinary() - _ = yym46 - if false { - } else { - *((*string)(yyv45)) = r.DecodeString() - } - } - case "profile_background_image_url_https": - if r.TryDecodeAsNil() { - x.ProfileBackgroundImageURLHTTPS = "" - } else { - yyv47 := &x.ProfileBackgroundImageURLHTTPS - yym48 := z.DecBinary() - _ = yym48 - if false { - } else { - *((*string)(yyv47)) = r.DecodeString() - } - } - case "profile_background_tile": - if r.TryDecodeAsNil() { - x.ProfileBackgroundTile = false - } else { - yyv49 := &x.ProfileBackgroundTile - yym50 := z.DecBinary() - _ = yym50 - if false { - } else { - *((*bool)(yyv49)) = r.DecodeBool() - } - } - case "profile_image_url": - if r.TryDecodeAsNil() { - x.ProfileImageURL = "" - } else { - yyv51 := &x.ProfileImageURL - yym52 := z.DecBinary() - _ = yym52 - if false { - } else { - *((*string)(yyv51)) = r.DecodeString() - } - } - case "profile_image_url_https": - if r.TryDecodeAsNil() { - x.ProfileImageURLHTTPS = "" - } else { - yyv53 := &x.ProfileImageURLHTTPS - yym54 := z.DecBinary() - _ = yym54 - if false { - } else { - *((*string)(yyv53)) = r.DecodeString() - } - } - case "profile_link_color": - if r.TryDecodeAsNil() { - x.ProfileLinkColor = "" - } else { - yyv55 := &x.ProfileLinkColor - yym56 := z.DecBinary() - _ = yym56 - if false { - } else { - *((*string)(yyv55)) = r.DecodeString() - } - } - case "profile_sidebar_border_color": - if r.TryDecodeAsNil() { - x.ProfileSidebarBorderColor = "" - } else { - yyv57 := &x.ProfileSidebarBorderColor - yym58 := z.DecBinary() - _ = yym58 - if false { - } else { - *((*string)(yyv57)) = r.DecodeString() - } - } - case "profile_sidebar_fill_color": - if r.TryDecodeAsNil() { - x.ProfileSidebarFillColor = "" - } else { - yyv59 := &x.ProfileSidebarFillColor - yym60 := z.DecBinary() - _ = yym60 - if false { - } else { - *((*string)(yyv59)) = r.DecodeString() - } - } - case "profile_text_color": - if r.TryDecodeAsNil() { - x.ProfileTextColor = "" - } else { - yyv61 := &x.ProfileTextColor - yym62 := z.DecBinary() - _ = yym62 - if false { - } else { - *((*string)(yyv61)) = r.DecodeString() - } - } - case "profile_use_background_image": - if r.TryDecodeAsNil() { - x.ProfileUseBackgroundImage = false - } else { - yyv63 := &x.ProfileUseBackgroundImage - yym64 := z.DecBinary() - _ = yym64 - if false { - } else { - *((*bool)(yyv63)) = r.DecodeBool() - } - } - case "protected": - if r.TryDecodeAsNil() { - x.Protected = false - } else { - yyv65 := &x.Protected - yym66 := z.DecBinary() - _ = yym66 - if false { - } else { - *((*bool)(yyv65)) = r.DecodeBool() - } - } - case "screen_name": - if r.TryDecodeAsNil() { - x.ScreenName = "" - } else { - yyv67 := &x.ScreenName - yym68 := z.DecBinary() - _ = yym68 - if false { - } else { - *((*string)(yyv67)) = r.DecodeString() - } - } - case "show_all_inline_media": - if r.TryDecodeAsNil() { - x.ShowAllInlineMedia = false - } else { - yyv69 := &x.ShowAllInlineMedia - yym70 := z.DecBinary() - _ = yym70 - if false { - } else { - *((*bool)(yyv69)) = r.DecodeBool() - } - } - case "statuses_count": - if r.TryDecodeAsNil() { - x.StatusesCount = 0 - } else { - yyv71 := &x.StatusesCount - yym72 := z.DecBinary() - _ = yym72 - if false { - } else { - *((*int)(yyv71)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "time_zone": - if r.TryDecodeAsNil() { - x.TimeZone = "" - } else { - yyv73 := &x.TimeZone - yym74 := z.DecBinary() - _ = yym74 - if false { - } else { - *((*string)(yyv73)) = r.DecodeString() - } - } - case "url": - if r.TryDecodeAsNil() { - if x.URL != nil { - x.URL = nil - } - } else { - if x.URL == nil { - x.URL = new(string) - } - yym76 := z.DecBinary() - _ = yym76 - if false { - } else { - *((*string)(x.URL)) = r.DecodeString() - } - } - case "utc_offset": - if r.TryDecodeAsNil() { - x.UtcOffset = 0 - } else { - yyv77 := &x.UtcOffset - yym78 := z.DecBinary() - _ = yym78 - if false { - } else { - *((*int)(yyv77)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "verified": - if r.TryDecodeAsNil() { - x.Verified = false - } else { - yyv79 := &x.Verified - yym80 := z.DecBinary() - _ = yym80 - if false { - } else { - *((*bool)(yyv79)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *User) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj81 int - var yyb81 bool - var yyhl81 bool = l >= 0 - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ContributorsEnabled = false - } else { - yyv82 := &x.ContributorsEnabled - yym83 := z.DecBinary() - _ = yym83 - if false { - } else { - *((*bool)(yyv82)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.CreatedAt = "" - } else { - yyv84 := &x.CreatedAt - yym85 := z.DecBinary() - _ = yym85 - if false { - } else { - *((*string)(yyv84)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.DefaultProfile = false - } else { - yyv86 := &x.DefaultProfile - yym87 := z.DecBinary() - _ = yym87 - if false { - } else { - *((*bool)(yyv86)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.DefaultProfileImage = false - } else { - yyv88 := &x.DefaultProfileImage - yym89 := z.DecBinary() - _ = yym89 - if false { - } else { - *((*bool)(yyv88)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Description = "" - } else { - yyv90 := &x.Description - yym91 := z.DecBinary() - _ = yym91 - if false { - } else { - *((*string)(yyv90)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Entities = UserEntities{} - } else { - yyv92 := &x.Entities - yyv92.CodecDecodeSelf(d) - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.FavouritesCount = 0 - } else { - yyv93 := &x.FavouritesCount - yym94 := z.DecBinary() - _ = yym94 - if false { - } else { - *((*int)(yyv93)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.FollowRequestSent != nil { - x.FollowRequestSent = nil - } - } else { - if x.FollowRequestSent == nil { - x.FollowRequestSent = new(string) - } - yym96 := z.DecBinary() - _ = yym96 - if false { - } else { - *((*string)(x.FollowRequestSent)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.FollowersCount = 0 - } else { - yyv97 := &x.FollowersCount - yym98 := z.DecBinary() - _ = yym98 - if false { - } else { - *((*int)(yyv97)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.Following != nil { - x.Following = nil - } - } else { - if x.Following == nil { - x.Following = new(string) - } - yym100 := z.DecBinary() - _ = yym100 - if false { - } else { - *((*string)(x.Following)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.FriendsCount = 0 - } else { - yyv101 := &x.FriendsCount - yym102 := z.DecBinary() - _ = yym102 - if false { - } else { - *((*int)(yyv101)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.GeoEnabled = false - } else { - yyv103 := &x.GeoEnabled - yym104 := z.DecBinary() - _ = yym104 - if false { - } else { - *((*bool)(yyv103)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ID = 0 - } else { - yyv105 := &x.ID - yym106 := z.DecBinary() - _ = yym106 - if false { - } else { - *((*int)(yyv105)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.IDStr = "" - } else { - yyv107 := &x.IDStr - yym108 := z.DecBinary() - _ = yym108 - if false { - } else { - *((*string)(yyv107)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.IsTranslator = false - } else { - yyv109 := &x.IsTranslator - yym110 := z.DecBinary() - _ = yym110 - if false { - } else { - *((*bool)(yyv109)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Lang = "" - } else { - yyv111 := &x.Lang - yym112 := z.DecBinary() - _ = yym112 - if false { - } else { - *((*string)(yyv111)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ListedCount = 0 - } else { - yyv113 := &x.ListedCount - yym114 := z.DecBinary() - _ = yym114 - if false { - } else { - *((*int)(yyv113)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Location = "" - } else { - yyv115 := &x.Location - yym116 := z.DecBinary() - _ = yym116 - if false { - } else { - *((*string)(yyv115)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Name = "" - } else { - yyv117 := &x.Name - yym118 := z.DecBinary() - _ = yym118 - if false { - } else { - *((*string)(yyv117)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.Notifications != nil { - x.Notifications = nil - } - } else { - if x.Notifications == nil { - x.Notifications = new(string) - } - yym120 := z.DecBinary() - _ = yym120 - if false { - } else { - *((*string)(x.Notifications)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileBackgroundColor = "" - } else { - yyv121 := &x.ProfileBackgroundColor - yym122 := z.DecBinary() - _ = yym122 - if false { - } else { - *((*string)(yyv121)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileBackgroundImageURL = "" - } else { - yyv123 := &x.ProfileBackgroundImageURL - yym124 := z.DecBinary() - _ = yym124 - if false { - } else { - *((*string)(yyv123)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileBackgroundImageURLHTTPS = "" - } else { - yyv125 := &x.ProfileBackgroundImageURLHTTPS - yym126 := z.DecBinary() - _ = yym126 - if false { - } else { - *((*string)(yyv125)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileBackgroundTile = false - } else { - yyv127 := &x.ProfileBackgroundTile - yym128 := z.DecBinary() - _ = yym128 - if false { - } else { - *((*bool)(yyv127)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileImageURL = "" - } else { - yyv129 := &x.ProfileImageURL - yym130 := z.DecBinary() - _ = yym130 - if false { - } else { - *((*string)(yyv129)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileImageURLHTTPS = "" - } else { - yyv131 := &x.ProfileImageURLHTTPS - yym132 := z.DecBinary() - _ = yym132 - if false { - } else { - *((*string)(yyv131)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileLinkColor = "" - } else { - yyv133 := &x.ProfileLinkColor - yym134 := z.DecBinary() - _ = yym134 - if false { - } else { - *((*string)(yyv133)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileSidebarBorderColor = "" - } else { - yyv135 := &x.ProfileSidebarBorderColor - yym136 := z.DecBinary() - _ = yym136 - if false { - } else { - *((*string)(yyv135)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileSidebarFillColor = "" - } else { - yyv137 := &x.ProfileSidebarFillColor - yym138 := z.DecBinary() - _ = yym138 - if false { - } else { - *((*string)(yyv137)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileTextColor = "" - } else { - yyv139 := &x.ProfileTextColor - yym140 := z.DecBinary() - _ = yym140 - if false { - } else { - *((*string)(yyv139)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ProfileUseBackgroundImage = false - } else { - yyv141 := &x.ProfileUseBackgroundImage - yym142 := z.DecBinary() - _ = yym142 - if false { - } else { - *((*bool)(yyv141)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Protected = false - } else { - yyv143 := &x.Protected - yym144 := z.DecBinary() - _ = yym144 - if false { - } else { - *((*bool)(yyv143)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ScreenName = "" - } else { - yyv145 := &x.ScreenName - yym146 := z.DecBinary() - _ = yym146 - if false { - } else { - *((*string)(yyv145)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ShowAllInlineMedia = false - } else { - yyv147 := &x.ShowAllInlineMedia - yym148 := z.DecBinary() - _ = yym148 - if false { - } else { - *((*bool)(yyv147)) = r.DecodeBool() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.StatusesCount = 0 - } else { - yyv149 := &x.StatusesCount - yym150 := z.DecBinary() - _ = yym150 - if false { - } else { - *((*int)(yyv149)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.TimeZone = "" - } else { - yyv151 := &x.TimeZone - yym152 := z.DecBinary() - _ = yym152 - if false { - } else { - *((*string)(yyv151)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.URL != nil { - x.URL = nil - } - } else { - if x.URL == nil { - x.URL = new(string) - } - yym154 := z.DecBinary() - _ = yym154 - if false { - } else { - *((*string)(x.URL)) = r.DecodeString() - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.UtcOffset = 0 - } else { - yyv155 := &x.UtcOffset - yym156 := z.DecBinary() - _ = yym156 - if false { - } else { - *((*int)(yyv155)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Verified = false - } else { - yyv157 := &x.Verified - yym158 := z.DecBinary() - _ = yym158 - if false { - } else { - *((*bool)(yyv157)) = r.DecodeBool() - } - } - for { - yyj81++ - if yyhl81 { - yyb81 = yyj81 > l - } else { - yyb81 = r.CheckBreak() - } - if yyb81 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj81-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *StatusMetadata) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [2]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(2) - } else { - yynn2 = 2 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.IsoLanguageCode)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("iso_language_code")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.IsoLanguageCode)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ResultType)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("result_type")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.ResultType)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *StatusMetadata) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *StatusMetadata) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "iso_language_code": - if r.TryDecodeAsNil() { - x.IsoLanguageCode = "" - } else { - yyv4 := &x.IsoLanguageCode - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "result_type": - if r.TryDecodeAsNil() { - x.ResultType = "" - } else { - yyv6 := &x.ResultType - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *StatusMetadata) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.IsoLanguageCode = "" - } else { - yyv9 := &x.IsoLanguageCode - yym10 := z.DecBinary() - _ = yym10 - if false { - } else { - *((*string)(yyv9)) = r.DecodeString() - } - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ResultType = "" - } else { - yyv11 := &x.ResultType - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*string)(yyv11)) = r.DecodeString() - } - } - for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj8-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *Status) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [21]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(21) - } else { - yynn2 = 21 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Contributors == nil { - r.EncodeNil() - } else { - yy4 := *x.Contributors - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy4)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("contributors")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Contributors == nil { - r.EncodeNil() - } else { - yy6 := *x.Contributors - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy6)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Coordinates == nil { - r.EncodeNil() - } else { - yy9 := *x.Coordinates - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy9)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("coordinates")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Coordinates == nil { - r.EncodeNil() - } else { - yy11 := *x.Coordinates - yym12 := z.EncBinary() - _ = yym12 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy11)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.CreatedAt)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("created_at")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym15 := z.EncBinary() - _ = yym15 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.CreatedAt)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy17 := &x.Entities - yy17.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("entities")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy19 := &x.Entities - yy19.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym22 := z.EncBinary() - _ = yym22 - if false { - } else { - r.EncodeBool(bool(x.Favorited)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("favorited")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym23 := z.EncBinary() - _ = yym23 - if false { - } else { - r.EncodeBool(bool(x.Favorited)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Geo == nil { - r.EncodeNil() - } else { - yy25 := *x.Geo - yym26 := z.EncBinary() - _ = yym26 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy25)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("geo")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Geo == nil { - r.EncodeNil() - } else { - yy27 := *x.Geo - yym28 := z.EncBinary() - _ = yym28 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy27)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym30 := z.EncBinary() - _ = yym30 - if false { - } else { - r.EncodeInt(int64(x.ID)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("id")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym31 := z.EncBinary() - _ = yym31 - if false { - } else { - r.EncodeInt(int64(x.ID)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym33 := z.EncBinary() - _ = yym33 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.IDStr)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("id_str")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym34 := z.EncBinary() - _ = yym34 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.IDStr)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.InReplyToScreenName == nil { - r.EncodeNil() - } else { - yy36 := *x.InReplyToScreenName - yym37 := z.EncBinary() - _ = yym37 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy36)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("in_reply_to_screen_name")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.InReplyToScreenName == nil { - r.EncodeNil() - } else { - yy38 := *x.InReplyToScreenName - yym39 := z.EncBinary() - _ = yym39 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy38)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.InReplyToStatusID == nil { - r.EncodeNil() - } else { - yy41 := *x.InReplyToStatusID - yym42 := z.EncBinary() - _ = yym42 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy41)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("in_reply_to_status_id")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.InReplyToStatusID == nil { - r.EncodeNil() - } else { - yy43 := *x.InReplyToStatusID - yym44 := z.EncBinary() - _ = yym44 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy43)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.InReplyToStatusIDStr == nil { - r.EncodeNil() - } else { - yy46 := *x.InReplyToStatusIDStr - yym47 := z.EncBinary() - _ = yym47 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy46)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("in_reply_to_status_id_str")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.InReplyToStatusIDStr == nil { - r.EncodeNil() - } else { - yy48 := *x.InReplyToStatusIDStr - yym49 := z.EncBinary() - _ = yym49 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy48)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.InReplyToUserID == nil { - r.EncodeNil() - } else { - yy51 := *x.InReplyToUserID - yym52 := z.EncBinary() - _ = yym52 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy51)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("in_reply_to_user_id")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.InReplyToUserID == nil { - r.EncodeNil() - } else { - yy53 := *x.InReplyToUserID - yym54 := z.EncBinary() - _ = yym54 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy53)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.InReplyToUserIDStr == nil { - r.EncodeNil() - } else { - yy56 := *x.InReplyToUserIDStr - yym57 := z.EncBinary() - _ = yym57 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy56)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("in_reply_to_user_id_str")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.InReplyToUserIDStr == nil { - r.EncodeNil() - } else { - yy58 := *x.InReplyToUserIDStr - yym59 := z.EncBinary() - _ = yym59 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy58)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy61 := &x.Metadata - yy61.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("metadata")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy63 := &x.Metadata - yy63.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Place == nil { - r.EncodeNil() - } else { - yy66 := *x.Place - yym67 := z.EncBinary() - _ = yym67 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy66)) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("place")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Place == nil { - r.EncodeNil() - } else { - yy68 := *x.Place - yym69 := z.EncBinary() - _ = yym69 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy68)) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym71 := z.EncBinary() - _ = yym71 - if false { - } else { - r.EncodeInt(int64(x.RetweetCount)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("retweet_count")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym72 := z.EncBinary() - _ = yym72 - if false { - } else { - r.EncodeInt(int64(x.RetweetCount)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym74 := z.EncBinary() - _ = yym74 - if false { - } else { - r.EncodeBool(bool(x.Retweeted)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("retweeted")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym75 := z.EncBinary() - _ = yym75 - if false { - } else { - r.EncodeBool(bool(x.Retweeted)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym77 := z.EncBinary() - _ = yym77 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Source)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("source")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym78 := z.EncBinary() - _ = yym78 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Source)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym80 := z.EncBinary() - _ = yym80 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Text)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("text")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym81 := z.EncBinary() - _ = yym81 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(x.Text)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yym83 := z.EncBinary() - _ = yym83 - if false { - } else { - r.EncodeBool(bool(x.Truncated)) - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("truncated")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yym84 := z.EncBinary() - _ = yym84 - if false { - } else { - r.EncodeBool(bool(x.Truncated)) - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy86 := &x.User - yy86.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("user")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy88 := &x.User - yy88.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *Status) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *Status) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "contributors": - if r.TryDecodeAsNil() { - if x.Contributors != nil { - x.Contributors = nil - } - } else { - if x.Contributors == nil { - x.Contributors = new(string) - } - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(x.Contributors)) = r.DecodeString() - } - } - case "coordinates": - if r.TryDecodeAsNil() { - if x.Coordinates != nil { - x.Coordinates = nil - } - } else { - if x.Coordinates == nil { - x.Coordinates = new(string) - } - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(x.Coordinates)) = r.DecodeString() - } - } - case "created_at": - if r.TryDecodeAsNil() { - x.CreatedAt = "" - } else { - yyv8 := &x.CreatedAt - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - case "entities": - if r.TryDecodeAsNil() { - x.Entities = Entities{} - } else { - yyv10 := &x.Entities - yyv10.CodecDecodeSelf(d) - } - case "favorited": - if r.TryDecodeAsNil() { - x.Favorited = false - } else { - yyv11 := &x.Favorited - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*bool)(yyv11)) = r.DecodeBool() - } - } - case "geo": - if r.TryDecodeAsNil() { - if x.Geo != nil { - x.Geo = nil - } - } else { - if x.Geo == nil { - x.Geo = new(string) - } - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*string)(x.Geo)) = r.DecodeString() - } - } - case "id": - if r.TryDecodeAsNil() { - x.ID = 0 - } else { - yyv15 := &x.ID - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*int64)(yyv15)) = int64(r.DecodeInt(64)) - } - } - case "id_str": - if r.TryDecodeAsNil() { - x.IDStr = "" - } else { - yyv17 := &x.IDStr - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*string)(yyv17)) = r.DecodeString() - } - } - case "in_reply_to_screen_name": - if r.TryDecodeAsNil() { - if x.InReplyToScreenName != nil { - x.InReplyToScreenName = nil - } - } else { - if x.InReplyToScreenName == nil { - x.InReplyToScreenName = new(string) - } - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*string)(x.InReplyToScreenName)) = r.DecodeString() - } - } - case "in_reply_to_status_id": - if r.TryDecodeAsNil() { - if x.InReplyToStatusID != nil { - x.InReplyToStatusID = nil - } - } else { - if x.InReplyToStatusID == nil { - x.InReplyToStatusID = new(string) - } - yym22 := z.DecBinary() - _ = yym22 - if false { - } else { - *((*string)(x.InReplyToStatusID)) = r.DecodeString() - } - } - case "in_reply_to_status_id_str": - if r.TryDecodeAsNil() { - if x.InReplyToStatusIDStr != nil { - x.InReplyToStatusIDStr = nil - } - } else { - if x.InReplyToStatusIDStr == nil { - x.InReplyToStatusIDStr = new(string) - } - yym24 := z.DecBinary() - _ = yym24 - if false { - } else { - *((*string)(x.InReplyToStatusIDStr)) = r.DecodeString() - } - } - case "in_reply_to_user_id": - if r.TryDecodeAsNil() { - if x.InReplyToUserID != nil { - x.InReplyToUserID = nil - } - } else { - if x.InReplyToUserID == nil { - x.InReplyToUserID = new(string) - } - yym26 := z.DecBinary() - _ = yym26 - if false { - } else { - *((*string)(x.InReplyToUserID)) = r.DecodeString() - } - } - case "in_reply_to_user_id_str": - if r.TryDecodeAsNil() { - if x.InReplyToUserIDStr != nil { - x.InReplyToUserIDStr = nil - } - } else { - if x.InReplyToUserIDStr == nil { - x.InReplyToUserIDStr = new(string) - } - yym28 := z.DecBinary() - _ = yym28 - if false { - } else { - *((*string)(x.InReplyToUserIDStr)) = r.DecodeString() - } - } - case "metadata": - if r.TryDecodeAsNil() { - x.Metadata = StatusMetadata{} - } else { - yyv29 := &x.Metadata - yyv29.CodecDecodeSelf(d) - } - case "place": - if r.TryDecodeAsNil() { - if x.Place != nil { - x.Place = nil - } - } else { - if x.Place == nil { - x.Place = new(string) - } - yym31 := z.DecBinary() - _ = yym31 - if false { - } else { - *((*string)(x.Place)) = r.DecodeString() - } - } - case "retweet_count": - if r.TryDecodeAsNil() { - x.RetweetCount = 0 - } else { - yyv32 := &x.RetweetCount - yym33 := z.DecBinary() - _ = yym33 - if false { - } else { - *((*int)(yyv32)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - case "retweeted": - if r.TryDecodeAsNil() { - x.Retweeted = false - } else { - yyv34 := &x.Retweeted - yym35 := z.DecBinary() - _ = yym35 - if false { - } else { - *((*bool)(yyv34)) = r.DecodeBool() - } - } - case "source": - if r.TryDecodeAsNil() { - x.Source = "" - } else { - yyv36 := &x.Source - yym37 := z.DecBinary() - _ = yym37 - if false { - } else { - *((*string)(yyv36)) = r.DecodeString() - } - } - case "text": - if r.TryDecodeAsNil() { - x.Text = "" - } else { - yyv38 := &x.Text - yym39 := z.DecBinary() - _ = yym39 - if false { - } else { - *((*string)(yyv38)) = r.DecodeString() - } - } - case "truncated": - if r.TryDecodeAsNil() { - x.Truncated = false - } else { - yyv40 := &x.Truncated - yym41 := z.DecBinary() - _ = yym41 - if false { - } else { - *((*bool)(yyv40)) = r.DecodeBool() - } - } - case "user": - if r.TryDecodeAsNil() { - x.User = User{} - } else { - yyv42 := &x.User - yyv42.CodecDecodeSelf(d) - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *Status) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj43 int - var yyb43 bool - var yyhl43 bool = l >= 0 - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.Contributors != nil { - x.Contributors = nil - } - } else { - if x.Contributors == nil { - x.Contributors = new(string) - } - yym45 := z.DecBinary() - _ = yym45 - if false { - } else { - *((*string)(x.Contributors)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.Coordinates != nil { - x.Coordinates = nil - } - } else { - if x.Coordinates == nil { - x.Coordinates = new(string) - } - yym47 := z.DecBinary() - _ = yym47 - if false { - } else { - *((*string)(x.Coordinates)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.CreatedAt = "" - } else { - yyv48 := &x.CreatedAt - yym49 := z.DecBinary() - _ = yym49 - if false { - } else { - *((*string)(yyv48)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Entities = Entities{} - } else { - yyv50 := &x.Entities - yyv50.CodecDecodeSelf(d) - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Favorited = false - } else { - yyv51 := &x.Favorited - yym52 := z.DecBinary() - _ = yym52 - if false { - } else { - *((*bool)(yyv51)) = r.DecodeBool() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.Geo != nil { - x.Geo = nil - } - } else { - if x.Geo == nil { - x.Geo = new(string) - } - yym54 := z.DecBinary() - _ = yym54 - if false { - } else { - *((*string)(x.Geo)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.ID = 0 - } else { - yyv55 := &x.ID - yym56 := z.DecBinary() - _ = yym56 - if false { - } else { - *((*int64)(yyv55)) = int64(r.DecodeInt(64)) - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.IDStr = "" - } else { - yyv57 := &x.IDStr - yym58 := z.DecBinary() - _ = yym58 - if false { - } else { - *((*string)(yyv57)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.InReplyToScreenName != nil { - x.InReplyToScreenName = nil - } - } else { - if x.InReplyToScreenName == nil { - x.InReplyToScreenName = new(string) - } - yym60 := z.DecBinary() - _ = yym60 - if false { - } else { - *((*string)(x.InReplyToScreenName)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.InReplyToStatusID != nil { - x.InReplyToStatusID = nil - } - } else { - if x.InReplyToStatusID == nil { - x.InReplyToStatusID = new(string) - } - yym62 := z.DecBinary() - _ = yym62 - if false { - } else { - *((*string)(x.InReplyToStatusID)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.InReplyToStatusIDStr != nil { - x.InReplyToStatusIDStr = nil - } - } else { - if x.InReplyToStatusIDStr == nil { - x.InReplyToStatusIDStr = new(string) - } - yym64 := z.DecBinary() - _ = yym64 - if false { - } else { - *((*string)(x.InReplyToStatusIDStr)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.InReplyToUserID != nil { - x.InReplyToUserID = nil - } - } else { - if x.InReplyToUserID == nil { - x.InReplyToUserID = new(string) - } - yym66 := z.DecBinary() - _ = yym66 - if false { - } else { - *((*string)(x.InReplyToUserID)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.InReplyToUserIDStr != nil { - x.InReplyToUserIDStr = nil - } - } else { - if x.InReplyToUserIDStr == nil { - x.InReplyToUserIDStr = new(string) - } - yym68 := z.DecBinary() - _ = yym68 - if false { - } else { - *((*string)(x.InReplyToUserIDStr)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Metadata = StatusMetadata{} - } else { - yyv69 := &x.Metadata - yyv69.CodecDecodeSelf(d) - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - if x.Place != nil { - x.Place = nil - } - } else { - if x.Place == nil { - x.Place = new(string) - } - yym71 := z.DecBinary() - _ = yym71 - if false { - } else { - *((*string)(x.Place)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.RetweetCount = 0 - } else { - yyv72 := &x.RetweetCount - yym73 := z.DecBinary() - _ = yym73 - if false { - } else { - *((*int)(yyv72)) = int(r.DecodeInt(codecSelferBitsize9225)) - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Retweeted = false - } else { - yyv74 := &x.Retweeted - yym75 := z.DecBinary() - _ = yym75 - if false { - } else { - *((*bool)(yyv74)) = r.DecodeBool() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Source = "" - } else { - yyv76 := &x.Source - yym77 := z.DecBinary() - _ = yym77 - if false { - } else { - *((*string)(yyv76)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Text = "" - } else { - yyv78 := &x.Text - yym79 := z.DecBinary() - _ = yym79 - if false { - } else { - *((*string)(yyv78)) = r.DecodeString() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Truncated = false - } else { - yyv80 := &x.Truncated - yym81 := z.DecBinary() - _ = yym81 - if false { - } else { - *((*bool)(yyv80)) = r.DecodeBool() - } - } - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.User = User{} - } else { - yyv82 := &x.User - yyv82.CodecDecodeSelf(d) - } - for { - yyj43++ - if yyhl43 { - yyb43 = yyj43 > l - } else { - yyb43 = r.CheckBreak() - } - if yyb43 { - break - } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - z.DecStructFieldNotFound(yyj43-1, "") - } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) -} - -func (x *LargeStruct) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [2]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(2) - } else { - yynn2 = 2 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - yy4 := &x.SearchMetadata - yy4.CodecEncodeSelf(e) - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("search_metadata")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - yy6 := &x.SearchMetadata - yy6.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Statuses == nil { - r.EncodeNil() - } else { - yym9 := z.EncBinary() - _ = yym9 - if false { - } else { - h.encSliceStatus(([]Status)(x.Statuses), e) - } - } - } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("statuses")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Statuses == nil { - r.EncodeNil() - } else { - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - h.encSliceStatus(([]Status)(x.Statuses), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) - } - } - } -} - -func (x *LargeStruct) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } - } -} - -func (x *LargeStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) - switch yys3 { - case "search_metadata": - if r.TryDecodeAsNil() { - x.SearchMetadata = SearchMetadata{} - } else { - yyv4 := &x.SearchMetadata - yyv4.CodecDecodeSelf(d) - } - case "statuses": - if r.TryDecodeAsNil() { - x.Statuses = nil - } else { - yyv5 := &x.Statuses - yym6 := z.DecBinary() - _ = yym6 - if false { - } else { - h.decSliceStatus((*[]Status)(yyv5), d) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) -} - -func (x *LargeStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj7 int @@ -6045,159 +441,141 @@ func (x *LargeStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if yyhl7 { yyb7 = yyj7 > l } else { - yyb7 = r.CheckBreak() + yyb7 = z.DecCheckBreak() } if yyb7 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.SearchMetadata = SearchMetadata{} - } else { - yyv8 := &x.SearchMetadata - yyv8.CodecDecodeSelf(d) - } + z.DecReadArrayElem() + z.F.DecSliceIntX(&x.Indices, d) yyj7++ if yyhl7 { yyb7 = yyj7 > l } else { - yyb7 = r.CheckBreak() + yyb7 = z.DecCheckBreak() } if yyb7 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Statuses = nil - } else { - yyv9 := &x.Statuses - yym10 := z.DecBinary() - _ = yym10 - if false { - } else { - h.decSliceStatus((*[]Status)(yyv9), d) - } - } + z.DecReadArrayElem() + x.Text = (string)(string(r.DecodeStringAsBytes())) for { yyj7++ if yyhl7 { yyb7 = yyj7 > l } else { - yyb7 = r.CheckBreak() + yyb7 = z.DecCheckBreak() } if yyb7 { break } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) + z.DecReadArrayElem() z.DecStructFieldNotFound(yyj7-1, "") } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) } -func (x *XLStruct) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer9225 +func (x *Entities) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { r.EncodeNil() } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(3) + z.EncWriteArrayElem() + if x.Hashtags == nil { + r.EncodeNil() + } else { + h.encSliceHashtag(([]Hashtag)(x.Hashtags), e) + } // end block: if x.Hashtags slice == nil + z.EncWriteArrayElem() + if x.Urls == nil { + r.EncodeNil() + } else { + h.encSlicePtrtostring(([]*string)(x.Urls), e) + } // end block: if x.Urls slice == nil + z.EncWriteArrayElem() + if x.UserMentions == nil { + r.EncodeNil() + } else { + h.encSlicePtrtostring(([]*string)(x.UserMentions), e) + } // end block: if x.UserMentions slice == nil + z.EncWriteArrayEnd() } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [1]bool - _, _, _ = yysep2, yyq2, yy2arr2 - const yyr2 bool = false - var yynn2 int - if yyr2 || yy2arr2 { - r.EncodeArrayStart(1) + z.EncWriteMapStart(3) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"hashtags\"") } else { - yynn2 = 1 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 + r.EncodeString(`hashtags`) } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) - if x.Data == nil { - r.EncodeNil() - } else { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - h.encSliceLargeStruct(([]LargeStruct)(x.Data), e) - } - } + z.EncWriteMapElemValue() + if x.Hashtags == nil { + r.EncodeNil() } else { - z.EncSendContainerState(codecSelfer_containerMapKey9225) - r.EncodeString(codecSelferC_UTF89225, string("Data")) - z.EncSendContainerState(codecSelfer_containerMapValue9225) - if x.Data == nil { - r.EncodeNil() - } else { - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - h.encSliceLargeStruct(([]LargeStruct)(x.Data), e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) + h.encSliceHashtag(([]Hashtag)(x.Hashtags), e) + } // end block: if x.Hashtags slice == nil + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"urls\"") } else { - z.EncSendContainerState(codecSelfer_containerMapEnd9225) + r.EncodeString(`urls`) } + z.EncWriteMapElemValue() + if x.Urls == nil { + r.EncodeNil() + } else { + h.encSlicePtrtostring(([]*string)(x.Urls), e) + } // end block: if x.Urls slice == nil + z.EncWriteMapElemKey() + r.EncodeString(`user_mentions`) + z.EncWriteMapElemValue() + if x.UserMentions == nil { + r.EncodeNil() + } else { + h.encSlicePtrtostring(([]*string)(x.UserMentions), e) + } // end block: if x.UserMentions slice == nil + z.EncWriteMapEnd() } } } -func (x *XLStruct) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer9225 +func (x *Entities) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = Entities{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap9225 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd9225) - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray9225 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr9225) - } + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) } } -func (x *XLStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x *Entities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc var yyhl3 bool = l >= 0 for yyj3 := 0; ; yyj3++ { if yyhl3 { @@ -6205,37 +583,177 @@ func (x *XLStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } else { - if r.CheckBreak() { + if z.DecCheckBreak() { break } } - z.DecSendContainerState(codecSelfer_containerMapKey9225) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) - yys3SlcHdr := codecSelferUnsafeString9225{uintptr(unsafe.Pointer(&yys3Slc[0])), len(yys3Slc)} - yys3 := *(*string)(unsafe.Pointer(&yys3SlcHdr)) - z.DecSendContainerState(codecSelfer_containerMapValue9225) + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() switch yys3 { - case "Data": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv4 := &x.Data - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - h.decSliceLargeStruct((*[]LargeStruct)(yyv4), d) - } - } + case "hashtags": + h.decSliceHashtag((*[]Hashtag)(&x.Hashtags), d) + case "urls": + h.decSlicePtrtostring((*[]*string)(&x.Urls), d) + case "user_mentions": + h.decSlicePtrtostring((*[]*string)(&x.UserMentions), d) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd9225) } -func (x *XLStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x *Entities) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = z.DecCheckBreak() + } + if yyb10 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + h.decSliceHashtag((*[]Hashtag)(&x.Hashtags), d) + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = z.DecCheckBreak() + } + if yyb10 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + h.decSlicePtrtostring((*[]*string)(&x.Urls), d) + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = z.DecCheckBreak() + } + if yyb10 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + h.decSlicePtrtostring((*[]*string)(&x.UserMentions), d) + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = z.DecCheckBreak() + } + if yyb10 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj10-1, "") + } +} + +func (x *UserEntityDescription) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(1) + z.EncWriteArrayElem() + if x.Urls == nil { + r.EncodeNil() + } else { + h.encSlicePtrtostring(([]*string)(x.Urls), e) + } // end block: if x.Urls slice == nil + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(1) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"urls\"") + } else { + r.EncodeString(`urls`) + } + z.EncWriteMapElemValue() + if x.Urls == nil { + r.EncodeNil() + } else { + h.encSlicePtrtostring(([]*string)(x.Urls), e) + } // end block: if x.Urls slice == nil + z.EncWriteMapEnd() + } + } +} + +func (x *UserEntityDescription) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = UserEntityDescription{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *UserEntityDescription) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "urls": + h.decSlicePtrtostring((*[]*string)(&x.Urls), d) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *UserEntityDescription) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj6 int @@ -6245,55 +763,2802 @@ func (x *XLStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if yyhl6 { yyb6 = yyj6 > l } else { - yyb6 = r.CheckBreak() + yyb6 = z.DecCheckBreak() } if yyb6 { - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) + z.DecReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv7 := &x.Data - yym8 := z.DecBinary() - _ = yym8 - if false { - } else { - h.decSliceLargeStruct((*[]LargeStruct)(yyv7), d) - } - } + z.DecReadArrayElem() + h.decSlicePtrtostring((*[]*string)(&x.Urls), d) for { yyj6++ if yyhl6 { yyb6 = yyj6 > l } else { - yyb6 = r.CheckBreak() + yyb6 = z.DecCheckBreak() } if yyb6 { break } - z.DecSendContainerState(codecSelfer_containerArrayElem9225) + z.DecReadArrayElem() z.DecStructFieldNotFound(yyj6-1, "") } - z.DecSendContainerState(codecSelfer_containerArrayEnd9225) } -func (x codecSelfer9225) encSliceHashtag(v []Hashtag, e *codec1978.Encoder) { - var h codecSelfer9225 +func (x *URL) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - r.EncodeArrayStart(len(v)) + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + var yyn3 bool = x.ExpandedURL == nil + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(3) + if yyn3 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy6 := *x.ExpandedURL + r.EncodeString(string(yy6)) + } + z.EncWriteArrayElem() + if x.Indices == nil { + r.EncodeNil() + } else { + z.F.EncSliceIntV(x.Indices, e) + } // end block: if x.Indices slice == nil + z.EncWriteArrayElem() + r.EncodeString(string(x.URL)) + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(3) + z.EncWriteMapElemKey() + r.EncodeString(`expanded_url`) + z.EncWriteMapElemValue() + if yyn3 { + r.EncodeNil() + } else { + yy10 := *x.ExpandedURL + r.EncodeString(string(yy10)) + } + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"indices\"") + } else { + r.EncodeString(`indices`) + } + z.EncWriteMapElemValue() + if x.Indices == nil { + r.EncodeNil() + } else { + z.F.EncSliceIntV(x.Indices, e) + } // end block: if x.Indices slice == nil + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"url\"") + } else { + r.EncodeString(`url`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.URL)) + z.EncWriteMapEnd() + } + } +} + +func (x *URL) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = URL{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *URL) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "expanded_url": + if r.TryNil() { + if x.ExpandedURL != nil { // remove the if-true + x.ExpandedURL = nil + } + } else { + if x.ExpandedURL == nil { + x.ExpandedURL = new(string) + } + *x.ExpandedURL = (string)(string(r.DecodeStringAsBytes())) + } + case "indices": + z.F.DecSliceIntX(&x.Indices, d) + case "url": + x.URL = (string)(string(r.DecodeStringAsBytes())) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *URL) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = z.DecCheckBreak() + } + if yyb9 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.ExpandedURL != nil { // remove the if-true + x.ExpandedURL = nil + } + } else { + if x.ExpandedURL == nil { + x.ExpandedURL = new(string) + } + *x.ExpandedURL = (string)(string(r.DecodeStringAsBytes())) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = z.DecCheckBreak() + } + if yyb9 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + z.F.DecSliceIntX(&x.Indices, d) + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = z.DecCheckBreak() + } + if yyb9 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.URL = (string)(string(r.DecodeStringAsBytes())) + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = z.DecCheckBreak() + } + if yyb9 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj9-1, "") + } +} + +func (x *UserEntityURL) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(1) + z.EncWriteArrayElem() + if x.Urls == nil { + r.EncodeNil() + } else { + h.encSliceURL(([]URL)(x.Urls), e) + } // end block: if x.Urls slice == nil + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(1) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"urls\"") + } else { + r.EncodeString(`urls`) + } + z.EncWriteMapElemValue() + if x.Urls == nil { + r.EncodeNil() + } else { + h.encSliceURL(([]URL)(x.Urls), e) + } // end block: if x.Urls slice == nil + z.EncWriteMapEnd() + } + } +} + +func (x *UserEntityURL) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = UserEntityURL{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *UserEntityURL) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "urls": + h.decSliceURL((*[]URL)(&x.Urls), d) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *UserEntityURL) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + h.decSliceURL((*[]URL)(&x.Urls), d) + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj6-1, "") + } +} + +func (x *UserEntities) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(2) + z.EncWriteArrayElem() + yy5 := &x.Description + yy5.CodecEncodeSelf(e) + z.EncWriteArrayElem() + yy7 := &x.URL + yy7.CodecEncodeSelf(e) + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(2) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"description\"") + } else { + r.EncodeString(`description`) + } + z.EncWriteMapElemValue() + yy9 := &x.Description + yy9.CodecEncodeSelf(e) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"url\"") + } else { + r.EncodeString(`url`) + } + z.EncWriteMapElemValue() + yy11 := &x.URL + yy11.CodecEncodeSelf(e) + z.EncWriteMapEnd() + } + } +} + +func (x *UserEntities) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = UserEntities{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *UserEntities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "description": + x.Description.CodecDecodeSelf(d) + case "url": + x.URL.CodecDecodeSelf(d) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *UserEntities) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Description.CodecDecodeSelf(d) + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.URL.CodecDecodeSelf(d) + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj6-1, "") + } +} + +func (x *User) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + var yyn10 bool = x.FollowRequestSent == nil + var yyn12 bool = x.Following == nil + var yyn22 bool = x.Notifications == nil + var yyn39 bool = x.URL == nil + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(39) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.ContributorsEnabled)) + z.EncWriteArrayElem() + r.EncodeString(string(x.CreatedAt)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.DefaultProfile)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.DefaultProfileImage)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Description)) + z.EncWriteArrayElem() + yy47 := &x.Entities + yy47.CodecEncodeSelf(e) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.FavouritesCount)) + if yyn10 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy50 := *x.FollowRequestSent + r.EncodeString(string(yy50)) + } + z.EncWriteArrayElem() + r.EncodeInt(int64(x.FollowersCount)) + if yyn12 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy53 := *x.Following + r.EncodeString(string(yy53)) + } + z.EncWriteArrayElem() + r.EncodeInt(int64(x.FriendsCount)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.GeoEnabled)) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.ID)) + z.EncWriteArrayElem() + r.EncodeString(string(x.IDStr)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.IsTranslator)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Lang)) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.ListedCount)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Location)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Name)) + if yyn22 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy64 := *x.Notifications + r.EncodeString(string(yy64)) + } + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileBackgroundColor)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileBackgroundImageURL)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileBackgroundImageURLHTTPS)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.ProfileBackgroundTile)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileImageURL)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileImageURLHTTPS)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileLinkColor)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileSidebarBorderColor)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileSidebarFillColor)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ProfileTextColor)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.ProfileUseBackgroundImage)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.Protected)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ScreenName)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.ShowAllInlineMedia)) + z.EncWriteArrayElem() + r.EncodeInt(int64(x.StatusesCount)) + z.EncWriteArrayElem() + r.EncodeString(string(x.TimeZone)) + if yyn39 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy82 := *x.URL + r.EncodeString(string(yy82)) + } + z.EncWriteArrayElem() + r.EncodeInt(int64(x.UtcOffset)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.Verified)) + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(39) + z.EncWriteMapElemKey() + r.EncodeString(`contributors_enabled`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.ContributorsEnabled)) + z.EncWriteMapElemKey() + r.EncodeString(`created_at`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.CreatedAt)) + z.EncWriteMapElemKey() + r.EncodeString(`default_profile`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.DefaultProfile)) + z.EncWriteMapElemKey() + r.EncodeString(`default_profile_image`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.DefaultProfileImage)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"description\"") + } else { + r.EncodeString(`description`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Description)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"entities\"") + } else { + r.EncodeString(`entities`) + } + z.EncWriteMapElemValue() + yy91 := &x.Entities + yy91.CodecEncodeSelf(e) + z.EncWriteMapElemKey() + r.EncodeString(`favourites_count`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.FavouritesCount)) + z.EncWriteMapElemKey() + r.EncodeString(`follow_request_sent`) + z.EncWriteMapElemValue() + if yyn10 { + r.EncodeNil() + } else { + yy94 := *x.FollowRequestSent + r.EncodeString(string(yy94)) + } + z.EncWriteMapElemKey() + r.EncodeString(`followers_count`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.FollowersCount)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"following\"") + } else { + r.EncodeString(`following`) + } + z.EncWriteMapElemValue() + if yyn12 { + r.EncodeNil() + } else { + yy97 := *x.Following + r.EncodeString(string(yy97)) + } + z.EncWriteMapElemKey() + r.EncodeString(`friends_count`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.FriendsCount)) + z.EncWriteMapElemKey() + r.EncodeString(`geo_enabled`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.GeoEnabled)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"id\"") + } else { + r.EncodeString(`id`) + } + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.ID)) + z.EncWriteMapElemKey() + r.EncodeString(`id_str`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.IDStr)) + z.EncWriteMapElemKey() + r.EncodeString(`is_translator`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.IsTranslator)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"lang\"") + } else { + r.EncodeString(`lang`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Lang)) + z.EncWriteMapElemKey() + r.EncodeString(`listed_count`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.ListedCount)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"location\"") + } else { + r.EncodeString(`location`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Location)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"name\"") + } else { + r.EncodeString(`name`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Name)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"notifications\"") + } else { + r.EncodeString(`notifications`) + } + z.EncWriteMapElemValue() + if yyn22 { + r.EncodeNil() + } else { + yy108 := *x.Notifications + r.EncodeString(string(yy108)) + } + z.EncWriteMapElemKey() + r.EncodeString(`profile_background_color`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileBackgroundColor)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_background_image_url`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileBackgroundImageURL)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_background_image_url_https`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileBackgroundImageURLHTTPS)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_background_tile`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.ProfileBackgroundTile)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_image_url`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileImageURL)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_image_url_https`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileImageURLHTTPS)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_link_color`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileLinkColor)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_sidebar_border_color`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileSidebarBorderColor)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_sidebar_fill_color`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileSidebarFillColor)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_text_color`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ProfileTextColor)) + z.EncWriteMapElemKey() + r.EncodeString(`profile_use_background_image`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.ProfileUseBackgroundImage)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"protected\"") + } else { + r.EncodeString(`protected`) + } + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.Protected)) + z.EncWriteMapElemKey() + r.EncodeString(`screen_name`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ScreenName)) + z.EncWriteMapElemKey() + r.EncodeString(`show_all_inline_media`) + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.ShowAllInlineMedia)) + z.EncWriteMapElemKey() + r.EncodeString(`statuses_count`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.StatusesCount)) + z.EncWriteMapElemKey() + r.EncodeString(`time_zone`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.TimeZone)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"url\"") + } else { + r.EncodeString(`url`) + } + z.EncWriteMapElemValue() + if yyn39 { + r.EncodeNil() + } else { + yy126 := *x.URL + r.EncodeString(string(yy126)) + } + z.EncWriteMapElemKey() + r.EncodeString(`utc_offset`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.UtcOffset)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"verified\"") + } else { + r.EncodeString(`verified`) + } + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.Verified)) + z.EncWriteMapEnd() + } + } +} + +func (x *User) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = User{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *User) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "contributors_enabled": + x.ContributorsEnabled = (bool)(r.DecodeBool()) + case "created_at": + x.CreatedAt = (string)(string(r.DecodeStringAsBytes())) + case "default_profile": + x.DefaultProfile = (bool)(r.DecodeBool()) + case "default_profile_image": + x.DefaultProfileImage = (bool)(r.DecodeBool()) + case "description": + x.Description = (string)(string(r.DecodeStringAsBytes())) + case "entities": + x.Entities.CodecDecodeSelf(d) + case "favourites_count": + x.FavouritesCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "follow_request_sent": + if r.TryNil() { + if x.FollowRequestSent != nil { // remove the if-true + x.FollowRequestSent = nil + } + } else { + if x.FollowRequestSent == nil { + x.FollowRequestSent = new(string) + } + *x.FollowRequestSent = (string)(string(r.DecodeStringAsBytes())) + } + case "followers_count": + x.FollowersCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "following": + if r.TryNil() { + if x.Following != nil { // remove the if-true + x.Following = nil + } + } else { + if x.Following == nil { + x.Following = new(string) + } + *x.Following = (string)(string(r.DecodeStringAsBytes())) + } + case "friends_count": + x.FriendsCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "geo_enabled": + x.GeoEnabled = (bool)(r.DecodeBool()) + case "id": + x.ID = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "id_str": + x.IDStr = (string)(string(r.DecodeStringAsBytes())) + case "is_translator": + x.IsTranslator = (bool)(r.DecodeBool()) + case "lang": + x.Lang = (string)(string(r.DecodeStringAsBytes())) + case "listed_count": + x.ListedCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "location": + x.Location = (string)(string(r.DecodeStringAsBytes())) + case "name": + x.Name = (string)(string(r.DecodeStringAsBytes())) + case "notifications": + if r.TryNil() { + if x.Notifications != nil { // remove the if-true + x.Notifications = nil + } + } else { + if x.Notifications == nil { + x.Notifications = new(string) + } + *x.Notifications = (string)(string(r.DecodeStringAsBytes())) + } + case "profile_background_color": + x.ProfileBackgroundColor = (string)(string(r.DecodeStringAsBytes())) + case "profile_background_image_url": + x.ProfileBackgroundImageURL = (string)(string(r.DecodeStringAsBytes())) + case "profile_background_image_url_https": + x.ProfileBackgroundImageURLHTTPS = (string)(string(r.DecodeStringAsBytes())) + case "profile_background_tile": + x.ProfileBackgroundTile = (bool)(r.DecodeBool()) + case "profile_image_url": + x.ProfileImageURL = (string)(string(r.DecodeStringAsBytes())) + case "profile_image_url_https": + x.ProfileImageURLHTTPS = (string)(string(r.DecodeStringAsBytes())) + case "profile_link_color": + x.ProfileLinkColor = (string)(string(r.DecodeStringAsBytes())) + case "profile_sidebar_border_color": + x.ProfileSidebarBorderColor = (string)(string(r.DecodeStringAsBytes())) + case "profile_sidebar_fill_color": + x.ProfileSidebarFillColor = (string)(string(r.DecodeStringAsBytes())) + case "profile_text_color": + x.ProfileTextColor = (string)(string(r.DecodeStringAsBytes())) + case "profile_use_background_image": + x.ProfileUseBackgroundImage = (bool)(r.DecodeBool()) + case "protected": + x.Protected = (bool)(r.DecodeBool()) + case "screen_name": + x.ScreenName = (string)(string(r.DecodeStringAsBytes())) + case "show_all_inline_media": + x.ShowAllInlineMedia = (bool)(r.DecodeBool()) + case "statuses_count": + x.StatusesCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "time_zone": + x.TimeZone = (string)(string(r.DecodeStringAsBytes())) + case "url": + if r.TryNil() { + if x.URL != nil { // remove the if-true + x.URL = nil + } + } else { + if x.URL == nil { + x.URL = new(string) + } + *x.URL = (string)(string(r.DecodeStringAsBytes())) + } + case "utc_offset": + x.UtcOffset = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "verified": + x.Verified = (bool)(r.DecodeBool()) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *User) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj47 int + var yyb47 bool + var yyhl47 bool = l >= 0 + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ContributorsEnabled = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.CreatedAt = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.DefaultProfile = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.DefaultProfileImage = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Description = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Entities.CodecDecodeSelf(d) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.FavouritesCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.FollowRequestSent != nil { // remove the if-true + x.FollowRequestSent = nil + } + } else { + if x.FollowRequestSent == nil { + x.FollowRequestSent = new(string) + } + *x.FollowRequestSent = (string)(string(r.DecodeStringAsBytes())) + } + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.FollowersCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.Following != nil { // remove the if-true + x.Following = nil + } + } else { + if x.Following == nil { + x.Following = new(string) + } + *x.Following = (string)(string(r.DecodeStringAsBytes())) + } + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.FriendsCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.GeoEnabled = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ID = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.IDStr = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.IsTranslator = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Lang = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ListedCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Location = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Name = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.Notifications != nil { // remove the if-true + x.Notifications = nil + } + } else { + if x.Notifications == nil { + x.Notifications = new(string) + } + *x.Notifications = (string)(string(r.DecodeStringAsBytes())) + } + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileBackgroundColor = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileBackgroundImageURL = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileBackgroundImageURLHTTPS = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileBackgroundTile = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileImageURL = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileImageURLHTTPS = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileLinkColor = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileSidebarBorderColor = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileSidebarFillColor = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileTextColor = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ProfileUseBackgroundImage = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Protected = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ScreenName = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ShowAllInlineMedia = (bool)(r.DecodeBool()) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.StatusesCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.TimeZone = (string)(string(r.DecodeStringAsBytes())) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.URL != nil { // remove the if-true + x.URL = nil + } + } else { + if x.URL == nil { + x.URL = new(string) + } + *x.URL = (string)(string(r.DecodeStringAsBytes())) + } + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.UtcOffset = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Verified = (bool)(r.DecodeBool()) + for { + yyj47++ + if yyhl47 { + yyb47 = yyj47 > l + } else { + yyb47 = z.DecCheckBreak() + } + if yyb47 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj47-1, "") + } +} + +func (x *StatusMetadata) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(2) + z.EncWriteArrayElem() + r.EncodeString(string(x.IsoLanguageCode)) + z.EncWriteArrayElem() + r.EncodeString(string(x.ResultType)) + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(2) + z.EncWriteMapElemKey() + r.EncodeString(`iso_language_code`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.IsoLanguageCode)) + z.EncWriteMapElemKey() + r.EncodeString(`result_type`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.ResultType)) + z.EncWriteMapEnd() + } + } +} + +func (x *StatusMetadata) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = StatusMetadata{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *StatusMetadata) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "iso_language_code": + x.IsoLanguageCode = (string)(string(r.DecodeStringAsBytes())) + case "result_type": + x.ResultType = (string)(string(r.DecodeStringAsBytes())) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *StatusMetadata) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.IsoLanguageCode = (string)(string(r.DecodeStringAsBytes())) + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ResultType = (string)(string(r.DecodeStringAsBytes())) + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj6-1, "") + } +} + +func (x *Status) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + var yyn3 bool = x.Contributors == nil + var yyn4 bool = x.Coordinates == nil + var yyn8 bool = x.Geo == nil + var yyn11 bool = x.InReplyToScreenName == nil + var yyn12 bool = x.InReplyToStatusID == nil + var yyn13 bool = x.InReplyToStatusIDStr == nil + var yyn14 bool = x.InReplyToUserID == nil + var yyn15 bool = x.InReplyToUserIDStr == nil + var yyn17 bool = x.Place == nil + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(21) + if yyn3 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy24 := *x.Contributors + r.EncodeString(string(yy24)) + } + if yyn4 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy26 := *x.Coordinates + r.EncodeString(string(yy26)) + } + z.EncWriteArrayElem() + r.EncodeString(string(x.CreatedAt)) + z.EncWriteArrayElem() + yy29 := &x.Entities + yy29.CodecEncodeSelf(e) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.Favorited)) + if yyn8 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy32 := *x.Geo + r.EncodeString(string(yy32)) + } + z.EncWriteArrayElem() + r.EncodeInt(int64(x.ID)) + z.EncWriteArrayElem() + r.EncodeString(string(x.IDStr)) + if yyn11 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy36 := *x.InReplyToScreenName + r.EncodeString(string(yy36)) + } + if yyn12 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy38 := *x.InReplyToStatusID + r.EncodeString(string(yy38)) + } + if yyn13 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy40 := *x.InReplyToStatusIDStr + r.EncodeString(string(yy40)) + } + if yyn14 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy42 := *x.InReplyToUserID + r.EncodeString(string(yy42)) + } + if yyn15 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy44 := *x.InReplyToUserIDStr + r.EncodeString(string(yy44)) + } + z.EncWriteArrayElem() + yy46 := &x.Metadata + yy46.CodecEncodeSelf(e) + if yyn17 { + z.EncWriteArrayElem() + r.EncodeNil() + } else { + z.EncWriteArrayElem() + yy48 := *x.Place + r.EncodeString(string(yy48)) + } + z.EncWriteArrayElem() + r.EncodeInt(int64(x.RetweetCount)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.Retweeted)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Source)) + z.EncWriteArrayElem() + r.EncodeString(string(x.Text)) + z.EncWriteArrayElem() + r.EncodeBool(bool(x.Truncated)) + z.EncWriteArrayElem() + yy55 := &x.User + yy55.CodecEncodeSelf(e) + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(21) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"contributors\"") + } else { + r.EncodeString(`contributors`) + } + z.EncWriteMapElemValue() + if yyn3 { + r.EncodeNil() + } else { + yy57 := *x.Contributors + r.EncodeString(string(yy57)) + } + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"coordinates\"") + } else { + r.EncodeString(`coordinates`) + } + z.EncWriteMapElemValue() + if yyn4 { + r.EncodeNil() + } else { + yy59 := *x.Coordinates + r.EncodeString(string(yy59)) + } + z.EncWriteMapElemKey() + r.EncodeString(`created_at`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.CreatedAt)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"entities\"") + } else { + r.EncodeString(`entities`) + } + z.EncWriteMapElemValue() + yy62 := &x.Entities + yy62.CodecEncodeSelf(e) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"favorited\"") + } else { + r.EncodeString(`favorited`) + } + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.Favorited)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"geo\"") + } else { + r.EncodeString(`geo`) + } + z.EncWriteMapElemValue() + if yyn8 { + r.EncodeNil() + } else { + yy65 := *x.Geo + r.EncodeString(string(yy65)) + } + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"id\"") + } else { + r.EncodeString(`id`) + } + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.ID)) + z.EncWriteMapElemKey() + r.EncodeString(`id_str`) + z.EncWriteMapElemValue() + r.EncodeString(string(x.IDStr)) + z.EncWriteMapElemKey() + r.EncodeString(`in_reply_to_screen_name`) + z.EncWriteMapElemValue() + if yyn11 { + r.EncodeNil() + } else { + yy69 := *x.InReplyToScreenName + r.EncodeString(string(yy69)) + } + z.EncWriteMapElemKey() + r.EncodeString(`in_reply_to_status_id`) + z.EncWriteMapElemValue() + if yyn12 { + r.EncodeNil() + } else { + yy71 := *x.InReplyToStatusID + r.EncodeString(string(yy71)) + } + z.EncWriteMapElemKey() + r.EncodeString(`in_reply_to_status_id_str`) + z.EncWriteMapElemValue() + if yyn13 { + r.EncodeNil() + } else { + yy73 := *x.InReplyToStatusIDStr + r.EncodeString(string(yy73)) + } + z.EncWriteMapElemKey() + r.EncodeString(`in_reply_to_user_id`) + z.EncWriteMapElemValue() + if yyn14 { + r.EncodeNil() + } else { + yy75 := *x.InReplyToUserID + r.EncodeString(string(yy75)) + } + z.EncWriteMapElemKey() + r.EncodeString(`in_reply_to_user_id_str`) + z.EncWriteMapElemValue() + if yyn15 { + r.EncodeNil() + } else { + yy77 := *x.InReplyToUserIDStr + r.EncodeString(string(yy77)) + } + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"metadata\"") + } else { + r.EncodeString(`metadata`) + } + z.EncWriteMapElemValue() + yy79 := &x.Metadata + yy79.CodecEncodeSelf(e) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"place\"") + } else { + r.EncodeString(`place`) + } + z.EncWriteMapElemValue() + if yyn17 { + r.EncodeNil() + } else { + yy81 := *x.Place + r.EncodeString(string(yy81)) + } + z.EncWriteMapElemKey() + r.EncodeString(`retweet_count`) + z.EncWriteMapElemValue() + r.EncodeInt(int64(x.RetweetCount)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"retweeted\"") + } else { + r.EncodeString(`retweeted`) + } + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.Retweeted)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"source\"") + } else { + r.EncodeString(`source`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Source)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"text\"") + } else { + r.EncodeString(`text`) + } + z.EncWriteMapElemValue() + r.EncodeString(string(x.Text)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"truncated\"") + } else { + r.EncodeString(`truncated`) + } + z.EncWriteMapElemValue() + r.EncodeBool(bool(x.Truncated)) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"user\"") + } else { + r.EncodeString(`user`) + } + z.EncWriteMapElemValue() + yy88 := &x.User + yy88.CodecEncodeSelf(e) + z.EncWriteMapEnd() + } + } +} + +func (x *Status) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = Status{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *Status) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "contributors": + if r.TryNil() { + if x.Contributors != nil { // remove the if-true + x.Contributors = nil + } + } else { + if x.Contributors == nil { + x.Contributors = new(string) + } + *x.Contributors = (string)(string(r.DecodeStringAsBytes())) + } + case "coordinates": + if r.TryNil() { + if x.Coordinates != nil { // remove the if-true + x.Coordinates = nil + } + } else { + if x.Coordinates == nil { + x.Coordinates = new(string) + } + *x.Coordinates = (string)(string(r.DecodeStringAsBytes())) + } + case "created_at": + x.CreatedAt = (string)(string(r.DecodeStringAsBytes())) + case "entities": + x.Entities.CodecDecodeSelf(d) + case "favorited": + x.Favorited = (bool)(r.DecodeBool()) + case "geo": + if r.TryNil() { + if x.Geo != nil { // remove the if-true + x.Geo = nil + } + } else { + if x.Geo == nil { + x.Geo = new(string) + } + *x.Geo = (string)(string(r.DecodeStringAsBytes())) + } + case "id": + x.ID = (int64)(r.DecodeInt64()) + case "id_str": + x.IDStr = (string)(string(r.DecodeStringAsBytes())) + case "in_reply_to_screen_name": + if r.TryNil() { + if x.InReplyToScreenName != nil { // remove the if-true + x.InReplyToScreenName = nil + } + } else { + if x.InReplyToScreenName == nil { + x.InReplyToScreenName = new(string) + } + *x.InReplyToScreenName = (string)(string(r.DecodeStringAsBytes())) + } + case "in_reply_to_status_id": + if r.TryNil() { + if x.InReplyToStatusID != nil { // remove the if-true + x.InReplyToStatusID = nil + } + } else { + if x.InReplyToStatusID == nil { + x.InReplyToStatusID = new(string) + } + *x.InReplyToStatusID = (string)(string(r.DecodeStringAsBytes())) + } + case "in_reply_to_status_id_str": + if r.TryNil() { + if x.InReplyToStatusIDStr != nil { // remove the if-true + x.InReplyToStatusIDStr = nil + } + } else { + if x.InReplyToStatusIDStr == nil { + x.InReplyToStatusIDStr = new(string) + } + *x.InReplyToStatusIDStr = (string)(string(r.DecodeStringAsBytes())) + } + case "in_reply_to_user_id": + if r.TryNil() { + if x.InReplyToUserID != nil { // remove the if-true + x.InReplyToUserID = nil + } + } else { + if x.InReplyToUserID == nil { + x.InReplyToUserID = new(string) + } + *x.InReplyToUserID = (string)(string(r.DecodeStringAsBytes())) + } + case "in_reply_to_user_id_str": + if r.TryNil() { + if x.InReplyToUserIDStr != nil { // remove the if-true + x.InReplyToUserIDStr = nil + } + } else { + if x.InReplyToUserIDStr == nil { + x.InReplyToUserIDStr = new(string) + } + *x.InReplyToUserIDStr = (string)(string(r.DecodeStringAsBytes())) + } + case "metadata": + x.Metadata.CodecDecodeSelf(d) + case "place": + if r.TryNil() { + if x.Place != nil { // remove the if-true + x.Place = nil + } + } else { + if x.Place == nil { + x.Place = new(string) + } + *x.Place = (string)(string(r.DecodeStringAsBytes())) + } + case "retweet_count": + x.RetweetCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + case "retweeted": + x.Retweeted = (bool)(r.DecodeBool()) + case "source": + x.Source = (string)(string(r.DecodeStringAsBytes())) + case "text": + x.Text = (string)(string(r.DecodeStringAsBytes())) + case "truncated": + x.Truncated = (bool)(r.DecodeBool()) + case "user": + x.User.CodecDecodeSelf(d) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *Status) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj34 int + var yyb34 bool + var yyhl34 bool = l >= 0 + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.Contributors != nil { // remove the if-true + x.Contributors = nil + } + } else { + if x.Contributors == nil { + x.Contributors = new(string) + } + *x.Contributors = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.Coordinates != nil { // remove the if-true + x.Coordinates = nil + } + } else { + if x.Coordinates == nil { + x.Coordinates = new(string) + } + *x.Coordinates = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.CreatedAt = (string)(string(r.DecodeStringAsBytes())) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Entities.CodecDecodeSelf(d) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Favorited = (bool)(r.DecodeBool()) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.Geo != nil { // remove the if-true + x.Geo = nil + } + } else { + if x.Geo == nil { + x.Geo = new(string) + } + *x.Geo = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.ID = (int64)(r.DecodeInt64()) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.IDStr = (string)(string(r.DecodeStringAsBytes())) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.InReplyToScreenName != nil { // remove the if-true + x.InReplyToScreenName = nil + } + } else { + if x.InReplyToScreenName == nil { + x.InReplyToScreenName = new(string) + } + *x.InReplyToScreenName = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.InReplyToStatusID != nil { // remove the if-true + x.InReplyToStatusID = nil + } + } else { + if x.InReplyToStatusID == nil { + x.InReplyToStatusID = new(string) + } + *x.InReplyToStatusID = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.InReplyToStatusIDStr != nil { // remove the if-true + x.InReplyToStatusIDStr = nil + } + } else { + if x.InReplyToStatusIDStr == nil { + x.InReplyToStatusIDStr = new(string) + } + *x.InReplyToStatusIDStr = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.InReplyToUserID != nil { // remove the if-true + x.InReplyToUserID = nil + } + } else { + if x.InReplyToUserID == nil { + x.InReplyToUserID = new(string) + } + *x.InReplyToUserID = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.InReplyToUserIDStr != nil { // remove the if-true + x.InReplyToUserIDStr = nil + } + } else { + if x.InReplyToUserIDStr == nil { + x.InReplyToUserIDStr = new(string) + } + *x.InReplyToUserIDStr = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Metadata.CodecDecodeSelf(d) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + if r.TryNil() { + if x.Place != nil { // remove the if-true + x.Place = nil + } + } else { + if x.Place == nil { + x.Place = new(string) + } + *x.Place = (string)(string(r.DecodeStringAsBytes())) + } + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.RetweetCount = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize2736)) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Retweeted = (bool)(r.DecodeBool()) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Source = (string)(string(r.DecodeStringAsBytes())) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Text = (string)(string(r.DecodeStringAsBytes())) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.Truncated = (bool)(r.DecodeBool()) + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.User.CodecDecodeSelf(d) + for { + yyj34++ + if yyhl34 { + yyb34 = yyj34 > l + } else { + yyb34 = z.DecCheckBreak() + } + if yyb34 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj34-1, "") + } +} + +func (x *LargeStruct) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(2) + z.EncWriteArrayElem() + yy5 := &x.SearchMetadata + yy5.CodecEncodeSelf(e) + z.EncWriteArrayElem() + if x.Statuses == nil { + r.EncodeNil() + } else { + h.encSliceStatus(([]Status)(x.Statuses), e) + } // end block: if x.Statuses slice == nil + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(2) + z.EncWriteMapElemKey() + r.EncodeString(`search_metadata`) + z.EncWriteMapElemValue() + yy8 := &x.SearchMetadata + yy8.CodecEncodeSelf(e) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"statuses\"") + } else { + r.EncodeString(`statuses`) + } + z.EncWriteMapElemValue() + if x.Statuses == nil { + r.EncodeNil() + } else { + h.encSliceStatus(([]Status)(x.Statuses), e) + } // end block: if x.Statuses slice == nil + z.EncWriteMapEnd() + } + } +} + +func (x *LargeStruct) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = LargeStruct{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *LargeStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "search_metadata": + x.SearchMetadata.CodecDecodeSelf(d) + case "statuses": + h.decSliceStatus((*[]Status)(&x.Statuses), d) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *LargeStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = z.DecCheckBreak() + } + if yyb7 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + x.SearchMetadata.CodecDecodeSelf(d) + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = z.DecCheckBreak() + } + if yyb7 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + h.decSliceStatus((*[]Status)(&x.Statuses), d) + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = z.DecCheckBreak() + } + if yyb7 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj7-1, "") + } +} + +func (x *XLStruct) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + z.EncWriteArrayStart(1) + z.EncWriteArrayElem() + if x.Data == nil { + r.EncodeNil() + } else { + h.encSliceLargeStruct(([]LargeStruct)(x.Data), e) + } // end block: if x.Data slice == nil + z.EncWriteArrayEnd() + } else { + z.EncWriteMapStart(1) + z.EncWriteMapElemKey() + if z.IsJSONHandle() { + z.WriteStr("\"Data\"") + } else { + r.EncodeString(`Data`) + } + z.EncWriteMapElemValue() + if x.Data == nil { + r.EncodeNil() + } else { + h.encSliceLargeStruct(([]LargeStruct)(x.Data), e) + } // end block: if x.Data slice == nil + z.EncWriteMapEnd() + } + } +} + +func (x *XLStruct) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeNil2736 { + *(x) = XLStruct{} + } else if yyct2 == codecSelferValueTypeMap2736 { + yyl2 := z.DecReadMapStart() + if yyl2 == 0 { + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + z.DecReadMapEnd() + } else if yyct2 == codecSelferValueTypeArray2736 { + yyl2 := z.DecReadArrayStart() + if yyl2 != 0 { + x.codecDecodeSelfFromArray(yyl2, d) + } + z.DecReadArrayEnd() + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct2736) + } +} + +func (x *XLStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if z.DecCheckBreak() { + break + } + } + z.DecReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + z.DecReadMapElemValue() + switch yys3 { + case "Data": + h.decSliceLargeStruct((*[]LargeStruct)(&x.Data), d) + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 +} + +func (x *XLStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + z.DecReadArrayEnd() + return + } + z.DecReadArrayElem() + h.decSliceLargeStruct((*[]LargeStruct)(&x.Data), d) + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = z.DecCheckBreak() + } + if yyb6 { + break + } + z.DecReadArrayElem() + z.DecStructFieldNotFound(yyj6-1, "") + } +} + +func (x codecSelfer2736) encSliceHashtag(v []Hashtag, e *codec1978.Encoder) { + var h codecSelfer2736 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if v == nil { + r.EncodeNil() + return + } + z.EncWriteArrayStart(len(v)) for _, yyv1 := range v { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) + z.EncWriteArrayElem() yy2 := &yyv1 yy2.CodecEncodeSelf(e) } - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) + z.EncWriteArrayEnd() } -func (x codecSelfer9225) decSliceHashtag(v *[]Hashtag, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x codecSelfer2736) decSliceHashtag(v *[]Hashtag, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r @@ -6301,7 +3566,12 @@ func (x codecSelfer9225) decSliceHashtag(v *[]Hashtag, d *codec1978.Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []Hashtag{} yyc1 = true @@ -6309,86 +3579,52 @@ func (x codecSelfer9225) decSliceHashtag(v *[]Hashtag, d *codec1978.Decoder) { yyv1 = yyv1[:0] yyc1 = true } - } else if yyl1 > 0 { - var yyrr1, yyrl1 int - var yyrt1 bool - _, _ = yyrl1, yyrt1 - yyrr1 = yyl1 // len(yyv1) - if yyl1 > cap(yyv1) { - - yyrg1 := len(yyv1) > 0 - yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) - if yyrt1 { + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] } else { yyv1 = make([]Hashtag, yyrl1) } - } else { - yyv1 = make([]Hashtag, yyrl1) + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true } - yyc1 = true - yyrr1 = len(yyv1) - if yyrg1 { - copy(yyv1, yyv21) - } - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true } - yyj1 := 0 - for ; yyj1 < yyrr1; yyj1++ { - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = Hashtag{} - } else { - yyv2 := &yyv1[yyj1] - yyv2.CodecDecodeSelf(d) - } - - } - if yyrt1 { - for ; yyj1 < yyl1; yyj1++ { - yyv1 = append(yyv1, Hashtag{}) - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = Hashtag{} + var yyj1 int + for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || z.DecCheckBreak()); yyj1++ { // bounds-check-elimination + if yyj1 == 0 && yyv1 == nil { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) } else { - yyv3 := &yyv1[yyj1] - yyv3.CodecDecodeSelf(d) + yyrl1 = 8 } - - } - } - - } else { - yyj1 := 0 - for ; !r.CheckBreak(); yyj1++ { - - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, Hashtag{}) // var yyz1 Hashtag + yyv1 = make([]Hashtag, yyrl1) yyc1 = true } yyh1.ElemContainerState(yyj1) - if yyj1 < len(yyv1) { - if r.TryDecodeAsNil() { - yyv1[yyj1] = Hashtag{} - } else { - yyv4 := &yyv1[yyj1] - yyv4.CodecDecodeSelf(d) - } - + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Hashtag{}) + yyc1 = true + } + if yydb1 { + z.DecSwallow() } else { - z.DecSwallow() + yyv1[yyj1].CodecDecodeSelf(d) } - } if yyj1 < len(yyv1) { yyv1 = yyv1[:yyj1] yyc1 = true } else if yyj1 == 0 && yyv1 == nil { - yyv1 = []Hashtag{} + yyv1 = make([]Hashtag, 0) yyc1 = true } } @@ -6398,30 +3634,29 @@ func (x codecSelfer9225) decSliceHashtag(v *[]Hashtag, d *codec1978.Decoder) { } } -func (x codecSelfer9225) encSlicePtrtostring(v []*string, e *codec1978.Encoder) { - var h codecSelfer9225 +func (x codecSelfer2736) encSlicePtrtostring(v []*string, e *codec1978.Encoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - r.EncodeArrayStart(len(v)) + if v == nil { + r.EncodeNil() + return + } + z.EncWriteArrayStart(len(v)) for _, yyv1 := range v { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) + z.EncWriteArrayElem() if yyv1 == nil { r.EncodeNil() } else { yy2 := *yyv1 - yym3 := z.EncBinary() - _ = yym3 - if false { - } else { - r.EncodeString(codecSelferC_UTF89225, string(yy2)) - } + r.EncodeString(string(yy2)) } } - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) + z.EncWriteArrayEnd() } -func (x codecSelfer9225) decSlicePtrtostring(v *[]*string, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x codecSelfer2736) decSlicePtrtostring(v *[]*string, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r @@ -6429,7 +3664,12 @@ func (x codecSelfer9225) decSlicePtrtostring(v *[]*string, d *codec1978.Decoder) yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []*string{} yyc1 = true @@ -6437,116 +3677,59 @@ func (x codecSelfer9225) decSlicePtrtostring(v *[]*string, d *codec1978.Decoder) yyv1 = yyv1[:0] yyc1 = true } - } else if yyl1 > 0 { - var yyrr1, yyrl1 int - var yyrt1 bool - _, _ = yyrl1, yyrt1 - yyrr1 = yyl1 // len(yyv1) - if yyl1 > cap(yyv1) { - - yyrg1 := len(yyv1) > 0 - yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) - if yyrt1 { + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] } else { yyv1 = make([]*string, yyrl1) } - } else { + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + } + var yyj1 int + for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || z.DecCheckBreak()); yyj1++ { // bounds-check-elimination + if yyj1 == 0 && yyv1 == nil { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) + } else { + yyrl1 = 8 + } yyv1 = make([]*string, yyrl1) - } - yyc1 = true - yyrr1 = len(yyv1) - if yyrg1 { - copy(yyv1, yyv21) - } - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true - } - yyj1 := 0 - for ; yyj1 < yyrr1; yyj1++ { - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - if yyv1[yyj1] != nil { - *yyv1[yyj1] = "" - } - } else { - if yyv1[yyj1] == nil { - yyv1[yyj1] = new(string) - } - yyw2 := yyv1[yyj1] - yym3 := z.DecBinary() - _ = yym3 - if false { - } else { - *((*string)(yyw2)) = r.DecodeString() - } - } - - } - if yyrt1 { - for ; yyj1 < yyl1; yyj1++ { - yyv1 = append(yyv1, nil) - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - if yyv1[yyj1] != nil { - *yyv1[yyj1] = "" - } - } else { - if yyv1[yyj1] == nil { - yyv1[yyj1] = new(string) - } - yyw4 := yyv1[yyj1] - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyw4)) = r.DecodeString() - } - } - - } - } - - } else { - yyj1 := 0 - for ; !r.CheckBreak(); yyj1++ { - - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, nil) // var yyz1 *string yyc1 = true } yyh1.ElemContainerState(yyj1) - if yyj1 < len(yyv1) { - if r.TryDecodeAsNil() { - if yyv1[yyj1] != nil { - *yyv1[yyj1] = "" - } + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, nil) + yyc1 = true + } + if yydb1 { + z.DecSwallow() + } else { + if r.TryNil() { + yyv1[yyj1] = nil } else { if yyv1[yyj1] == nil { yyv1[yyj1] = new(string) } - yyw6 := yyv1[yyj1] - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyw6)) = r.DecodeString() - } + *yyv1[yyj1] = (string)(string(r.DecodeStringAsBytes())) } - - } else { - z.DecSwallow() } - } if yyj1 < len(yyv1) { yyv1 = yyv1[:yyj1] yyc1 = true } else if yyj1 == 0 && yyv1 == nil { - yyv1 = []*string{} + yyv1 = make([]*string, 0) yyc1 = true } } @@ -6556,21 +3739,25 @@ func (x codecSelfer9225) decSlicePtrtostring(v *[]*string, d *codec1978.Decoder) } } -func (x codecSelfer9225) encSliceURL(v []URL, e *codec1978.Encoder) { - var h codecSelfer9225 +func (x codecSelfer2736) encSliceURL(v []URL, e *codec1978.Encoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - r.EncodeArrayStart(len(v)) + if v == nil { + r.EncodeNil() + return + } + z.EncWriteArrayStart(len(v)) for _, yyv1 := range v { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) + z.EncWriteArrayElem() yy2 := &yyv1 yy2.CodecEncodeSelf(e) } - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) + z.EncWriteArrayEnd() } -func (x codecSelfer9225) decSliceURL(v *[]URL, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x codecSelfer2736) decSliceURL(v *[]URL, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r @@ -6578,7 +3765,12 @@ func (x codecSelfer9225) decSliceURL(v *[]URL, d *codec1978.Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []URL{} yyc1 = true @@ -6586,86 +3778,52 @@ func (x codecSelfer9225) decSliceURL(v *[]URL, d *codec1978.Decoder) { yyv1 = yyv1[:0] yyc1 = true } - } else if yyl1 > 0 { - var yyrr1, yyrl1 int - var yyrt1 bool - _, _ = yyrl1, yyrt1 - yyrr1 = yyl1 // len(yyv1) - if yyl1 > cap(yyv1) { - - yyrg1 := len(yyv1) > 0 - yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 48) - if yyrt1 { + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 48) if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] } else { yyv1 = make([]URL, yyrl1) } - } else { - yyv1 = make([]URL, yyrl1) + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true } - yyc1 = true - yyrr1 = len(yyv1) - if yyrg1 { - copy(yyv1, yyv21) - } - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true } - yyj1 := 0 - for ; yyj1 < yyrr1; yyj1++ { - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = URL{} - } else { - yyv2 := &yyv1[yyj1] - yyv2.CodecDecodeSelf(d) - } - - } - if yyrt1 { - for ; yyj1 < yyl1; yyj1++ { - yyv1 = append(yyv1, URL{}) - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = URL{} + var yyj1 int + for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || z.DecCheckBreak()); yyj1++ { // bounds-check-elimination + if yyj1 == 0 && yyv1 == nil { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 48) } else { - yyv3 := &yyv1[yyj1] - yyv3.CodecDecodeSelf(d) + yyrl1 = 8 } - - } - } - - } else { - yyj1 := 0 - for ; !r.CheckBreak(); yyj1++ { - - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, URL{}) // var yyz1 URL + yyv1 = make([]URL, yyrl1) yyc1 = true } yyh1.ElemContainerState(yyj1) - if yyj1 < len(yyv1) { - if r.TryDecodeAsNil() { - yyv1[yyj1] = URL{} - } else { - yyv4 := &yyv1[yyj1] - yyv4.CodecDecodeSelf(d) - } - + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, URL{}) + yyc1 = true + } + if yydb1 { + z.DecSwallow() } else { - z.DecSwallow() + yyv1[yyj1].CodecDecodeSelf(d) } - } if yyj1 < len(yyv1) { yyv1 = yyv1[:yyj1] yyc1 = true } else if yyj1 == 0 && yyv1 == nil { - yyv1 = []URL{} + yyv1 = make([]URL, 0) yyc1 = true } } @@ -6675,21 +3833,25 @@ func (x codecSelfer9225) decSliceURL(v *[]URL, d *codec1978.Decoder) { } } -func (x codecSelfer9225) encSliceStatus(v []Status, e *codec1978.Encoder) { - var h codecSelfer9225 +func (x codecSelfer2736) encSliceStatus(v []Status, e *codec1978.Encoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - r.EncodeArrayStart(len(v)) + if v == nil { + r.EncodeNil() + return + } + z.EncWriteArrayStart(len(v)) for _, yyv1 := range v { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) + z.EncWriteArrayElem() yy2 := &yyv1 yy2.CodecEncodeSelf(e) } - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) + z.EncWriteArrayEnd() } -func (x codecSelfer9225) decSliceStatus(v *[]Status, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x codecSelfer2736) decSliceStatus(v *[]Status, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r @@ -6697,7 +3859,12 @@ func (x codecSelfer9225) decSliceStatus(v *[]Status, d *codec1978.Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []Status{} yyc1 = true @@ -6705,86 +3872,52 @@ func (x codecSelfer9225) decSliceStatus(v *[]Status, d *codec1978.Decoder) { yyv1 = yyv1[:0] yyc1 = true } - } else if yyl1 > 0 { - var yyrr1, yyrl1 int - var yyrt1 bool - _, _ = yyrl1, yyrt1 - yyrr1 = yyl1 // len(yyv1) - if yyl1 > cap(yyv1) { - - yyrg1 := len(yyv1) > 0 - yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 752) - if yyrt1 { + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 752) if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] } else { yyv1 = make([]Status, yyrl1) } - } else { - yyv1 = make([]Status, yyrl1) + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true } - yyc1 = true - yyrr1 = len(yyv1) - if yyrg1 { - copy(yyv1, yyv21) - } - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true } - yyj1 := 0 - for ; yyj1 < yyrr1; yyj1++ { - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = Status{} - } else { - yyv2 := &yyv1[yyj1] - yyv2.CodecDecodeSelf(d) - } - - } - if yyrt1 { - for ; yyj1 < yyl1; yyj1++ { - yyv1 = append(yyv1, Status{}) - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = Status{} + var yyj1 int + for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || z.DecCheckBreak()); yyj1++ { // bounds-check-elimination + if yyj1 == 0 && yyv1 == nil { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 752) } else { - yyv3 := &yyv1[yyj1] - yyv3.CodecDecodeSelf(d) + yyrl1 = 8 } - - } - } - - } else { - yyj1 := 0 - for ; !r.CheckBreak(); yyj1++ { - - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, Status{}) // var yyz1 Status + yyv1 = make([]Status, yyrl1) yyc1 = true } yyh1.ElemContainerState(yyj1) - if yyj1 < len(yyv1) { - if r.TryDecodeAsNil() { - yyv1[yyj1] = Status{} - } else { - yyv4 := &yyv1[yyj1] - yyv4.CodecDecodeSelf(d) - } - + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Status{}) + yyc1 = true + } + if yydb1 { + z.DecSwallow() } else { - z.DecSwallow() + yyv1[yyj1].CodecDecodeSelf(d) } - } if yyj1 < len(yyv1) { yyv1 = yyv1[:yyj1] yyc1 = true } else if yyj1 == 0 && yyv1 == nil { - yyv1 = []Status{} + yyv1 = make([]Status, 0) yyc1 = true } } @@ -6794,21 +3927,25 @@ func (x codecSelfer9225) decSliceStatus(v *[]Status, d *codec1978.Decoder) { } } -func (x codecSelfer9225) encSliceLargeStruct(v []LargeStruct, e *codec1978.Encoder) { - var h codecSelfer9225 +func (x codecSelfer2736) encSliceLargeStruct(v []LargeStruct, e *codec1978.Encoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - r.EncodeArrayStart(len(v)) + if v == nil { + r.EncodeNil() + return + } + z.EncWriteArrayStart(len(v)) for _, yyv1 := range v { - z.EncSendContainerState(codecSelfer_containerArrayElem9225) + z.EncWriteArrayElem() yy2 := &yyv1 yy2.CodecEncodeSelf(e) } - z.EncSendContainerState(codecSelfer_containerArrayEnd9225) + z.EncWriteArrayEnd() } -func (x codecSelfer9225) decSliceLargeStruct(v *[]LargeStruct, d *codec1978.Decoder) { - var h codecSelfer9225 +func (x codecSelfer2736) decSliceLargeStruct(v *[]LargeStruct, d *codec1978.Decoder) { + var h codecSelfer2736 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r @@ -6816,7 +3953,12 @@ func (x codecSelfer9225) decSliceLargeStruct(v *[]LargeStruct, d *codec1978.Deco yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []LargeStruct{} yyc1 = true @@ -6824,86 +3966,52 @@ func (x codecSelfer9225) decSliceLargeStruct(v *[]LargeStruct, d *codec1978.Deco yyv1 = yyv1[:0] yyc1 = true } - } else if yyl1 > 0 { - var yyrr1, yyrl1 int - var yyrt1 bool - _, _ = yyrl1, yyrt1 - yyrr1 = yyl1 // len(yyv1) - if yyl1 > cap(yyv1) { - - yyrg1 := len(yyv1) > 0 - yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 136) - if yyrt1 { + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 136) if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] } else { yyv1 = make([]LargeStruct, yyrl1) } - } else { - yyv1 = make([]LargeStruct, yyrl1) + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true } - yyc1 = true - yyrr1 = len(yyv1) - if yyrg1 { - copy(yyv1, yyv21) - } - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true } - yyj1 := 0 - for ; yyj1 < yyrr1; yyj1++ { - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = LargeStruct{} - } else { - yyv2 := &yyv1[yyj1] - yyv2.CodecDecodeSelf(d) - } - - } - if yyrt1 { - for ; yyj1 < yyl1; yyj1++ { - yyv1 = append(yyv1, LargeStruct{}) - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - yyv1[yyj1] = LargeStruct{} + var yyj1 int + for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || z.DecCheckBreak()); yyj1++ { // bounds-check-elimination + if yyj1 == 0 && yyv1 == nil { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 136) } else { - yyv3 := &yyv1[yyj1] - yyv3.CodecDecodeSelf(d) + yyrl1 = 8 } - - } - } - - } else { - yyj1 := 0 - for ; !r.CheckBreak(); yyj1++ { - - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, LargeStruct{}) // var yyz1 LargeStruct + yyv1 = make([]LargeStruct, yyrl1) yyc1 = true } yyh1.ElemContainerState(yyj1) - if yyj1 < len(yyv1) { - if r.TryDecodeAsNil() { - yyv1[yyj1] = LargeStruct{} - } else { - yyv4 := &yyv1[yyj1] - yyv4.CodecDecodeSelf(d) - } - + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LargeStruct{}) + yyc1 = true + } + if yydb1 { + z.DecSwallow() } else { - z.DecSwallow() + yyv1[yyj1].CodecDecodeSelf(d) } - } if yyj1 < len(yyv1) { yyv1 = yyv1[:yyj1] yyc1 = true } else if yyj1 == 0 && yyv1 == nil { - yyv1 = []LargeStruct{} + yyv1 = make([]LargeStruct, 0) yyc1 = true } } diff --git a/benchmark/data_ffjson.go b/benchmark/data_ffjson.go index 9f000d3..ae091da 100644 --- a/benchmark/data_ffjson.go +++ b/benchmark/data_ffjson.go @@ -14,20 +14,23 @@ import ( fflib "github.com/pquerna/ffjson/fflib/v1" ) -func (mj *Entities) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *Entities) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -36,9 +39,9 @@ func (mj *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { _ = obj _ = err buf.WriteString(`{"hashtags":`) - if mj.Hashtags != nil { + if j.Hashtags != nil { buf.WriteString(`[`) - for i, v := range mj.Hashtags { + for i, v := range j.Hashtags { if i != 0 { buf.WriteString(`,`) } @@ -57,9 +60,9 @@ func (mj *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { buf.WriteString(`null`) } buf.WriteString(`,"urls":`) - if mj.Urls != nil { + if j.Urls != nil { buf.WriteString(`[`) - for i, v := range mj.Urls { + for i, v := range j.Urls { if i != 0 { buf.WriteString(`,`) } @@ -74,9 +77,9 @@ func (mj *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { buf.WriteString(`null`) } buf.WriteString(`,"user_mentions":`) - if mj.UserMentions != nil { + if j.UserMentions != nil { buf.WriteString(`[`) - for i, v := range mj.UserMentions { + for i, v := range j.UserMentions { if i != 0 { buf.WriteString(`,`) } @@ -95,30 +98,32 @@ func (mj *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { } const ( - ffj_t_Entitiesbase = iota - ffj_t_Entitiesno_such_key + ffjtEntitiesbase = iota + ffjtEntitiesnosuchkey - ffj_t_Entities_Hashtags + ffjtEntitiesHashtags - ffj_t_Entities_Urls + ffjtEntitiesUrls - ffj_t_Entities_UserMentions + ffjtEntitiesUserMentions ) -var ffj_key_Entities_Hashtags = []byte("hashtags") +var ffjKeyEntitiesHashtags = []byte("hashtags") -var ffj_key_Entities_Urls = []byte("urls") +var ffjKeyEntitiesUrls = []byte("urls") -var ffj_key_Entities_UserMentions = []byte("user_mentions") +var ffjKeyEntitiesUserMentions = []byte("user_mentions") -func (uj *Entities) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *Entities) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *Entities) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_Entitiesbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *Entities) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtEntitiesbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -164,7 +169,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_Entitiesno_such_key + currentKey = ffjtEntitiesnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -172,46 +177,46 @@ mainparse: case 'h': - if bytes.Equal(ffj_key_Entities_Hashtags, kn) { - currentKey = ffj_t_Entities_Hashtags + if bytes.Equal(ffjKeyEntitiesHashtags, kn) { + currentKey = ffjtEntitiesHashtags state = fflib.FFParse_want_colon goto mainparse } case 'u': - if bytes.Equal(ffj_key_Entities_Urls, kn) { - currentKey = ffj_t_Entities_Urls + if bytes.Equal(ffjKeyEntitiesUrls, kn) { + currentKey = ffjtEntitiesUrls state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_Entities_UserMentions, kn) { - currentKey = ffj_t_Entities_UserMentions + } else if bytes.Equal(ffjKeyEntitiesUserMentions, kn) { + currentKey = ffjtEntitiesUserMentions state = fflib.FFParse_want_colon goto mainparse } } - if fflib.EqualFoldRight(ffj_key_Entities_UserMentions, kn) { - currentKey = ffj_t_Entities_UserMentions + if fflib.EqualFoldRight(ffjKeyEntitiesUserMentions, kn) { + currentKey = ffjtEntitiesUserMentions state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_Entities_Urls, kn) { - currentKey = ffj_t_Entities_Urls + if fflib.EqualFoldRight(ffjKeyEntitiesUrls, kn) { + currentKey = ffjtEntitiesUrls state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_Entities_Hashtags, kn) { - currentKey = ffj_t_Entities_Hashtags + if fflib.EqualFoldRight(ffjKeyEntitiesHashtags, kn) { + currentKey = ffjtEntitiesHashtags state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_Entitiesno_such_key + currentKey = ffjtEntitiesnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -228,16 +233,16 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_Entities_Hashtags: + case ffjtEntitiesHashtags: goto handle_Hashtags - case ffj_t_Entities_Urls: + case ffjtEntitiesUrls: goto handle_Urls - case ffj_t_Entities_UserMentions: + case ffjtEntitiesUserMentions: goto handle_UserMentions - case ffj_t_Entitiesno_such_key: + case ffjtEntitiesnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -253,7 +258,7 @@ mainparse: handle_Hashtags: - /* handler: uj.Hashtags type=[]benchmark.Hashtag kind=slice quoted=false*/ + /* handler: j.Hashtags type=[]benchmark.Hashtag kind=slice quoted=false*/ { @@ -264,16 +269,16 @@ handle_Hashtags: } if tok == fflib.FFTok_null { - uj.Hashtags = nil + j.Hashtags = nil } else { - uj.Hashtags = make([]Hashtag, 0) + j.Hashtags = []Hashtag{} wantVal := true for { - var tmp_uj__Hashtags Hashtag + var tmpJHashtags Hashtag tok = fs.Scan() if tok == fflib.FFTok_error { @@ -294,23 +299,23 @@ handle_Hashtags: wantVal = true } - /* handler: tmp_uj__Hashtags type=benchmark.Hashtag kind=struct quoted=false*/ + /* handler: tmpJHashtags type=benchmark.Hashtag kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = tmp_uj__Hashtags.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = tmpJHashtags.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } - uj.Hashtags = append(uj.Hashtags, tmp_uj__Hashtags) + j.Hashtags = append(j.Hashtags, tmpJHashtags) + wantVal = false } } @@ -321,7 +326,7 @@ handle_Hashtags: handle_Urls: - /* handler: uj.Urls type=[]*string kind=slice quoted=false*/ + /* handler: j.Urls type=[]*string kind=slice quoted=false*/ { @@ -332,16 +337,16 @@ handle_Urls: } if tok == fflib.FFTok_null { - uj.Urls = nil + j.Urls = nil } else { - uj.Urls = make([]*string, 0) + j.Urls = []*string{} wantVal := true for { - var tmp_uj__Urls *string + var tmpJUrls *string tok = fs.Scan() if tok == fflib.FFTok_error { @@ -362,18 +367,18 @@ handle_Urls: wantVal = true } - /* handler: tmp_uj__Urls type=*string kind=ptr quoted=false*/ + /* handler: tmpJUrls type=*string kind=ptr quoted=false*/ { if tok == fflib.FFTok_null { - tmp_uj__Urls = nil + tmpJUrls = nil } else { - if tmp_uj__Urls == nil { - tmp_uj__Urls = new(string) + if tmpJUrls == nil { + tmpJUrls = new(string) } - /* handler: tmp_uj__Urls type=string kind=string quoted=false*/ + /* handler: tmpJUrls type=string kind=string quoted=false*/ { @@ -385,7 +390,7 @@ handle_Urls: if tok == fflib.FFTok_null { - tmp_uj__Urls = nil + tmpJUrls = nil } else { @@ -393,7 +398,7 @@ handle_Urls: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - tmp_uj__Urls = &tval + tmpJUrls = &tval } } @@ -401,7 +406,8 @@ handle_Urls: } } - uj.Urls = append(uj.Urls, tmp_uj__Urls) + j.Urls = append(j.Urls, tmpJUrls) + wantVal = false } } @@ -412,7 +418,7 @@ handle_Urls: handle_UserMentions: - /* handler: uj.UserMentions type=[]*string kind=slice quoted=false*/ + /* handler: j.UserMentions type=[]*string kind=slice quoted=false*/ { @@ -423,16 +429,16 @@ handle_UserMentions: } if tok == fflib.FFTok_null { - uj.UserMentions = nil + j.UserMentions = nil } else { - uj.UserMentions = make([]*string, 0) + j.UserMentions = []*string{} wantVal := true for { - var tmp_uj__UserMentions *string + var tmpJUserMentions *string tok = fs.Scan() if tok == fflib.FFTok_error { @@ -453,18 +459,18 @@ handle_UserMentions: wantVal = true } - /* handler: tmp_uj__UserMentions type=*string kind=ptr quoted=false*/ + /* handler: tmpJUserMentions type=*string kind=ptr quoted=false*/ { if tok == fflib.FFTok_null { - tmp_uj__UserMentions = nil + tmpJUserMentions = nil } else { - if tmp_uj__UserMentions == nil { - tmp_uj__UserMentions = new(string) + if tmpJUserMentions == nil { + tmpJUserMentions = new(string) } - /* handler: tmp_uj__UserMentions type=string kind=string quoted=false*/ + /* handler: tmpJUserMentions type=string kind=string quoted=false*/ { @@ -476,7 +482,7 @@ handle_UserMentions: if tok == fflib.FFTok_null { - tmp_uj__UserMentions = nil + tmpJUserMentions = nil } else { @@ -484,7 +490,7 @@ handle_UserMentions: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - tmp_uj__UserMentions = &tval + tmpJUserMentions = &tval } } @@ -492,7 +498,8 @@ handle_UserMentions: } } - uj.UserMentions = append(uj.UserMentions, tmp_uj__UserMentions) + j.UserMentions = append(j.UserMentions, tmpJUserMentions) + wantVal = false } } @@ -515,23 +522,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *Hashtag) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *Hashtag) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *Hashtag) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *Hashtag) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -540,9 +551,9 @@ func (mj *Hashtag) MarshalJSONBuf(buf fflib.EncodingBuffer) error { _ = obj _ = err buf.WriteString(`{"indices":`) - if mj.Indices != nil { + if j.Indices != nil { buf.WriteString(`[`) - for i, v := range mj.Indices { + for i, v := range j.Indices { if i != 0 { buf.WriteString(`,`) } @@ -553,32 +564,34 @@ func (mj *Hashtag) MarshalJSONBuf(buf fflib.EncodingBuffer) error { buf.WriteString(`null`) } buf.WriteString(`,"text":`) - fflib.WriteJsonString(buf, string(mj.Text)) + fflib.WriteJsonString(buf, string(j.Text)) buf.WriteByte('}') return nil } const ( - ffj_t_Hashtagbase = iota - ffj_t_Hashtagno_such_key + ffjtHashtagbase = iota + ffjtHashtagnosuchkey - ffj_t_Hashtag_Indices + ffjtHashtagIndices - ffj_t_Hashtag_Text + ffjtHashtagText ) -var ffj_key_Hashtag_Indices = []byte("indices") +var ffjKeyHashtagIndices = []byte("indices") -var ffj_key_Hashtag_Text = []byte("text") +var ffjKeyHashtagText = []byte("text") -func (uj *Hashtag) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *Hashtag) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *Hashtag) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_Hashtagbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *Hashtag) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtHashtagbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -624,7 +637,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_Hashtagno_such_key + currentKey = ffjtHashtagnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -632,35 +645,35 @@ mainparse: case 'i': - if bytes.Equal(ffj_key_Hashtag_Indices, kn) { - currentKey = ffj_t_Hashtag_Indices + if bytes.Equal(ffjKeyHashtagIndices, kn) { + currentKey = ffjtHashtagIndices state = fflib.FFParse_want_colon goto mainparse } case 't': - if bytes.Equal(ffj_key_Hashtag_Text, kn) { - currentKey = ffj_t_Hashtag_Text + if bytes.Equal(ffjKeyHashtagText, kn) { + currentKey = ffjtHashtagText state = fflib.FFParse_want_colon goto mainparse } } - if fflib.SimpleLetterEqualFold(ffj_key_Hashtag_Text, kn) { - currentKey = ffj_t_Hashtag_Text + if fflib.SimpleLetterEqualFold(ffjKeyHashtagText, kn) { + currentKey = ffjtHashtagText state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_Hashtag_Indices, kn) { - currentKey = ffj_t_Hashtag_Indices + if fflib.EqualFoldRight(ffjKeyHashtagIndices, kn) { + currentKey = ffjtHashtagIndices state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_Hashtagno_such_key + currentKey = ffjtHashtagnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -677,13 +690,13 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_Hashtag_Indices: + case ffjtHashtagIndices: goto handle_Indices - case ffj_t_Hashtag_Text: + case ffjtHashtagText: goto handle_Text - case ffj_t_Hashtagno_such_key: + case ffjtHashtagnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -699,7 +712,7 @@ mainparse: handle_Indices: - /* handler: uj.Indices type=[]int kind=slice quoted=false*/ + /* handler: j.Indices type=[]int kind=slice quoted=false*/ { @@ -710,16 +723,16 @@ handle_Indices: } if tok == fflib.FFTok_null { - uj.Indices = nil + j.Indices = nil } else { - uj.Indices = make([]int, 0) + j.Indices = []int{} wantVal := true for { - var tmp_uj__Indices int + var tmpJIndices int tok = fs.Scan() if tok == fflib.FFTok_error { @@ -740,7 +753,7 @@ handle_Indices: wantVal = true } - /* handler: tmp_uj__Indices type=int kind=int quoted=false*/ + /* handler: tmpJIndices type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -760,12 +773,13 @@ handle_Indices: return fs.WrapErr(err) } - tmp_uj__Indices = int(tval) + tmpJIndices = int(tval) } } - uj.Indices = append(uj.Indices, tmp_uj__Indices) + j.Indices = append(j.Indices, tmpJIndices) + wantVal = false } } @@ -776,7 +790,7 @@ handle_Indices: handle_Text: - /* handler: uj.Text type=string kind=string quoted=false*/ + /* handler: j.Text type=string kind=string quoted=false*/ { @@ -792,7 +806,7 @@ handle_Text: outBuf := fs.Output.Bytes() - uj.Text = string(string(outBuf)) + j.Text = string(string(outBuf)) } } @@ -814,23 +828,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *LargeStruct) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *LargeStruct) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *LargeStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *LargeStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -842,16 +860,16 @@ func (mj *LargeStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { { - err = mj.SearchMetadata.MarshalJSONBuf(buf) + err = j.SearchMetadata.MarshalJSONBuf(buf) if err != nil { return err } } buf.WriteString(`,"statuses":`) - if mj.Statuses != nil { + if j.Statuses != nil { buf.WriteString(`[`) - for i, v := range mj.Statuses { + for i, v := range j.Statuses { if i != 0 { buf.WriteString(`,`) } @@ -874,26 +892,28 @@ func (mj *LargeStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { } const ( - ffj_t_LargeStructbase = iota - ffj_t_LargeStructno_such_key + ffjtLargeStructbase = iota + ffjtLargeStructnosuchkey - ffj_t_LargeStruct_SearchMetadata + ffjtLargeStructSearchMetadata - ffj_t_LargeStruct_Statuses + ffjtLargeStructStatuses ) -var ffj_key_LargeStruct_SearchMetadata = []byte("search_metadata") +var ffjKeyLargeStructSearchMetadata = []byte("search_metadata") -var ffj_key_LargeStruct_Statuses = []byte("statuses") +var ffjKeyLargeStructStatuses = []byte("statuses") -func (uj *LargeStruct) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *LargeStruct) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *LargeStruct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_LargeStructbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *LargeStruct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtLargeStructbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -939,7 +959,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_LargeStructno_such_key + currentKey = ffjtLargeStructnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -947,32 +967,32 @@ mainparse: case 's': - if bytes.Equal(ffj_key_LargeStruct_SearchMetadata, kn) { - currentKey = ffj_t_LargeStruct_SearchMetadata + if bytes.Equal(ffjKeyLargeStructSearchMetadata, kn) { + currentKey = ffjtLargeStructSearchMetadata state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_LargeStruct_Statuses, kn) { - currentKey = ffj_t_LargeStruct_Statuses + } else if bytes.Equal(ffjKeyLargeStructStatuses, kn) { + currentKey = ffjtLargeStructStatuses state = fflib.FFParse_want_colon goto mainparse } } - if fflib.EqualFoldRight(ffj_key_LargeStruct_Statuses, kn) { - currentKey = ffj_t_LargeStruct_Statuses + if fflib.EqualFoldRight(ffjKeyLargeStructStatuses, kn) { + currentKey = ffjtLargeStructStatuses state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_LargeStruct_SearchMetadata, kn) { - currentKey = ffj_t_LargeStruct_SearchMetadata + if fflib.EqualFoldRight(ffjKeyLargeStructSearchMetadata, kn) { + currentKey = ffjtLargeStructSearchMetadata state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_LargeStructno_such_key + currentKey = ffjtLargeStructnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -989,13 +1009,13 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_LargeStruct_SearchMetadata: + case ffjtLargeStructSearchMetadata: goto handle_SearchMetadata - case ffj_t_LargeStruct_Statuses: + case ffjtLargeStructStatuses: goto handle_Statuses - case ffj_t_LargeStructno_such_key: + case ffjtLargeStructnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -1011,18 +1031,17 @@ mainparse: handle_SearchMetadata: - /* handler: uj.SearchMetadata type=benchmark.SearchMetadata kind=struct quoted=false*/ + /* handler: j.SearchMetadata type=benchmark.SearchMetadata kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = uj.SearchMetadata.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = j.SearchMetadata.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } @@ -1032,7 +1051,7 @@ handle_SearchMetadata: handle_Statuses: - /* handler: uj.Statuses type=[]benchmark.Status kind=slice quoted=false*/ + /* handler: j.Statuses type=[]benchmark.Status kind=slice quoted=false*/ { @@ -1043,16 +1062,16 @@ handle_Statuses: } if tok == fflib.FFTok_null { - uj.Statuses = nil + j.Statuses = nil } else { - uj.Statuses = make([]Status, 0) + j.Statuses = []Status{} wantVal := true for { - var tmp_uj__Statuses Status + var tmpJStatuses Status tok = fs.Scan() if tok == fflib.FFTok_error { @@ -1073,23 +1092,23 @@ handle_Statuses: wantVal = true } - /* handler: tmp_uj__Statuses type=benchmark.Status kind=struct quoted=false*/ + /* handler: tmpJStatuses type=benchmark.Status kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = tmp_uj__Statuses.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = tmpJStatuses.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } - uj.Statuses = append(uj.Statuses, tmp_uj__Statuses) + j.Statuses = append(j.Statuses, tmpJStatuses) + wantVal = false } } @@ -1112,23 +1131,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *SearchMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *SearchMetadata) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *SearchMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *SearchMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -1137,76 +1160,78 @@ func (mj *SearchMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error { _ = obj _ = err buf.WriteString(`{"completed_in":`) - fflib.AppendFloat(buf, float64(mj.CompletedIn), 'g', -1, 64) + fflib.AppendFloat(buf, float64(j.CompletedIn), 'g', -1, 64) buf.WriteString(`,"count":`) - fflib.FormatBits2(buf, uint64(mj.Count), 10, mj.Count < 0) + fflib.FormatBits2(buf, uint64(j.Count), 10, j.Count < 0) buf.WriteString(`,"max_id":`) - fflib.FormatBits2(buf, uint64(mj.MaxID), 10, mj.MaxID < 0) + fflib.FormatBits2(buf, uint64(j.MaxID), 10, j.MaxID < 0) buf.WriteString(`,"max_id_str":`) - fflib.WriteJsonString(buf, string(mj.MaxIDStr)) + fflib.WriteJsonString(buf, string(j.MaxIDStr)) buf.WriteString(`,"next_results":`) - fflib.WriteJsonString(buf, string(mj.NextResults)) + fflib.WriteJsonString(buf, string(j.NextResults)) buf.WriteString(`,"query":`) - fflib.WriteJsonString(buf, string(mj.Query)) + fflib.WriteJsonString(buf, string(j.Query)) buf.WriteString(`,"refresh_url":`) - fflib.WriteJsonString(buf, string(mj.RefreshURL)) + fflib.WriteJsonString(buf, string(j.RefreshURL)) buf.WriteString(`,"since_id":`) - fflib.FormatBits2(buf, uint64(mj.SinceID), 10, mj.SinceID < 0) + fflib.FormatBits2(buf, uint64(j.SinceID), 10, j.SinceID < 0) buf.WriteString(`,"since_id_str":`) - fflib.WriteJsonString(buf, string(mj.SinceIDStr)) + fflib.WriteJsonString(buf, string(j.SinceIDStr)) buf.WriteByte('}') return nil } const ( - ffj_t_SearchMetadatabase = iota - ffj_t_SearchMetadatano_such_key + ffjtSearchMetadatabase = iota + ffjtSearchMetadatanosuchkey - ffj_t_SearchMetadata_CompletedIn + ffjtSearchMetadataCompletedIn - ffj_t_SearchMetadata_Count + ffjtSearchMetadataCount - ffj_t_SearchMetadata_MaxID + ffjtSearchMetadataMaxID - ffj_t_SearchMetadata_MaxIDStr + ffjtSearchMetadataMaxIDStr - ffj_t_SearchMetadata_NextResults + ffjtSearchMetadataNextResults - ffj_t_SearchMetadata_Query + ffjtSearchMetadataQuery - ffj_t_SearchMetadata_RefreshURL + ffjtSearchMetadataRefreshURL - ffj_t_SearchMetadata_SinceID + ffjtSearchMetadataSinceID - ffj_t_SearchMetadata_SinceIDStr + ffjtSearchMetadataSinceIDStr ) -var ffj_key_SearchMetadata_CompletedIn = []byte("completed_in") +var ffjKeySearchMetadataCompletedIn = []byte("completed_in") -var ffj_key_SearchMetadata_Count = []byte("count") +var ffjKeySearchMetadataCount = []byte("count") -var ffj_key_SearchMetadata_MaxID = []byte("max_id") +var ffjKeySearchMetadataMaxID = []byte("max_id") -var ffj_key_SearchMetadata_MaxIDStr = []byte("max_id_str") +var ffjKeySearchMetadataMaxIDStr = []byte("max_id_str") -var ffj_key_SearchMetadata_NextResults = []byte("next_results") +var ffjKeySearchMetadataNextResults = []byte("next_results") -var ffj_key_SearchMetadata_Query = []byte("query") +var ffjKeySearchMetadataQuery = []byte("query") -var ffj_key_SearchMetadata_RefreshURL = []byte("refresh_url") +var ffjKeySearchMetadataRefreshURL = []byte("refresh_url") -var ffj_key_SearchMetadata_SinceID = []byte("since_id") +var ffjKeySearchMetadataSinceID = []byte("since_id") -var ffj_key_SearchMetadata_SinceIDStr = []byte("since_id_str") +var ffjKeySearchMetadataSinceIDStr = []byte("since_id_str") -func (uj *SearchMetadata) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *SearchMetadata) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *SearchMetadata) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_SearchMetadatabase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *SearchMetadata) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtSearchMetadatabase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -1252,7 +1277,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_SearchMetadatano_such_key + currentKey = ffjtSearchMetadatanosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -1260,124 +1285,124 @@ mainparse: case 'c': - if bytes.Equal(ffj_key_SearchMetadata_CompletedIn, kn) { - currentKey = ffj_t_SearchMetadata_CompletedIn + if bytes.Equal(ffjKeySearchMetadataCompletedIn, kn) { + currentKey = ffjtSearchMetadataCompletedIn state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_SearchMetadata_Count, kn) { - currentKey = ffj_t_SearchMetadata_Count + } else if bytes.Equal(ffjKeySearchMetadataCount, kn) { + currentKey = ffjtSearchMetadataCount state = fflib.FFParse_want_colon goto mainparse } case 'm': - if bytes.Equal(ffj_key_SearchMetadata_MaxID, kn) { - currentKey = ffj_t_SearchMetadata_MaxID + if bytes.Equal(ffjKeySearchMetadataMaxID, kn) { + currentKey = ffjtSearchMetadataMaxID state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_SearchMetadata_MaxIDStr, kn) { - currentKey = ffj_t_SearchMetadata_MaxIDStr + } else if bytes.Equal(ffjKeySearchMetadataMaxIDStr, kn) { + currentKey = ffjtSearchMetadataMaxIDStr state = fflib.FFParse_want_colon goto mainparse } case 'n': - if bytes.Equal(ffj_key_SearchMetadata_NextResults, kn) { - currentKey = ffj_t_SearchMetadata_NextResults + if bytes.Equal(ffjKeySearchMetadataNextResults, kn) { + currentKey = ffjtSearchMetadataNextResults state = fflib.FFParse_want_colon goto mainparse } case 'q': - if bytes.Equal(ffj_key_SearchMetadata_Query, kn) { - currentKey = ffj_t_SearchMetadata_Query + if bytes.Equal(ffjKeySearchMetadataQuery, kn) { + currentKey = ffjtSearchMetadataQuery state = fflib.FFParse_want_colon goto mainparse } case 'r': - if bytes.Equal(ffj_key_SearchMetadata_RefreshURL, kn) { - currentKey = ffj_t_SearchMetadata_RefreshURL + if bytes.Equal(ffjKeySearchMetadataRefreshURL, kn) { + currentKey = ffjtSearchMetadataRefreshURL state = fflib.FFParse_want_colon goto mainparse } case 's': - if bytes.Equal(ffj_key_SearchMetadata_SinceID, kn) { - currentKey = ffj_t_SearchMetadata_SinceID + if bytes.Equal(ffjKeySearchMetadataSinceID, kn) { + currentKey = ffjtSearchMetadataSinceID state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_SearchMetadata_SinceIDStr, kn) { - currentKey = ffj_t_SearchMetadata_SinceIDStr + } else if bytes.Equal(ffjKeySearchMetadataSinceIDStr, kn) { + currentKey = ffjtSearchMetadataSinceIDStr state = fflib.FFParse_want_colon goto mainparse } } - if fflib.EqualFoldRight(ffj_key_SearchMetadata_SinceIDStr, kn) { - currentKey = ffj_t_SearchMetadata_SinceIDStr + if fflib.EqualFoldRight(ffjKeySearchMetadataSinceIDStr, kn) { + currentKey = ffjtSearchMetadataSinceIDStr state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_SearchMetadata_SinceID, kn) { - currentKey = ffj_t_SearchMetadata_SinceID + if fflib.EqualFoldRight(ffjKeySearchMetadataSinceID, kn) { + currentKey = ffjtSearchMetadataSinceID state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_SearchMetadata_RefreshURL, kn) { - currentKey = ffj_t_SearchMetadata_RefreshURL + if fflib.EqualFoldRight(ffjKeySearchMetadataRefreshURL, kn) { + currentKey = ffjtSearchMetadataRefreshURL state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_SearchMetadata_Query, kn) { - currentKey = ffj_t_SearchMetadata_Query + if fflib.SimpleLetterEqualFold(ffjKeySearchMetadataQuery, kn) { + currentKey = ffjtSearchMetadataQuery state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_SearchMetadata_NextResults, kn) { - currentKey = ffj_t_SearchMetadata_NextResults + if fflib.EqualFoldRight(ffjKeySearchMetadataNextResults, kn) { + currentKey = ffjtSearchMetadataNextResults state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_SearchMetadata_MaxIDStr, kn) { - currentKey = ffj_t_SearchMetadata_MaxIDStr + if fflib.EqualFoldRight(ffjKeySearchMetadataMaxIDStr, kn) { + currentKey = ffjtSearchMetadataMaxIDStr state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_SearchMetadata_MaxID, kn) { - currentKey = ffj_t_SearchMetadata_MaxID + if fflib.AsciiEqualFold(ffjKeySearchMetadataMaxID, kn) { + currentKey = ffjtSearchMetadataMaxID state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_SearchMetadata_Count, kn) { - currentKey = ffj_t_SearchMetadata_Count + if fflib.SimpleLetterEqualFold(ffjKeySearchMetadataCount, kn) { + currentKey = ffjtSearchMetadataCount state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_SearchMetadata_CompletedIn, kn) { - currentKey = ffj_t_SearchMetadata_CompletedIn + if fflib.AsciiEqualFold(ffjKeySearchMetadataCompletedIn, kn) { + currentKey = ffjtSearchMetadataCompletedIn state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_SearchMetadatano_such_key + currentKey = ffjtSearchMetadatanosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -1394,34 +1419,34 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_SearchMetadata_CompletedIn: + case ffjtSearchMetadataCompletedIn: goto handle_CompletedIn - case ffj_t_SearchMetadata_Count: + case ffjtSearchMetadataCount: goto handle_Count - case ffj_t_SearchMetadata_MaxID: + case ffjtSearchMetadataMaxID: goto handle_MaxID - case ffj_t_SearchMetadata_MaxIDStr: + case ffjtSearchMetadataMaxIDStr: goto handle_MaxIDStr - case ffj_t_SearchMetadata_NextResults: + case ffjtSearchMetadataNextResults: goto handle_NextResults - case ffj_t_SearchMetadata_Query: + case ffjtSearchMetadataQuery: goto handle_Query - case ffj_t_SearchMetadata_RefreshURL: + case ffjtSearchMetadataRefreshURL: goto handle_RefreshURL - case ffj_t_SearchMetadata_SinceID: + case ffjtSearchMetadataSinceID: goto handle_SinceID - case ffj_t_SearchMetadata_SinceIDStr: + case ffjtSearchMetadataSinceIDStr: goto handle_SinceIDStr - case ffj_t_SearchMetadatano_such_key: + case ffjtSearchMetadatanosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -1437,7 +1462,7 @@ mainparse: handle_CompletedIn: - /* handler: uj.CompletedIn type=float64 kind=float64 quoted=false*/ + /* handler: j.CompletedIn type=float64 kind=float64 quoted=false*/ { if tok != fflib.FFTok_double && tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -1457,7 +1482,7 @@ handle_CompletedIn: return fs.WrapErr(err) } - uj.CompletedIn = float64(tval) + j.CompletedIn = float64(tval) } } @@ -1467,7 +1492,7 @@ handle_CompletedIn: handle_Count: - /* handler: uj.Count type=int kind=int quoted=false*/ + /* handler: j.Count type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -1487,7 +1512,7 @@ handle_Count: return fs.WrapErr(err) } - uj.Count = int(tval) + j.Count = int(tval) } } @@ -1497,1030 +1522,7 @@ handle_Count: handle_MaxID: - /* handler: uj.MaxID type=int kind=int quoted=false*/ - - { - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) - } - } - - { - - if tok == fflib.FFTok_null { - - } else { - - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) - - if err != nil { - return fs.WrapErr(err) - } - - uj.MaxID = int(tval) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_MaxIDStr: - - /* handler: uj.MaxIDStr type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - } else { - - outBuf := fs.Output.Bytes() - - uj.MaxIDStr = string(string(outBuf)) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_NextResults: - - /* handler: uj.NextResults type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - } else { - - outBuf := fs.Output.Bytes() - - uj.NextResults = string(string(outBuf)) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_Query: - - /* handler: uj.Query type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - } else { - - outBuf := fs.Output.Bytes() - - uj.Query = string(string(outBuf)) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_RefreshURL: - - /* handler: uj.RefreshURL type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - } else { - - outBuf := fs.Output.Bytes() - - uj.RefreshURL = string(string(outBuf)) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_SinceID: - - /* handler: uj.SinceID type=int kind=int quoted=false*/ - - { - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) - } - } - - { - - if tok == fflib.FFTok_null { - - } else { - - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) - - if err != nil { - return fs.WrapErr(err) - } - - uj.SinceID = int(tval) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_SinceIDStr: - - /* handler: uj.SinceIDStr type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - } else { - - outBuf := fs.Output.Bytes() - - uj.SinceIDStr = string(string(outBuf)) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -wantedvalue: - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) -wrongtokenerror: - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) -tokerror: - if fs.BigError != nil { - return fs.WrapErr(fs.BigError) - } - err = fs.Error.ToError() - if err != nil { - return fs.WrapErr(err) - } - panic("ffjson-generated: unreachable, please report bug.") -done: - return nil -} - -func (mj *Status) MarshalJSON() ([]byte, error) { - var buf fflib.Buffer - if mj == nil { - buf.WriteString("null") - return buf.Bytes(), nil - } - err := mj.MarshalJSONBuf(&buf) - if err != nil { - return nil, err - } - return buf.Bytes(), nil -} -func (mj *Status) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { - buf.WriteString("null") - return nil - } - var err error - var obj []byte - _ = obj - _ = err - if mj.Contributors != nil { - buf.WriteString(`{"contributors":`) - fflib.WriteJsonString(buf, string(*mj.Contributors)) - } else { - buf.WriteString(`{"contributors":null`) - } - if mj.Coordinates != nil { - buf.WriteString(`,"coordinates":`) - fflib.WriteJsonString(buf, string(*mj.Coordinates)) - } else { - buf.WriteString(`,"coordinates":null`) - } - buf.WriteString(`,"created_at":`) - fflib.WriteJsonString(buf, string(mj.CreatedAt)) - buf.WriteString(`,"entities":`) - - { - - err = mj.Entities.MarshalJSONBuf(buf) - if err != nil { - return err - } - - } - if mj.Favorited { - buf.WriteString(`,"favorited":true`) - } else { - buf.WriteString(`,"favorited":false`) - } - if mj.Geo != nil { - buf.WriteString(`,"geo":`) - fflib.WriteJsonString(buf, string(*mj.Geo)) - } else { - buf.WriteString(`,"geo":null`) - } - buf.WriteString(`,"id":`) - fflib.FormatBits2(buf, uint64(mj.ID), 10, mj.ID < 0) - buf.WriteString(`,"id_str":`) - fflib.WriteJsonString(buf, string(mj.IDStr)) - if mj.InReplyToScreenName != nil { - buf.WriteString(`,"in_reply_to_screen_name":`) - fflib.WriteJsonString(buf, string(*mj.InReplyToScreenName)) - } else { - buf.WriteString(`,"in_reply_to_screen_name":null`) - } - if mj.InReplyToStatusID != nil { - buf.WriteString(`,"in_reply_to_status_id":`) - fflib.WriteJsonString(buf, string(*mj.InReplyToStatusID)) - } else { - buf.WriteString(`,"in_reply_to_status_id":null`) - } - if mj.InReplyToStatusIDStr != nil { - buf.WriteString(`,"in_reply_to_status_id_str":`) - fflib.WriteJsonString(buf, string(*mj.InReplyToStatusIDStr)) - } else { - buf.WriteString(`,"in_reply_to_status_id_str":null`) - } - if mj.InReplyToUserID != nil { - buf.WriteString(`,"in_reply_to_user_id":`) - fflib.WriteJsonString(buf, string(*mj.InReplyToUserID)) - } else { - buf.WriteString(`,"in_reply_to_user_id":null`) - } - if mj.InReplyToUserIDStr != nil { - buf.WriteString(`,"in_reply_to_user_id_str":`) - fflib.WriteJsonString(buf, string(*mj.InReplyToUserIDStr)) - } else { - buf.WriteString(`,"in_reply_to_user_id_str":null`) - } - buf.WriteString(`,"metadata":`) - - { - - err = mj.Metadata.MarshalJSONBuf(buf) - if err != nil { - return err - } - - } - if mj.Place != nil { - buf.WriteString(`,"place":`) - fflib.WriteJsonString(buf, string(*mj.Place)) - } else { - buf.WriteString(`,"place":null`) - } - buf.WriteString(`,"retweet_count":`) - fflib.FormatBits2(buf, uint64(mj.RetweetCount), 10, mj.RetweetCount < 0) - if mj.Retweeted { - buf.WriteString(`,"retweeted":true`) - } else { - buf.WriteString(`,"retweeted":false`) - } - buf.WriteString(`,"source":`) - fflib.WriteJsonString(buf, string(mj.Source)) - buf.WriteString(`,"text":`) - fflib.WriteJsonString(buf, string(mj.Text)) - if mj.Truncated { - buf.WriteString(`,"truncated":true`) - } else { - buf.WriteString(`,"truncated":false`) - } - buf.WriteString(`,"user":`) - - { - - err = mj.User.MarshalJSONBuf(buf) - if err != nil { - return err - } - - } - buf.WriteByte('}') - return nil -} - -const ( - ffj_t_Statusbase = iota - ffj_t_Statusno_such_key - - ffj_t_Status_Contributors - - ffj_t_Status_Coordinates - - ffj_t_Status_CreatedAt - - ffj_t_Status_Entities - - ffj_t_Status_Favorited - - ffj_t_Status_Geo - - ffj_t_Status_ID - - ffj_t_Status_IDStr - - ffj_t_Status_InReplyToScreenName - - ffj_t_Status_InReplyToStatusID - - ffj_t_Status_InReplyToStatusIDStr - - ffj_t_Status_InReplyToUserID - - ffj_t_Status_InReplyToUserIDStr - - ffj_t_Status_Metadata - - ffj_t_Status_Place - - ffj_t_Status_RetweetCount - - ffj_t_Status_Retweeted - - ffj_t_Status_Source - - ffj_t_Status_Text - - ffj_t_Status_Truncated - - ffj_t_Status_User -) - -var ffj_key_Status_Contributors = []byte("contributors") - -var ffj_key_Status_Coordinates = []byte("coordinates") - -var ffj_key_Status_CreatedAt = []byte("created_at") - -var ffj_key_Status_Entities = []byte("entities") - -var ffj_key_Status_Favorited = []byte("favorited") - -var ffj_key_Status_Geo = []byte("geo") - -var ffj_key_Status_ID = []byte("id") - -var ffj_key_Status_IDStr = []byte("id_str") - -var ffj_key_Status_InReplyToScreenName = []byte("in_reply_to_screen_name") - -var ffj_key_Status_InReplyToStatusID = []byte("in_reply_to_status_id") - -var ffj_key_Status_InReplyToStatusIDStr = []byte("in_reply_to_status_id_str") - -var ffj_key_Status_InReplyToUserID = []byte("in_reply_to_user_id") - -var ffj_key_Status_InReplyToUserIDStr = []byte("in_reply_to_user_id_str") - -var ffj_key_Status_Metadata = []byte("metadata") - -var ffj_key_Status_Place = []byte("place") - -var ffj_key_Status_RetweetCount = []byte("retweet_count") - -var ffj_key_Status_Retweeted = []byte("retweeted") - -var ffj_key_Status_Source = []byte("source") - -var ffj_key_Status_Text = []byte("text") - -var ffj_key_Status_Truncated = []byte("truncated") - -var ffj_key_Status_User = []byte("user") - -func (uj *Status) UnmarshalJSON(input []byte) error { - fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) -} - -func (uj *Status) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_Statusbase - _ = currentKey - tok := fflib.FFTok_init - wantedTok := fflib.FFTok_init - -mainparse: - for { - tok = fs.Scan() - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) - if tok == fflib.FFTok_error { - goto tokerror - } - - switch state { - - case fflib.FFParse_map_start: - if tok != fflib.FFTok_left_bracket { - wantedTok = fflib.FFTok_left_bracket - goto wrongtokenerror - } - state = fflib.FFParse_want_key - continue - - case fflib.FFParse_after_value: - if tok == fflib.FFTok_comma { - state = fflib.FFParse_want_key - } else if tok == fflib.FFTok_right_bracket { - goto done - } else { - wantedTok = fflib.FFTok_comma - goto wrongtokenerror - } - - case fflib.FFParse_want_key: - // json {} ended. goto exit. woo. - if tok == fflib.FFTok_right_bracket { - goto done - } - if tok != fflib.FFTok_string { - wantedTok = fflib.FFTok_string - goto wrongtokenerror - } - - kn := fs.Output.Bytes() - if len(kn) <= 0 { - // "" case. hrm. - currentKey = ffj_t_Statusno_such_key - state = fflib.FFParse_want_colon - goto mainparse - } else { - switch kn[0] { - - case 'c': - - if bytes.Equal(ffj_key_Status_Contributors, kn) { - currentKey = ffj_t_Status_Contributors - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_Coordinates, kn) { - currentKey = ffj_t_Status_Coordinates - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_CreatedAt, kn) { - currentKey = ffj_t_Status_CreatedAt - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'e': - - if bytes.Equal(ffj_key_Status_Entities, kn) { - currentKey = ffj_t_Status_Entities - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'f': - - if bytes.Equal(ffj_key_Status_Favorited, kn) { - currentKey = ffj_t_Status_Favorited - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'g': - - if bytes.Equal(ffj_key_Status_Geo, kn) { - currentKey = ffj_t_Status_Geo - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'i': - - if bytes.Equal(ffj_key_Status_ID, kn) { - currentKey = ffj_t_Status_ID - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_IDStr, kn) { - currentKey = ffj_t_Status_IDStr - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_InReplyToScreenName, kn) { - currentKey = ffj_t_Status_InReplyToScreenName - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_InReplyToStatusID, kn) { - currentKey = ffj_t_Status_InReplyToStatusID - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_InReplyToStatusIDStr, kn) { - currentKey = ffj_t_Status_InReplyToStatusIDStr - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_InReplyToUserID, kn) { - currentKey = ffj_t_Status_InReplyToUserID - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_InReplyToUserIDStr, kn) { - currentKey = ffj_t_Status_InReplyToUserIDStr - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'm': - - if bytes.Equal(ffj_key_Status_Metadata, kn) { - currentKey = ffj_t_Status_Metadata - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'p': - - if bytes.Equal(ffj_key_Status_Place, kn) { - currentKey = ffj_t_Status_Place - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'r': - - if bytes.Equal(ffj_key_Status_RetweetCount, kn) { - currentKey = ffj_t_Status_RetweetCount - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_Retweeted, kn) { - currentKey = ffj_t_Status_Retweeted - state = fflib.FFParse_want_colon - goto mainparse - } - - case 's': - - if bytes.Equal(ffj_key_Status_Source, kn) { - currentKey = ffj_t_Status_Source - state = fflib.FFParse_want_colon - goto mainparse - } - - case 't': - - if bytes.Equal(ffj_key_Status_Text, kn) { - currentKey = ffj_t_Status_Text - state = fflib.FFParse_want_colon - goto mainparse - - } else if bytes.Equal(ffj_key_Status_Truncated, kn) { - currentKey = ffj_t_Status_Truncated - state = fflib.FFParse_want_colon - goto mainparse - } - - case 'u': - - if bytes.Equal(ffj_key_Status_User, kn) { - currentKey = ffj_t_Status_User - state = fflib.FFParse_want_colon - goto mainparse - } - - } - - if fflib.EqualFoldRight(ffj_key_Status_User, kn) { - currentKey = ffj_t_Status_User - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Truncated, kn) { - currentKey = ffj_t_Status_Truncated - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Text, kn) { - currentKey = ffj_t_Status_Text - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_Source, kn) { - currentKey = ffj_t_Status_Source - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Retweeted, kn) { - currentKey = ffj_t_Status_Retweeted - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.AsciiEqualFold(ffj_key_Status_RetweetCount, kn) { - currentKey = ffj_t_Status_RetweetCount - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Place, kn) { - currentKey = ffj_t_Status_Place - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Metadata, kn) { - currentKey = ffj_t_Status_Metadata - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_InReplyToUserIDStr, kn) { - currentKey = ffj_t_Status_InReplyToUserIDStr - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_InReplyToUserID, kn) { - currentKey = ffj_t_Status_InReplyToUserID - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_InReplyToStatusIDStr, kn) { - currentKey = ffj_t_Status_InReplyToStatusIDStr - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_InReplyToStatusID, kn) { - currentKey = ffj_t_Status_InReplyToStatusID - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_InReplyToScreenName, kn) { - currentKey = ffj_t_Status_InReplyToScreenName - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_IDStr, kn) { - currentKey = ffj_t_Status_IDStr - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_ID, kn) { - currentKey = ffj_t_Status_ID - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Geo, kn) { - currentKey = ffj_t_Status_Geo - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.SimpleLetterEqualFold(ffj_key_Status_Favorited, kn) { - currentKey = ffj_t_Status_Favorited - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_Entities, kn) { - currentKey = ffj_t_Status_Entities - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.AsciiEqualFold(ffj_key_Status_CreatedAt, kn) { - currentKey = ffj_t_Status_CreatedAt - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_Coordinates, kn) { - currentKey = ffj_t_Status_Coordinates - state = fflib.FFParse_want_colon - goto mainparse - } - - if fflib.EqualFoldRight(ffj_key_Status_Contributors, kn) { - currentKey = ffj_t_Status_Contributors - state = fflib.FFParse_want_colon - goto mainparse - } - - currentKey = ffj_t_Statusno_such_key - state = fflib.FFParse_want_colon - goto mainparse - } - - case fflib.FFParse_want_colon: - if tok != fflib.FFTok_colon { - wantedTok = fflib.FFTok_colon - goto wrongtokenerror - } - state = fflib.FFParse_want_value - continue - case fflib.FFParse_want_value: - - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { - switch currentKey { - - case ffj_t_Status_Contributors: - goto handle_Contributors - - case ffj_t_Status_Coordinates: - goto handle_Coordinates - - case ffj_t_Status_CreatedAt: - goto handle_CreatedAt - - case ffj_t_Status_Entities: - goto handle_Entities - - case ffj_t_Status_Favorited: - goto handle_Favorited - - case ffj_t_Status_Geo: - goto handle_Geo - - case ffj_t_Status_ID: - goto handle_ID - - case ffj_t_Status_IDStr: - goto handle_IDStr - - case ffj_t_Status_InReplyToScreenName: - goto handle_InReplyToScreenName - - case ffj_t_Status_InReplyToStatusID: - goto handle_InReplyToStatusID - - case ffj_t_Status_InReplyToStatusIDStr: - goto handle_InReplyToStatusIDStr - - case ffj_t_Status_InReplyToUserID: - goto handle_InReplyToUserID - - case ffj_t_Status_InReplyToUserIDStr: - goto handle_InReplyToUserIDStr - - case ffj_t_Status_Metadata: - goto handle_Metadata - - case ffj_t_Status_Place: - goto handle_Place - - case ffj_t_Status_RetweetCount: - goto handle_RetweetCount - - case ffj_t_Status_Retweeted: - goto handle_Retweeted - - case ffj_t_Status_Source: - goto handle_Source - - case ffj_t_Status_Text: - goto handle_Text - - case ffj_t_Status_Truncated: - goto handle_Truncated - - case ffj_t_Status_User: - goto handle_User - - case ffj_t_Statusno_such_key: - err = fs.SkipField(tok) - if err != nil { - return fs.WrapErr(err) - } - state = fflib.FFParse_after_value - goto mainparse - } - } else { - goto wantedvalue - } - } - } - -handle_Contributors: - - /* handler: uj.Contributors type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - uj.Contributors = nil - - } else { - - var tval string - outBuf := fs.Output.Bytes() - - tval = string(string(outBuf)) - uj.Contributors = &tval - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_Coordinates: - - /* handler: uj.Coordinates type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - uj.Coordinates = nil - - } else { - - var tval string - outBuf := fs.Output.Bytes() - - tval = string(string(outBuf)) - uj.Coordinates = &tval - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_CreatedAt: - - /* handler: uj.CreatedAt type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - } else { - - outBuf := fs.Output.Bytes() - - uj.CreatedAt = string(string(outBuf)) - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_Entities: - - /* handler: uj.Entities type=benchmark.Entities kind=struct quoted=false*/ - - { - if tok == fflib.FFTok_null { - - state = fflib.FFParse_after_value - goto mainparse - } - - err = uj.Entities.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err - } - state = fflib.FFParse_after_value - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_Favorited: - - /* handler: uj.Favorited type=bool kind=bool quoted=false*/ - - { - if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok)) - } - } - - { - if tok == fflib.FFTok_null { - - } else { - tmpb := fs.Output.Bytes() - - if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - - uj.Favorited = true - - } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - - uj.Favorited = false - - } else { - err = errors.New("unexpected bytes for true/false value") - return fs.WrapErr(err) - } - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_Geo: - - /* handler: uj.Geo type=string kind=string quoted=false*/ - - { - - { - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) - } - } - - if tok == fflib.FFTok_null { - - uj.Geo = nil - - } else { - - var tval string - outBuf := fs.Output.Bytes() - - tval = string(string(outBuf)) - uj.Geo = &tval - - } - } - - state = fflib.FFParse_after_value - goto mainparse - -handle_ID: - - /* handler: uj.ID type=int64 kind=int64 quoted=false*/ + /* handler: j.MaxID type=int64 kind=int64 quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -2540,7 +1542,1035 @@ handle_ID: return fs.WrapErr(err) } - uj.ID = int64(tval) + j.MaxID = int64(tval) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_MaxIDStr: + + /* handler: j.MaxIDStr type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + } else { + + outBuf := fs.Output.Bytes() + + j.MaxIDStr = string(string(outBuf)) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_NextResults: + + /* handler: j.NextResults type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + } else { + + outBuf := fs.Output.Bytes() + + j.NextResults = string(string(outBuf)) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_Query: + + /* handler: j.Query type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + } else { + + outBuf := fs.Output.Bytes() + + j.Query = string(string(outBuf)) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_RefreshURL: + + /* handler: j.RefreshURL type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + } else { + + outBuf := fs.Output.Bytes() + + j.RefreshURL = string(string(outBuf)) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_SinceID: + + /* handler: j.SinceID type=int64 kind=int64 quoted=false*/ + + { + if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int64", tok)) + } + } + + { + + if tok == fflib.FFTok_null { + + } else { + + tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) + + if err != nil { + return fs.WrapErr(err) + } + + j.SinceID = int64(tval) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_SinceIDStr: + + /* handler: j.SinceIDStr type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + } else { + + outBuf := fs.Output.Bytes() + + j.SinceIDStr = string(string(outBuf)) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +wantedvalue: + return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) +wrongtokenerror: + return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) +tokerror: + if fs.BigError != nil { + return fs.WrapErr(fs.BigError) + } + err = fs.Error.ToError() + if err != nil { + return fs.WrapErr(err) + } + panic("ffjson-generated: unreachable, please report bug.") +done: + + return nil +} + +// MarshalJSON marshal bytes to json - template +func (j *Status) MarshalJSON() ([]byte, error) { + var buf fflib.Buffer + if j == nil { + buf.WriteString("null") + return buf.Bytes(), nil + } + err := j.MarshalJSONBuf(&buf) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// MarshalJSONBuf marshal buff to json - template +func (j *Status) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { + buf.WriteString("null") + return nil + } + var err error + var obj []byte + _ = obj + _ = err + if j.Contributors != nil { + buf.WriteString(`{"contributors":`) + fflib.WriteJsonString(buf, string(*j.Contributors)) + } else { + buf.WriteString(`{"contributors":null`) + } + if j.Coordinates != nil { + buf.WriteString(`,"coordinates":`) + fflib.WriteJsonString(buf, string(*j.Coordinates)) + } else { + buf.WriteString(`,"coordinates":null`) + } + buf.WriteString(`,"created_at":`) + fflib.WriteJsonString(buf, string(j.CreatedAt)) + buf.WriteString(`,"entities":`) + + { + + err = j.Entities.MarshalJSONBuf(buf) + if err != nil { + return err + } + + } + if j.Favorited { + buf.WriteString(`,"favorited":true`) + } else { + buf.WriteString(`,"favorited":false`) + } + if j.Geo != nil { + buf.WriteString(`,"geo":`) + fflib.WriteJsonString(buf, string(*j.Geo)) + } else { + buf.WriteString(`,"geo":null`) + } + buf.WriteString(`,"id":`) + fflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0) + buf.WriteString(`,"id_str":`) + fflib.WriteJsonString(buf, string(j.IDStr)) + if j.InReplyToScreenName != nil { + buf.WriteString(`,"in_reply_to_screen_name":`) + fflib.WriteJsonString(buf, string(*j.InReplyToScreenName)) + } else { + buf.WriteString(`,"in_reply_to_screen_name":null`) + } + if j.InReplyToStatusID != nil { + buf.WriteString(`,"in_reply_to_status_id":`) + fflib.WriteJsonString(buf, string(*j.InReplyToStatusID)) + } else { + buf.WriteString(`,"in_reply_to_status_id":null`) + } + if j.InReplyToStatusIDStr != nil { + buf.WriteString(`,"in_reply_to_status_id_str":`) + fflib.WriteJsonString(buf, string(*j.InReplyToStatusIDStr)) + } else { + buf.WriteString(`,"in_reply_to_status_id_str":null`) + } + if j.InReplyToUserID != nil { + buf.WriteString(`,"in_reply_to_user_id":`) + fflib.WriteJsonString(buf, string(*j.InReplyToUserID)) + } else { + buf.WriteString(`,"in_reply_to_user_id":null`) + } + if j.InReplyToUserIDStr != nil { + buf.WriteString(`,"in_reply_to_user_id_str":`) + fflib.WriteJsonString(buf, string(*j.InReplyToUserIDStr)) + } else { + buf.WriteString(`,"in_reply_to_user_id_str":null`) + } + buf.WriteString(`,"metadata":`) + + { + + err = j.Metadata.MarshalJSONBuf(buf) + if err != nil { + return err + } + + } + if j.Place != nil { + buf.WriteString(`,"place":`) + fflib.WriteJsonString(buf, string(*j.Place)) + } else { + buf.WriteString(`,"place":null`) + } + buf.WriteString(`,"retweet_count":`) + fflib.FormatBits2(buf, uint64(j.RetweetCount), 10, j.RetweetCount < 0) + if j.Retweeted { + buf.WriteString(`,"retweeted":true`) + } else { + buf.WriteString(`,"retweeted":false`) + } + buf.WriteString(`,"source":`) + fflib.WriteJsonString(buf, string(j.Source)) + buf.WriteString(`,"text":`) + fflib.WriteJsonString(buf, string(j.Text)) + if j.Truncated { + buf.WriteString(`,"truncated":true`) + } else { + buf.WriteString(`,"truncated":false`) + } + buf.WriteString(`,"user":`) + + { + + err = j.User.MarshalJSONBuf(buf) + if err != nil { + return err + } + + } + buf.WriteByte('}') + return nil +} + +const ( + ffjtStatusbase = iota + ffjtStatusnosuchkey + + ffjtStatusContributors + + ffjtStatusCoordinates + + ffjtStatusCreatedAt + + ffjtStatusEntities + + ffjtStatusFavorited + + ffjtStatusGeo + + ffjtStatusID + + ffjtStatusIDStr + + ffjtStatusInReplyToScreenName + + ffjtStatusInReplyToStatusID + + ffjtStatusInReplyToStatusIDStr + + ffjtStatusInReplyToUserID + + ffjtStatusInReplyToUserIDStr + + ffjtStatusMetadata + + ffjtStatusPlace + + ffjtStatusRetweetCount + + ffjtStatusRetweeted + + ffjtStatusSource + + ffjtStatusText + + ffjtStatusTruncated + + ffjtStatusUser +) + +var ffjKeyStatusContributors = []byte("contributors") + +var ffjKeyStatusCoordinates = []byte("coordinates") + +var ffjKeyStatusCreatedAt = []byte("created_at") + +var ffjKeyStatusEntities = []byte("entities") + +var ffjKeyStatusFavorited = []byte("favorited") + +var ffjKeyStatusGeo = []byte("geo") + +var ffjKeyStatusID = []byte("id") + +var ffjKeyStatusIDStr = []byte("id_str") + +var ffjKeyStatusInReplyToScreenName = []byte("in_reply_to_screen_name") + +var ffjKeyStatusInReplyToStatusID = []byte("in_reply_to_status_id") + +var ffjKeyStatusInReplyToStatusIDStr = []byte("in_reply_to_status_id_str") + +var ffjKeyStatusInReplyToUserID = []byte("in_reply_to_user_id") + +var ffjKeyStatusInReplyToUserIDStr = []byte("in_reply_to_user_id_str") + +var ffjKeyStatusMetadata = []byte("metadata") + +var ffjKeyStatusPlace = []byte("place") + +var ffjKeyStatusRetweetCount = []byte("retweet_count") + +var ffjKeyStatusRetweeted = []byte("retweeted") + +var ffjKeyStatusSource = []byte("source") + +var ffjKeyStatusText = []byte("text") + +var ffjKeyStatusTruncated = []byte("truncated") + +var ffjKeyStatusUser = []byte("user") + +// UnmarshalJSON umarshall json - template of ffjson +func (j *Status) UnmarshalJSON(input []byte) error { + fs := fflib.NewFFLexer(input) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) +} + +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *Status) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtStatusbase + _ = currentKey + tok := fflib.FFTok_init + wantedTok := fflib.FFTok_init + +mainparse: + for { + tok = fs.Scan() + // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) + if tok == fflib.FFTok_error { + goto tokerror + } + + switch state { + + case fflib.FFParse_map_start: + if tok != fflib.FFTok_left_bracket { + wantedTok = fflib.FFTok_left_bracket + goto wrongtokenerror + } + state = fflib.FFParse_want_key + continue + + case fflib.FFParse_after_value: + if tok == fflib.FFTok_comma { + state = fflib.FFParse_want_key + } else if tok == fflib.FFTok_right_bracket { + goto done + } else { + wantedTok = fflib.FFTok_comma + goto wrongtokenerror + } + + case fflib.FFParse_want_key: + // json {} ended. goto exit. woo. + if tok == fflib.FFTok_right_bracket { + goto done + } + if tok != fflib.FFTok_string { + wantedTok = fflib.FFTok_string + goto wrongtokenerror + } + + kn := fs.Output.Bytes() + if len(kn) <= 0 { + // "" case. hrm. + currentKey = ffjtStatusnosuchkey + state = fflib.FFParse_want_colon + goto mainparse + } else { + switch kn[0] { + + case 'c': + + if bytes.Equal(ffjKeyStatusContributors, kn) { + currentKey = ffjtStatusContributors + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusCoordinates, kn) { + currentKey = ffjtStatusCoordinates + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusCreatedAt, kn) { + currentKey = ffjtStatusCreatedAt + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'e': + + if bytes.Equal(ffjKeyStatusEntities, kn) { + currentKey = ffjtStatusEntities + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'f': + + if bytes.Equal(ffjKeyStatusFavorited, kn) { + currentKey = ffjtStatusFavorited + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'g': + + if bytes.Equal(ffjKeyStatusGeo, kn) { + currentKey = ffjtStatusGeo + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'i': + + if bytes.Equal(ffjKeyStatusID, kn) { + currentKey = ffjtStatusID + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusIDStr, kn) { + currentKey = ffjtStatusIDStr + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusInReplyToScreenName, kn) { + currentKey = ffjtStatusInReplyToScreenName + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusInReplyToStatusID, kn) { + currentKey = ffjtStatusInReplyToStatusID + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusInReplyToStatusIDStr, kn) { + currentKey = ffjtStatusInReplyToStatusIDStr + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusInReplyToUserID, kn) { + currentKey = ffjtStatusInReplyToUserID + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusInReplyToUserIDStr, kn) { + currentKey = ffjtStatusInReplyToUserIDStr + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'm': + + if bytes.Equal(ffjKeyStatusMetadata, kn) { + currentKey = ffjtStatusMetadata + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'p': + + if bytes.Equal(ffjKeyStatusPlace, kn) { + currentKey = ffjtStatusPlace + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'r': + + if bytes.Equal(ffjKeyStatusRetweetCount, kn) { + currentKey = ffjtStatusRetweetCount + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusRetweeted, kn) { + currentKey = ffjtStatusRetweeted + state = fflib.FFParse_want_colon + goto mainparse + } + + case 's': + + if bytes.Equal(ffjKeyStatusSource, kn) { + currentKey = ffjtStatusSource + state = fflib.FFParse_want_colon + goto mainparse + } + + case 't': + + if bytes.Equal(ffjKeyStatusText, kn) { + currentKey = ffjtStatusText + state = fflib.FFParse_want_colon + goto mainparse + + } else if bytes.Equal(ffjKeyStatusTruncated, kn) { + currentKey = ffjtStatusTruncated + state = fflib.FFParse_want_colon + goto mainparse + } + + case 'u': + + if bytes.Equal(ffjKeyStatusUser, kn) { + currentKey = ffjtStatusUser + state = fflib.FFParse_want_colon + goto mainparse + } + + } + + if fflib.EqualFoldRight(ffjKeyStatusUser, kn) { + currentKey = ffjtStatusUser + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusTruncated, kn) { + currentKey = ffjtStatusTruncated + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusText, kn) { + currentKey = ffjtStatusText + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusSource, kn) { + currentKey = ffjtStatusSource + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusRetweeted, kn) { + currentKey = ffjtStatusRetweeted + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.AsciiEqualFold(ffjKeyStatusRetweetCount, kn) { + currentKey = ffjtStatusRetweetCount + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusPlace, kn) { + currentKey = ffjtStatusPlace + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusMetadata, kn) { + currentKey = ffjtStatusMetadata + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusInReplyToUserIDStr, kn) { + currentKey = ffjtStatusInReplyToUserIDStr + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusInReplyToUserID, kn) { + currentKey = ffjtStatusInReplyToUserID + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusInReplyToStatusIDStr, kn) { + currentKey = ffjtStatusInReplyToStatusIDStr + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusInReplyToStatusID, kn) { + currentKey = ffjtStatusInReplyToStatusID + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusInReplyToScreenName, kn) { + currentKey = ffjtStatusInReplyToScreenName + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusIDStr, kn) { + currentKey = ffjtStatusIDStr + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusID, kn) { + currentKey = ffjtStatusID + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusGeo, kn) { + currentKey = ffjtStatusGeo + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.SimpleLetterEqualFold(ffjKeyStatusFavorited, kn) { + currentKey = ffjtStatusFavorited + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusEntities, kn) { + currentKey = ffjtStatusEntities + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.AsciiEqualFold(ffjKeyStatusCreatedAt, kn) { + currentKey = ffjtStatusCreatedAt + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusCoordinates, kn) { + currentKey = ffjtStatusCoordinates + state = fflib.FFParse_want_colon + goto mainparse + } + + if fflib.EqualFoldRight(ffjKeyStatusContributors, kn) { + currentKey = ffjtStatusContributors + state = fflib.FFParse_want_colon + goto mainparse + } + + currentKey = ffjtStatusnosuchkey + state = fflib.FFParse_want_colon + goto mainparse + } + + case fflib.FFParse_want_colon: + if tok != fflib.FFTok_colon { + wantedTok = fflib.FFTok_colon + goto wrongtokenerror + } + state = fflib.FFParse_want_value + continue + case fflib.FFParse_want_value: + + if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { + switch currentKey { + + case ffjtStatusContributors: + goto handle_Contributors + + case ffjtStatusCoordinates: + goto handle_Coordinates + + case ffjtStatusCreatedAt: + goto handle_CreatedAt + + case ffjtStatusEntities: + goto handle_Entities + + case ffjtStatusFavorited: + goto handle_Favorited + + case ffjtStatusGeo: + goto handle_Geo + + case ffjtStatusID: + goto handle_ID + + case ffjtStatusIDStr: + goto handle_IDStr + + case ffjtStatusInReplyToScreenName: + goto handle_InReplyToScreenName + + case ffjtStatusInReplyToStatusID: + goto handle_InReplyToStatusID + + case ffjtStatusInReplyToStatusIDStr: + goto handle_InReplyToStatusIDStr + + case ffjtStatusInReplyToUserID: + goto handle_InReplyToUserID + + case ffjtStatusInReplyToUserIDStr: + goto handle_InReplyToUserIDStr + + case ffjtStatusMetadata: + goto handle_Metadata + + case ffjtStatusPlace: + goto handle_Place + + case ffjtStatusRetweetCount: + goto handle_RetweetCount + + case ffjtStatusRetweeted: + goto handle_Retweeted + + case ffjtStatusSource: + goto handle_Source + + case ffjtStatusText: + goto handle_Text + + case ffjtStatusTruncated: + goto handle_Truncated + + case ffjtStatusUser: + goto handle_User + + case ffjtStatusnosuchkey: + err = fs.SkipField(tok) + if err != nil { + return fs.WrapErr(err) + } + state = fflib.FFParse_after_value + goto mainparse + } + } else { + goto wantedvalue + } + } + } + +handle_Contributors: + + /* handler: j.Contributors type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + j.Contributors = nil + + } else { + + var tval string + outBuf := fs.Output.Bytes() + + tval = string(string(outBuf)) + j.Contributors = &tval + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_Coordinates: + + /* handler: j.Coordinates type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + j.Coordinates = nil + + } else { + + var tval string + outBuf := fs.Output.Bytes() + + tval = string(string(outBuf)) + j.Coordinates = &tval + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_CreatedAt: + + /* handler: j.CreatedAt type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + } else { + + outBuf := fs.Output.Bytes() + + j.CreatedAt = string(string(outBuf)) + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_Entities: + + /* handler: j.Entities type=benchmark.Entities kind=struct quoted=false*/ + + { + if tok == fflib.FFTok_null { + + } else { + + err = j.Entities.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } + } + state = fflib.FFParse_after_value + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_Favorited: + + /* handler: j.Favorited type=bool kind=bool quoted=false*/ + + { + if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok)) + } + } + + { + if tok == fflib.FFTok_null { + + } else { + tmpb := fs.Output.Bytes() + + if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { + + j.Favorited = true + + } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { + + j.Favorited = false + + } else { + err = errors.New("unexpected bytes for true/false value") + return fs.WrapErr(err) + } + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_Geo: + + /* handler: j.Geo type=string kind=string quoted=false*/ + + { + + { + if tok != fflib.FFTok_string && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) + } + } + + if tok == fflib.FFTok_null { + + j.Geo = nil + + } else { + + var tval string + outBuf := fs.Output.Bytes() + + tval = string(string(outBuf)) + j.Geo = &tval + + } + } + + state = fflib.FFParse_after_value + goto mainparse + +handle_ID: + + /* handler: j.ID type=int64 kind=int64 quoted=false*/ + + { + if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { + return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int64", tok)) + } + } + + { + + if tok == fflib.FFTok_null { + + } else { + + tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) + + if err != nil { + return fs.WrapErr(err) + } + + j.ID = int64(tval) } } @@ -2550,7 +2580,7 @@ handle_ID: handle_IDStr: - /* handler: uj.IDStr type=string kind=string quoted=false*/ + /* handler: j.IDStr type=string kind=string quoted=false*/ { @@ -2566,7 +2596,7 @@ handle_IDStr: outBuf := fs.Output.Bytes() - uj.IDStr = string(string(outBuf)) + j.IDStr = string(string(outBuf)) } } @@ -2576,7 +2606,7 @@ handle_IDStr: handle_InReplyToScreenName: - /* handler: uj.InReplyToScreenName type=string kind=string quoted=false*/ + /* handler: j.InReplyToScreenName type=string kind=string quoted=false*/ { @@ -2588,7 +2618,7 @@ handle_InReplyToScreenName: if tok == fflib.FFTok_null { - uj.InReplyToScreenName = nil + j.InReplyToScreenName = nil } else { @@ -2596,7 +2626,7 @@ handle_InReplyToScreenName: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.InReplyToScreenName = &tval + j.InReplyToScreenName = &tval } } @@ -2606,7 +2636,7 @@ handle_InReplyToScreenName: handle_InReplyToStatusID: - /* handler: uj.InReplyToStatusID type=string kind=string quoted=false*/ + /* handler: j.InReplyToStatusID type=string kind=string quoted=false*/ { @@ -2618,7 +2648,7 @@ handle_InReplyToStatusID: if tok == fflib.FFTok_null { - uj.InReplyToStatusID = nil + j.InReplyToStatusID = nil } else { @@ -2626,7 +2656,7 @@ handle_InReplyToStatusID: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.InReplyToStatusID = &tval + j.InReplyToStatusID = &tval } } @@ -2636,7 +2666,7 @@ handle_InReplyToStatusID: handle_InReplyToStatusIDStr: - /* handler: uj.InReplyToStatusIDStr type=string kind=string quoted=false*/ + /* handler: j.InReplyToStatusIDStr type=string kind=string quoted=false*/ { @@ -2648,7 +2678,7 @@ handle_InReplyToStatusIDStr: if tok == fflib.FFTok_null { - uj.InReplyToStatusIDStr = nil + j.InReplyToStatusIDStr = nil } else { @@ -2656,7 +2686,7 @@ handle_InReplyToStatusIDStr: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.InReplyToStatusIDStr = &tval + j.InReplyToStatusIDStr = &tval } } @@ -2666,7 +2696,7 @@ handle_InReplyToStatusIDStr: handle_InReplyToUserID: - /* handler: uj.InReplyToUserID type=string kind=string quoted=false*/ + /* handler: j.InReplyToUserID type=string kind=string quoted=false*/ { @@ -2678,7 +2708,7 @@ handle_InReplyToUserID: if tok == fflib.FFTok_null { - uj.InReplyToUserID = nil + j.InReplyToUserID = nil } else { @@ -2686,7 +2716,7 @@ handle_InReplyToUserID: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.InReplyToUserID = &tval + j.InReplyToUserID = &tval } } @@ -2696,7 +2726,7 @@ handle_InReplyToUserID: handle_InReplyToUserIDStr: - /* handler: uj.InReplyToUserIDStr type=string kind=string quoted=false*/ + /* handler: j.InReplyToUserIDStr type=string kind=string quoted=false*/ { @@ -2708,7 +2738,7 @@ handle_InReplyToUserIDStr: if tok == fflib.FFTok_null { - uj.InReplyToUserIDStr = nil + j.InReplyToUserIDStr = nil } else { @@ -2716,7 +2746,7 @@ handle_InReplyToUserIDStr: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.InReplyToUserIDStr = &tval + j.InReplyToUserIDStr = &tval } } @@ -2726,18 +2756,17 @@ handle_InReplyToUserIDStr: handle_Metadata: - /* handler: uj.Metadata type=benchmark.StatusMetadata kind=struct quoted=false*/ + /* handler: j.Metadata type=benchmark.StatusMetadata kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = uj.Metadata.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = j.Metadata.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } @@ -2747,7 +2776,7 @@ handle_Metadata: handle_Place: - /* handler: uj.Place type=string kind=string quoted=false*/ + /* handler: j.Place type=string kind=string quoted=false*/ { @@ -2759,7 +2788,7 @@ handle_Place: if tok == fflib.FFTok_null { - uj.Place = nil + j.Place = nil } else { @@ -2767,7 +2796,7 @@ handle_Place: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.Place = &tval + j.Place = &tval } } @@ -2777,7 +2806,7 @@ handle_Place: handle_RetweetCount: - /* handler: uj.RetweetCount type=int kind=int quoted=false*/ + /* handler: j.RetweetCount type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -2797,7 +2826,7 @@ handle_RetweetCount: return fs.WrapErr(err) } - uj.RetweetCount = int(tval) + j.RetweetCount = int(tval) } } @@ -2807,7 +2836,7 @@ handle_RetweetCount: handle_Retweeted: - /* handler: uj.Retweeted type=bool kind=bool quoted=false*/ + /* handler: j.Retweeted type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -2823,11 +2852,11 @@ handle_Retweeted: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.Retweeted = true + j.Retweeted = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.Retweeted = false + j.Retweeted = false } else { err = errors.New("unexpected bytes for true/false value") @@ -2842,7 +2871,7 @@ handle_Retweeted: handle_Source: - /* handler: uj.Source type=string kind=string quoted=false*/ + /* handler: j.Source type=string kind=string quoted=false*/ { @@ -2858,7 +2887,7 @@ handle_Source: outBuf := fs.Output.Bytes() - uj.Source = string(string(outBuf)) + j.Source = string(string(outBuf)) } } @@ -2868,7 +2897,7 @@ handle_Source: handle_Text: - /* handler: uj.Text type=string kind=string quoted=false*/ + /* handler: j.Text type=string kind=string quoted=false*/ { @@ -2884,7 +2913,7 @@ handle_Text: outBuf := fs.Output.Bytes() - uj.Text = string(string(outBuf)) + j.Text = string(string(outBuf)) } } @@ -2894,7 +2923,7 @@ handle_Text: handle_Truncated: - /* handler: uj.Truncated type=bool kind=bool quoted=false*/ + /* handler: j.Truncated type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -2910,11 +2939,11 @@ handle_Truncated: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.Truncated = true + j.Truncated = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.Truncated = false + j.Truncated = false } else { err = errors.New("unexpected bytes for true/false value") @@ -2929,18 +2958,17 @@ handle_Truncated: handle_User: - /* handler: uj.User type=benchmark.User kind=struct quoted=false*/ + /* handler: j.User type=benchmark.User kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = uj.User.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = j.User.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } @@ -2962,23 +2990,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *StatusMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *StatusMetadata) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *StatusMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *StatusMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -2987,34 +3019,36 @@ func (mj *StatusMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error { _ = obj _ = err buf.WriteString(`{"iso_language_code":`) - fflib.WriteJsonString(buf, string(mj.IsoLanguageCode)) + fflib.WriteJsonString(buf, string(j.IsoLanguageCode)) buf.WriteString(`,"result_type":`) - fflib.WriteJsonString(buf, string(mj.ResultType)) + fflib.WriteJsonString(buf, string(j.ResultType)) buf.WriteByte('}') return nil } const ( - ffj_t_StatusMetadatabase = iota - ffj_t_StatusMetadatano_such_key + ffjtStatusMetadatabase = iota + ffjtStatusMetadatanosuchkey - ffj_t_StatusMetadata_IsoLanguageCode + ffjtStatusMetadataIsoLanguageCode - ffj_t_StatusMetadata_ResultType + ffjtStatusMetadataResultType ) -var ffj_key_StatusMetadata_IsoLanguageCode = []byte("iso_language_code") +var ffjKeyStatusMetadataIsoLanguageCode = []byte("iso_language_code") -var ffj_key_StatusMetadata_ResultType = []byte("result_type") +var ffjKeyStatusMetadataResultType = []byte("result_type") -func (uj *StatusMetadata) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *StatusMetadata) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *StatusMetadata) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_StatusMetadatabase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *StatusMetadata) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtStatusMetadatabase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -3060,7 +3094,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_StatusMetadatano_such_key + currentKey = ffjtStatusMetadatanosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -3068,35 +3102,35 @@ mainparse: case 'i': - if bytes.Equal(ffj_key_StatusMetadata_IsoLanguageCode, kn) { - currentKey = ffj_t_StatusMetadata_IsoLanguageCode + if bytes.Equal(ffjKeyStatusMetadataIsoLanguageCode, kn) { + currentKey = ffjtStatusMetadataIsoLanguageCode state = fflib.FFParse_want_colon goto mainparse } case 'r': - if bytes.Equal(ffj_key_StatusMetadata_ResultType, kn) { - currentKey = ffj_t_StatusMetadata_ResultType + if bytes.Equal(ffjKeyStatusMetadataResultType, kn) { + currentKey = ffjtStatusMetadataResultType state = fflib.FFParse_want_colon goto mainparse } } - if fflib.EqualFoldRight(ffj_key_StatusMetadata_ResultType, kn) { - currentKey = ffj_t_StatusMetadata_ResultType + if fflib.EqualFoldRight(ffjKeyStatusMetadataResultType, kn) { + currentKey = ffjtStatusMetadataResultType state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_StatusMetadata_IsoLanguageCode, kn) { - currentKey = ffj_t_StatusMetadata_IsoLanguageCode + if fflib.EqualFoldRight(ffjKeyStatusMetadataIsoLanguageCode, kn) { + currentKey = ffjtStatusMetadataIsoLanguageCode state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_StatusMetadatano_such_key + currentKey = ffjtStatusMetadatanosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -3113,13 +3147,13 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_StatusMetadata_IsoLanguageCode: + case ffjtStatusMetadataIsoLanguageCode: goto handle_IsoLanguageCode - case ffj_t_StatusMetadata_ResultType: + case ffjtStatusMetadataResultType: goto handle_ResultType - case ffj_t_StatusMetadatano_such_key: + case ffjtStatusMetadatanosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -3135,7 +3169,7 @@ mainparse: handle_IsoLanguageCode: - /* handler: uj.IsoLanguageCode type=string kind=string quoted=false*/ + /* handler: j.IsoLanguageCode type=string kind=string quoted=false*/ { @@ -3151,7 +3185,7 @@ handle_IsoLanguageCode: outBuf := fs.Output.Bytes() - uj.IsoLanguageCode = string(string(outBuf)) + j.IsoLanguageCode = string(string(outBuf)) } } @@ -3161,7 +3195,7 @@ handle_IsoLanguageCode: handle_ResultType: - /* handler: uj.ResultType type=string kind=string quoted=false*/ + /* handler: j.ResultType type=string kind=string quoted=false*/ { @@ -3177,7 +3211,7 @@ handle_ResultType: outBuf := fs.Output.Bytes() - uj.ResultType = string(string(outBuf)) + j.ResultType = string(string(outBuf)) } } @@ -3199,23 +3233,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *URL) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *URL) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *URL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *URL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -3223,16 +3261,16 @@ func (mj *URL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { var obj []byte _ = obj _ = err - if mj.ExpandedURL != nil { + if j.ExpandedURL != nil { buf.WriteString(`{"expanded_url":`) - fflib.WriteJsonString(buf, string(*mj.ExpandedURL)) + fflib.WriteJsonString(buf, string(*j.ExpandedURL)) } else { buf.WriteString(`{"expanded_url":null`) } buf.WriteString(`,"indices":`) - if mj.Indices != nil { + if j.Indices != nil { buf.WriteString(`[`) - for i, v := range mj.Indices { + for i, v := range j.Indices { if i != 0 { buf.WriteString(`,`) } @@ -3243,36 +3281,38 @@ func (mj *URL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { buf.WriteString(`null`) } buf.WriteString(`,"url":`) - fflib.WriteJsonString(buf, string(mj.URL)) + fflib.WriteJsonString(buf, string(j.URL)) buf.WriteByte('}') return nil } const ( - ffj_t_URLbase = iota - ffj_t_URLno_such_key + ffjtURLbase = iota + ffjtURLnosuchkey - ffj_t_URL_ExpandedURL + ffjtURLExpandedURL - ffj_t_URL_Indices + ffjtURLIndices - ffj_t_URL_URL + ffjtURLURL ) -var ffj_key_URL_ExpandedURL = []byte("expanded_url") +var ffjKeyURLExpandedURL = []byte("expanded_url") -var ffj_key_URL_Indices = []byte("indices") +var ffjKeyURLIndices = []byte("indices") -var ffj_key_URL_URL = []byte("url") +var ffjKeyURLURL = []byte("url") -func (uj *URL) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *URL) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *URL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_URLbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *URL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtURLbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -3318,7 +3358,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_URLno_such_key + currentKey = ffjtURLnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -3326,49 +3366,49 @@ mainparse: case 'e': - if bytes.Equal(ffj_key_URL_ExpandedURL, kn) { - currentKey = ffj_t_URL_ExpandedURL + if bytes.Equal(ffjKeyURLExpandedURL, kn) { + currentKey = ffjtURLExpandedURL state = fflib.FFParse_want_colon goto mainparse } case 'i': - if bytes.Equal(ffj_key_URL_Indices, kn) { - currentKey = ffj_t_URL_Indices + if bytes.Equal(ffjKeyURLIndices, kn) { + currentKey = ffjtURLIndices state = fflib.FFParse_want_colon goto mainparse } case 'u': - if bytes.Equal(ffj_key_URL_URL, kn) { - currentKey = ffj_t_URL_URL + if bytes.Equal(ffjKeyURLURL, kn) { + currentKey = ffjtURLURL state = fflib.FFParse_want_colon goto mainparse } } - if fflib.SimpleLetterEqualFold(ffj_key_URL_URL, kn) { - currentKey = ffj_t_URL_URL + if fflib.SimpleLetterEqualFold(ffjKeyURLURL, kn) { + currentKey = ffjtURLURL state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_URL_Indices, kn) { - currentKey = ffj_t_URL_Indices + if fflib.EqualFoldRight(ffjKeyURLIndices, kn) { + currentKey = ffjtURLIndices state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_URL_ExpandedURL, kn) { - currentKey = ffj_t_URL_ExpandedURL + if fflib.AsciiEqualFold(ffjKeyURLExpandedURL, kn) { + currentKey = ffjtURLExpandedURL state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_URLno_such_key + currentKey = ffjtURLnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -3385,16 +3425,16 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_URL_ExpandedURL: + case ffjtURLExpandedURL: goto handle_ExpandedURL - case ffj_t_URL_Indices: + case ffjtURLIndices: goto handle_Indices - case ffj_t_URL_URL: + case ffjtURLURL: goto handle_URL - case ffj_t_URLno_such_key: + case ffjtURLnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -3410,7 +3450,7 @@ mainparse: handle_ExpandedURL: - /* handler: uj.ExpandedURL type=string kind=string quoted=false*/ + /* handler: j.ExpandedURL type=string kind=string quoted=false*/ { @@ -3422,7 +3462,7 @@ handle_ExpandedURL: if tok == fflib.FFTok_null { - uj.ExpandedURL = nil + j.ExpandedURL = nil } else { @@ -3430,7 +3470,7 @@ handle_ExpandedURL: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.ExpandedURL = &tval + j.ExpandedURL = &tval } } @@ -3440,7 +3480,7 @@ handle_ExpandedURL: handle_Indices: - /* handler: uj.Indices type=[]int kind=slice quoted=false*/ + /* handler: j.Indices type=[]int kind=slice quoted=false*/ { @@ -3451,16 +3491,16 @@ handle_Indices: } if tok == fflib.FFTok_null { - uj.Indices = nil + j.Indices = nil } else { - uj.Indices = make([]int, 0) + j.Indices = []int{} wantVal := true for { - var tmp_uj__Indices int + var tmpJIndices int tok = fs.Scan() if tok == fflib.FFTok_error { @@ -3481,7 +3521,7 @@ handle_Indices: wantVal = true } - /* handler: tmp_uj__Indices type=int kind=int quoted=false*/ + /* handler: tmpJIndices type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -3501,12 +3541,13 @@ handle_Indices: return fs.WrapErr(err) } - tmp_uj__Indices = int(tval) + tmpJIndices = int(tval) } } - uj.Indices = append(uj.Indices, tmp_uj__Indices) + j.Indices = append(j.Indices, tmpJIndices) + wantVal = false } } @@ -3517,7 +3558,7 @@ handle_Indices: handle_URL: - /* handler: uj.URL type=string kind=string quoted=false*/ + /* handler: j.URL type=string kind=string quoted=false*/ { @@ -3533,7 +3574,7 @@ handle_URL: outBuf := fs.Output.Bytes() - uj.URL = string(string(outBuf)) + j.URL = string(string(outBuf)) } } @@ -3555,23 +3596,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *User) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *User) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -3579,134 +3624,134 @@ func (mj *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error { var obj []byte _ = obj _ = err - if mj.ContributorsEnabled { + if j.ContributorsEnabled { buf.WriteString(`{"contributors_enabled":true`) } else { buf.WriteString(`{"contributors_enabled":false`) } buf.WriteString(`,"created_at":`) - fflib.WriteJsonString(buf, string(mj.CreatedAt)) - if mj.DefaultProfile { + fflib.WriteJsonString(buf, string(j.CreatedAt)) + if j.DefaultProfile { buf.WriteString(`,"default_profile":true`) } else { buf.WriteString(`,"default_profile":false`) } - if mj.DefaultProfileImage { + if j.DefaultProfileImage { buf.WriteString(`,"default_profile_image":true`) } else { buf.WriteString(`,"default_profile_image":false`) } buf.WriteString(`,"description":`) - fflib.WriteJsonString(buf, string(mj.Description)) + fflib.WriteJsonString(buf, string(j.Description)) buf.WriteString(`,"entities":`) { - err = mj.Entities.MarshalJSONBuf(buf) + err = j.Entities.MarshalJSONBuf(buf) if err != nil { return err } } buf.WriteString(`,"favourites_count":`) - fflib.FormatBits2(buf, uint64(mj.FavouritesCount), 10, mj.FavouritesCount < 0) - if mj.FollowRequestSent != nil { + fflib.FormatBits2(buf, uint64(j.FavouritesCount), 10, j.FavouritesCount < 0) + if j.FollowRequestSent != nil { buf.WriteString(`,"follow_request_sent":`) - fflib.WriteJsonString(buf, string(*mj.FollowRequestSent)) + fflib.WriteJsonString(buf, string(*j.FollowRequestSent)) } else { buf.WriteString(`,"follow_request_sent":null`) } buf.WriteString(`,"followers_count":`) - fflib.FormatBits2(buf, uint64(mj.FollowersCount), 10, mj.FollowersCount < 0) - if mj.Following != nil { + fflib.FormatBits2(buf, uint64(j.FollowersCount), 10, j.FollowersCount < 0) + if j.Following != nil { buf.WriteString(`,"following":`) - fflib.WriteJsonString(buf, string(*mj.Following)) + fflib.WriteJsonString(buf, string(*j.Following)) } else { buf.WriteString(`,"following":null`) } buf.WriteString(`,"friends_count":`) - fflib.FormatBits2(buf, uint64(mj.FriendsCount), 10, mj.FriendsCount < 0) - if mj.GeoEnabled { + fflib.FormatBits2(buf, uint64(j.FriendsCount), 10, j.FriendsCount < 0) + if j.GeoEnabled { buf.WriteString(`,"geo_enabled":true`) } else { buf.WriteString(`,"geo_enabled":false`) } buf.WriteString(`,"id":`) - fflib.FormatBits2(buf, uint64(mj.ID), 10, mj.ID < 0) + fflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0) buf.WriteString(`,"id_str":`) - fflib.WriteJsonString(buf, string(mj.IDStr)) - if mj.IsTranslator { + fflib.WriteJsonString(buf, string(j.IDStr)) + if j.IsTranslator { buf.WriteString(`,"is_translator":true`) } else { buf.WriteString(`,"is_translator":false`) } buf.WriteString(`,"lang":`) - fflib.WriteJsonString(buf, string(mj.Lang)) + fflib.WriteJsonString(buf, string(j.Lang)) buf.WriteString(`,"listed_count":`) - fflib.FormatBits2(buf, uint64(mj.ListedCount), 10, mj.ListedCount < 0) + fflib.FormatBits2(buf, uint64(j.ListedCount), 10, j.ListedCount < 0) buf.WriteString(`,"location":`) - fflib.WriteJsonString(buf, string(mj.Location)) + fflib.WriteJsonString(buf, string(j.Location)) buf.WriteString(`,"name":`) - fflib.WriteJsonString(buf, string(mj.Name)) - if mj.Notifications != nil { + fflib.WriteJsonString(buf, string(j.Name)) + if j.Notifications != nil { buf.WriteString(`,"notifications":`) - fflib.WriteJsonString(buf, string(*mj.Notifications)) + fflib.WriteJsonString(buf, string(*j.Notifications)) } else { buf.WriteString(`,"notifications":null`) } buf.WriteString(`,"profile_background_color":`) - fflib.WriteJsonString(buf, string(mj.ProfileBackgroundColor)) + fflib.WriteJsonString(buf, string(j.ProfileBackgroundColor)) buf.WriteString(`,"profile_background_image_url":`) - fflib.WriteJsonString(buf, string(mj.ProfileBackgroundImageURL)) + fflib.WriteJsonString(buf, string(j.ProfileBackgroundImageURL)) buf.WriteString(`,"profile_background_image_url_https":`) - fflib.WriteJsonString(buf, string(mj.ProfileBackgroundImageURLHTTPS)) - if mj.ProfileBackgroundTile { + fflib.WriteJsonString(buf, string(j.ProfileBackgroundImageURLHTTPS)) + if j.ProfileBackgroundTile { buf.WriteString(`,"profile_background_tile":true`) } else { buf.WriteString(`,"profile_background_tile":false`) } buf.WriteString(`,"profile_image_url":`) - fflib.WriteJsonString(buf, string(mj.ProfileImageURL)) + fflib.WriteJsonString(buf, string(j.ProfileImageURL)) buf.WriteString(`,"profile_image_url_https":`) - fflib.WriteJsonString(buf, string(mj.ProfileImageURLHTTPS)) + fflib.WriteJsonString(buf, string(j.ProfileImageURLHTTPS)) buf.WriteString(`,"profile_link_color":`) - fflib.WriteJsonString(buf, string(mj.ProfileLinkColor)) + fflib.WriteJsonString(buf, string(j.ProfileLinkColor)) buf.WriteString(`,"profile_sidebar_border_color":`) - fflib.WriteJsonString(buf, string(mj.ProfileSidebarBorderColor)) + fflib.WriteJsonString(buf, string(j.ProfileSidebarBorderColor)) buf.WriteString(`,"profile_sidebar_fill_color":`) - fflib.WriteJsonString(buf, string(mj.ProfileSidebarFillColor)) + fflib.WriteJsonString(buf, string(j.ProfileSidebarFillColor)) buf.WriteString(`,"profile_text_color":`) - fflib.WriteJsonString(buf, string(mj.ProfileTextColor)) - if mj.ProfileUseBackgroundImage { + fflib.WriteJsonString(buf, string(j.ProfileTextColor)) + if j.ProfileUseBackgroundImage { buf.WriteString(`,"profile_use_background_image":true`) } else { buf.WriteString(`,"profile_use_background_image":false`) } - if mj.Protected { + if j.Protected { buf.WriteString(`,"protected":true`) } else { buf.WriteString(`,"protected":false`) } buf.WriteString(`,"screen_name":`) - fflib.WriteJsonString(buf, string(mj.ScreenName)) - if mj.ShowAllInlineMedia { + fflib.WriteJsonString(buf, string(j.ScreenName)) + if j.ShowAllInlineMedia { buf.WriteString(`,"show_all_inline_media":true`) } else { buf.WriteString(`,"show_all_inline_media":false`) } buf.WriteString(`,"statuses_count":`) - fflib.FormatBits2(buf, uint64(mj.StatusesCount), 10, mj.StatusesCount < 0) + fflib.FormatBits2(buf, uint64(j.StatusesCount), 10, j.StatusesCount < 0) buf.WriteString(`,"time_zone":`) - fflib.WriteJsonString(buf, string(mj.TimeZone)) - if mj.URL != nil { + fflib.WriteJsonString(buf, string(j.TimeZone)) + if j.URL != nil { buf.WriteString(`,"url":`) - fflib.WriteJsonString(buf, string(*mj.URL)) + fflib.WriteJsonString(buf, string(*j.URL)) } else { buf.WriteString(`,"url":null`) } buf.WriteString(`,"utc_offset":`) - fflib.FormatBits2(buf, uint64(mj.UtcOffset), 10, mj.UtcOffset < 0) - if mj.Verified { + fflib.FormatBits2(buf, uint64(j.UtcOffset), 10, j.UtcOffset < 0) + if j.Verified { buf.WriteString(`,"verified":true`) } else { buf.WriteString(`,"verified":false`) @@ -3716,174 +3761,176 @@ func (mj *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error { } const ( - ffj_t_Userbase = iota - ffj_t_Userno_such_key + ffjtUserbase = iota + ffjtUsernosuchkey - ffj_t_User_ContributorsEnabled + ffjtUserContributorsEnabled - ffj_t_User_CreatedAt + ffjtUserCreatedAt - ffj_t_User_DefaultProfile + ffjtUserDefaultProfile - ffj_t_User_DefaultProfileImage + ffjtUserDefaultProfileImage - ffj_t_User_Description + ffjtUserDescription - ffj_t_User_Entities + ffjtUserEntities - ffj_t_User_FavouritesCount + ffjtUserFavouritesCount - ffj_t_User_FollowRequestSent + ffjtUserFollowRequestSent - ffj_t_User_FollowersCount + ffjtUserFollowersCount - ffj_t_User_Following + ffjtUserFollowing - ffj_t_User_FriendsCount + ffjtUserFriendsCount - ffj_t_User_GeoEnabled + ffjtUserGeoEnabled - ffj_t_User_ID + ffjtUserID - ffj_t_User_IDStr + ffjtUserIDStr - ffj_t_User_IsTranslator + ffjtUserIsTranslator - ffj_t_User_Lang + ffjtUserLang - ffj_t_User_ListedCount + ffjtUserListedCount - ffj_t_User_Location + ffjtUserLocation - ffj_t_User_Name + ffjtUserName - ffj_t_User_Notifications + ffjtUserNotifications - ffj_t_User_ProfileBackgroundColor + ffjtUserProfileBackgroundColor - ffj_t_User_ProfileBackgroundImageURL + ffjtUserProfileBackgroundImageURL - ffj_t_User_ProfileBackgroundImageURLHTTPS + ffjtUserProfileBackgroundImageURLHTTPS - ffj_t_User_ProfileBackgroundTile + ffjtUserProfileBackgroundTile - ffj_t_User_ProfileImageURL + ffjtUserProfileImageURL - ffj_t_User_ProfileImageURLHTTPS + ffjtUserProfileImageURLHTTPS - ffj_t_User_ProfileLinkColor + ffjtUserProfileLinkColor - ffj_t_User_ProfileSidebarBorderColor + ffjtUserProfileSidebarBorderColor - ffj_t_User_ProfileSidebarFillColor + ffjtUserProfileSidebarFillColor - ffj_t_User_ProfileTextColor + ffjtUserProfileTextColor - ffj_t_User_ProfileUseBackgroundImage + ffjtUserProfileUseBackgroundImage - ffj_t_User_Protected + ffjtUserProtected - ffj_t_User_ScreenName + ffjtUserScreenName - ffj_t_User_ShowAllInlineMedia + ffjtUserShowAllInlineMedia - ffj_t_User_StatusesCount + ffjtUserStatusesCount - ffj_t_User_TimeZone + ffjtUserTimeZone - ffj_t_User_URL + ffjtUserURL - ffj_t_User_UtcOffset + ffjtUserUtcOffset - ffj_t_User_Verified + ffjtUserVerified ) -var ffj_key_User_ContributorsEnabled = []byte("contributors_enabled") +var ffjKeyUserContributorsEnabled = []byte("contributors_enabled") -var ffj_key_User_CreatedAt = []byte("created_at") +var ffjKeyUserCreatedAt = []byte("created_at") -var ffj_key_User_DefaultProfile = []byte("default_profile") +var ffjKeyUserDefaultProfile = []byte("default_profile") -var ffj_key_User_DefaultProfileImage = []byte("default_profile_image") +var ffjKeyUserDefaultProfileImage = []byte("default_profile_image") -var ffj_key_User_Description = []byte("description") +var ffjKeyUserDescription = []byte("description") -var ffj_key_User_Entities = []byte("entities") +var ffjKeyUserEntities = []byte("entities") -var ffj_key_User_FavouritesCount = []byte("favourites_count") +var ffjKeyUserFavouritesCount = []byte("favourites_count") -var ffj_key_User_FollowRequestSent = []byte("follow_request_sent") +var ffjKeyUserFollowRequestSent = []byte("follow_request_sent") -var ffj_key_User_FollowersCount = []byte("followers_count") +var ffjKeyUserFollowersCount = []byte("followers_count") -var ffj_key_User_Following = []byte("following") +var ffjKeyUserFollowing = []byte("following") -var ffj_key_User_FriendsCount = []byte("friends_count") +var ffjKeyUserFriendsCount = []byte("friends_count") -var ffj_key_User_GeoEnabled = []byte("geo_enabled") +var ffjKeyUserGeoEnabled = []byte("geo_enabled") -var ffj_key_User_ID = []byte("id") +var ffjKeyUserID = []byte("id") -var ffj_key_User_IDStr = []byte("id_str") +var ffjKeyUserIDStr = []byte("id_str") -var ffj_key_User_IsTranslator = []byte("is_translator") +var ffjKeyUserIsTranslator = []byte("is_translator") -var ffj_key_User_Lang = []byte("lang") +var ffjKeyUserLang = []byte("lang") -var ffj_key_User_ListedCount = []byte("listed_count") +var ffjKeyUserListedCount = []byte("listed_count") -var ffj_key_User_Location = []byte("location") +var ffjKeyUserLocation = []byte("location") -var ffj_key_User_Name = []byte("name") +var ffjKeyUserName = []byte("name") -var ffj_key_User_Notifications = []byte("notifications") +var ffjKeyUserNotifications = []byte("notifications") -var ffj_key_User_ProfileBackgroundColor = []byte("profile_background_color") +var ffjKeyUserProfileBackgroundColor = []byte("profile_background_color") -var ffj_key_User_ProfileBackgroundImageURL = []byte("profile_background_image_url") +var ffjKeyUserProfileBackgroundImageURL = []byte("profile_background_image_url") -var ffj_key_User_ProfileBackgroundImageURLHTTPS = []byte("profile_background_image_url_https") +var ffjKeyUserProfileBackgroundImageURLHTTPS = []byte("profile_background_image_url_https") -var ffj_key_User_ProfileBackgroundTile = []byte("profile_background_tile") +var ffjKeyUserProfileBackgroundTile = []byte("profile_background_tile") -var ffj_key_User_ProfileImageURL = []byte("profile_image_url") +var ffjKeyUserProfileImageURL = []byte("profile_image_url") -var ffj_key_User_ProfileImageURLHTTPS = []byte("profile_image_url_https") +var ffjKeyUserProfileImageURLHTTPS = []byte("profile_image_url_https") -var ffj_key_User_ProfileLinkColor = []byte("profile_link_color") +var ffjKeyUserProfileLinkColor = []byte("profile_link_color") -var ffj_key_User_ProfileSidebarBorderColor = []byte("profile_sidebar_border_color") +var ffjKeyUserProfileSidebarBorderColor = []byte("profile_sidebar_border_color") -var ffj_key_User_ProfileSidebarFillColor = []byte("profile_sidebar_fill_color") +var ffjKeyUserProfileSidebarFillColor = []byte("profile_sidebar_fill_color") -var ffj_key_User_ProfileTextColor = []byte("profile_text_color") +var ffjKeyUserProfileTextColor = []byte("profile_text_color") -var ffj_key_User_ProfileUseBackgroundImage = []byte("profile_use_background_image") +var ffjKeyUserProfileUseBackgroundImage = []byte("profile_use_background_image") -var ffj_key_User_Protected = []byte("protected") +var ffjKeyUserProtected = []byte("protected") -var ffj_key_User_ScreenName = []byte("screen_name") +var ffjKeyUserScreenName = []byte("screen_name") -var ffj_key_User_ShowAllInlineMedia = []byte("show_all_inline_media") +var ffjKeyUserShowAllInlineMedia = []byte("show_all_inline_media") -var ffj_key_User_StatusesCount = []byte("statuses_count") +var ffjKeyUserStatusesCount = []byte("statuses_count") -var ffj_key_User_TimeZone = []byte("time_zone") +var ffjKeyUserTimeZone = []byte("time_zone") -var ffj_key_User_URL = []byte("url") +var ffjKeyUserURL = []byte("url") -var ffj_key_User_UtcOffset = []byte("utc_offset") +var ffjKeyUserUtcOffset = []byte("utc_offset") -var ffj_key_User_Verified = []byte("verified") +var ffjKeyUserVerified = []byte("verified") -func (uj *User) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *User) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *User) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_Userbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *User) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtUserbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -3929,7 +3976,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_Userno_such_key + currentKey = ffjtUsernosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -3937,475 +3984,475 @@ mainparse: case 'c': - if bytes.Equal(ffj_key_User_ContributorsEnabled, kn) { - currentKey = ffj_t_User_ContributorsEnabled + if bytes.Equal(ffjKeyUserContributorsEnabled, kn) { + currentKey = ffjtUserContributorsEnabled state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_CreatedAt, kn) { - currentKey = ffj_t_User_CreatedAt + } else if bytes.Equal(ffjKeyUserCreatedAt, kn) { + currentKey = ffjtUserCreatedAt state = fflib.FFParse_want_colon goto mainparse } case 'd': - if bytes.Equal(ffj_key_User_DefaultProfile, kn) { - currentKey = ffj_t_User_DefaultProfile + if bytes.Equal(ffjKeyUserDefaultProfile, kn) { + currentKey = ffjtUserDefaultProfile state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_DefaultProfileImage, kn) { - currentKey = ffj_t_User_DefaultProfileImage + } else if bytes.Equal(ffjKeyUserDefaultProfileImage, kn) { + currentKey = ffjtUserDefaultProfileImage state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_Description, kn) { - currentKey = ffj_t_User_Description + } else if bytes.Equal(ffjKeyUserDescription, kn) { + currentKey = ffjtUserDescription state = fflib.FFParse_want_colon goto mainparse } case 'e': - if bytes.Equal(ffj_key_User_Entities, kn) { - currentKey = ffj_t_User_Entities + if bytes.Equal(ffjKeyUserEntities, kn) { + currentKey = ffjtUserEntities state = fflib.FFParse_want_colon goto mainparse } case 'f': - if bytes.Equal(ffj_key_User_FavouritesCount, kn) { - currentKey = ffj_t_User_FavouritesCount + if bytes.Equal(ffjKeyUserFavouritesCount, kn) { + currentKey = ffjtUserFavouritesCount state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_FollowRequestSent, kn) { - currentKey = ffj_t_User_FollowRequestSent + } else if bytes.Equal(ffjKeyUserFollowRequestSent, kn) { + currentKey = ffjtUserFollowRequestSent state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_FollowersCount, kn) { - currentKey = ffj_t_User_FollowersCount + } else if bytes.Equal(ffjKeyUserFollowersCount, kn) { + currentKey = ffjtUserFollowersCount state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_Following, kn) { - currentKey = ffj_t_User_Following + } else if bytes.Equal(ffjKeyUserFollowing, kn) { + currentKey = ffjtUserFollowing state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_FriendsCount, kn) { - currentKey = ffj_t_User_FriendsCount + } else if bytes.Equal(ffjKeyUserFriendsCount, kn) { + currentKey = ffjtUserFriendsCount state = fflib.FFParse_want_colon goto mainparse } case 'g': - if bytes.Equal(ffj_key_User_GeoEnabled, kn) { - currentKey = ffj_t_User_GeoEnabled + if bytes.Equal(ffjKeyUserGeoEnabled, kn) { + currentKey = ffjtUserGeoEnabled state = fflib.FFParse_want_colon goto mainparse } case 'i': - if bytes.Equal(ffj_key_User_ID, kn) { - currentKey = ffj_t_User_ID + if bytes.Equal(ffjKeyUserID, kn) { + currentKey = ffjtUserID state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_IDStr, kn) { - currentKey = ffj_t_User_IDStr + } else if bytes.Equal(ffjKeyUserIDStr, kn) { + currentKey = ffjtUserIDStr state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_IsTranslator, kn) { - currentKey = ffj_t_User_IsTranslator + } else if bytes.Equal(ffjKeyUserIsTranslator, kn) { + currentKey = ffjtUserIsTranslator state = fflib.FFParse_want_colon goto mainparse } case 'l': - if bytes.Equal(ffj_key_User_Lang, kn) { - currentKey = ffj_t_User_Lang + if bytes.Equal(ffjKeyUserLang, kn) { + currentKey = ffjtUserLang state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ListedCount, kn) { - currentKey = ffj_t_User_ListedCount + } else if bytes.Equal(ffjKeyUserListedCount, kn) { + currentKey = ffjtUserListedCount state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_Location, kn) { - currentKey = ffj_t_User_Location + } else if bytes.Equal(ffjKeyUserLocation, kn) { + currentKey = ffjtUserLocation state = fflib.FFParse_want_colon goto mainparse } case 'n': - if bytes.Equal(ffj_key_User_Name, kn) { - currentKey = ffj_t_User_Name + if bytes.Equal(ffjKeyUserName, kn) { + currentKey = ffjtUserName state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_Notifications, kn) { - currentKey = ffj_t_User_Notifications + } else if bytes.Equal(ffjKeyUserNotifications, kn) { + currentKey = ffjtUserNotifications state = fflib.FFParse_want_colon goto mainparse } case 'p': - if bytes.Equal(ffj_key_User_ProfileBackgroundColor, kn) { - currentKey = ffj_t_User_ProfileBackgroundColor + if bytes.Equal(ffjKeyUserProfileBackgroundColor, kn) { + currentKey = ffjtUserProfileBackgroundColor state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileBackgroundImageURL, kn) { - currentKey = ffj_t_User_ProfileBackgroundImageURL + } else if bytes.Equal(ffjKeyUserProfileBackgroundImageURL, kn) { + currentKey = ffjtUserProfileBackgroundImageURL state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileBackgroundImageURLHTTPS, kn) { - currentKey = ffj_t_User_ProfileBackgroundImageURLHTTPS + } else if bytes.Equal(ffjKeyUserProfileBackgroundImageURLHTTPS, kn) { + currentKey = ffjtUserProfileBackgroundImageURLHTTPS state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileBackgroundTile, kn) { - currentKey = ffj_t_User_ProfileBackgroundTile + } else if bytes.Equal(ffjKeyUserProfileBackgroundTile, kn) { + currentKey = ffjtUserProfileBackgroundTile state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileImageURL, kn) { - currentKey = ffj_t_User_ProfileImageURL + } else if bytes.Equal(ffjKeyUserProfileImageURL, kn) { + currentKey = ffjtUserProfileImageURL state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileImageURLHTTPS, kn) { - currentKey = ffj_t_User_ProfileImageURLHTTPS + } else if bytes.Equal(ffjKeyUserProfileImageURLHTTPS, kn) { + currentKey = ffjtUserProfileImageURLHTTPS state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileLinkColor, kn) { - currentKey = ffj_t_User_ProfileLinkColor + } else if bytes.Equal(ffjKeyUserProfileLinkColor, kn) { + currentKey = ffjtUserProfileLinkColor state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileSidebarBorderColor, kn) { - currentKey = ffj_t_User_ProfileSidebarBorderColor + } else if bytes.Equal(ffjKeyUserProfileSidebarBorderColor, kn) { + currentKey = ffjtUserProfileSidebarBorderColor state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileSidebarFillColor, kn) { - currentKey = ffj_t_User_ProfileSidebarFillColor + } else if bytes.Equal(ffjKeyUserProfileSidebarFillColor, kn) { + currentKey = ffjtUserProfileSidebarFillColor state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileTextColor, kn) { - currentKey = ffj_t_User_ProfileTextColor + } else if bytes.Equal(ffjKeyUserProfileTextColor, kn) { + currentKey = ffjtUserProfileTextColor state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ProfileUseBackgroundImage, kn) { - currentKey = ffj_t_User_ProfileUseBackgroundImage + } else if bytes.Equal(ffjKeyUserProfileUseBackgroundImage, kn) { + currentKey = ffjtUserProfileUseBackgroundImage state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_Protected, kn) { - currentKey = ffj_t_User_Protected + } else if bytes.Equal(ffjKeyUserProtected, kn) { + currentKey = ffjtUserProtected state = fflib.FFParse_want_colon goto mainparse } case 's': - if bytes.Equal(ffj_key_User_ScreenName, kn) { - currentKey = ffj_t_User_ScreenName + if bytes.Equal(ffjKeyUserScreenName, kn) { + currentKey = ffjtUserScreenName state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_ShowAllInlineMedia, kn) { - currentKey = ffj_t_User_ShowAllInlineMedia + } else if bytes.Equal(ffjKeyUserShowAllInlineMedia, kn) { + currentKey = ffjtUserShowAllInlineMedia state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_StatusesCount, kn) { - currentKey = ffj_t_User_StatusesCount + } else if bytes.Equal(ffjKeyUserStatusesCount, kn) { + currentKey = ffjtUserStatusesCount state = fflib.FFParse_want_colon goto mainparse } case 't': - if bytes.Equal(ffj_key_User_TimeZone, kn) { - currentKey = ffj_t_User_TimeZone + if bytes.Equal(ffjKeyUserTimeZone, kn) { + currentKey = ffjtUserTimeZone state = fflib.FFParse_want_colon goto mainparse } case 'u': - if bytes.Equal(ffj_key_User_URL, kn) { - currentKey = ffj_t_User_URL + if bytes.Equal(ffjKeyUserURL, kn) { + currentKey = ffjtUserURL state = fflib.FFParse_want_colon goto mainparse - } else if bytes.Equal(ffj_key_User_UtcOffset, kn) { - currentKey = ffj_t_User_UtcOffset + } else if bytes.Equal(ffjKeyUserUtcOffset, kn) { + currentKey = ffjtUserUtcOffset state = fflib.FFParse_want_colon goto mainparse } case 'v': - if bytes.Equal(ffj_key_User_Verified, kn) { - currentKey = ffj_t_User_Verified + if bytes.Equal(ffjKeyUserVerified, kn) { + currentKey = ffjtUserVerified state = fflib.FFParse_want_colon goto mainparse } } - if fflib.SimpleLetterEqualFold(ffj_key_User_Verified, kn) { - currentKey = ffj_t_User_Verified + if fflib.SimpleLetterEqualFold(ffjKeyUserVerified, kn) { + currentKey = ffjtUserVerified state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_UtcOffset, kn) { - currentKey = ffj_t_User_UtcOffset + if fflib.EqualFoldRight(ffjKeyUserUtcOffset, kn) { + currentKey = ffjtUserUtcOffset state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_URL, kn) { - currentKey = ffj_t_User_URL + if fflib.SimpleLetterEqualFold(ffjKeyUserURL, kn) { + currentKey = ffjtUserURL state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_TimeZone, kn) { - currentKey = ffj_t_User_TimeZone + if fflib.AsciiEqualFold(ffjKeyUserTimeZone, kn) { + currentKey = ffjtUserTimeZone state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_StatusesCount, kn) { - currentKey = ffj_t_User_StatusesCount + if fflib.EqualFoldRight(ffjKeyUserStatusesCount, kn) { + currentKey = ffjtUserStatusesCount state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ShowAllInlineMedia, kn) { - currentKey = ffj_t_User_ShowAllInlineMedia + if fflib.EqualFoldRight(ffjKeyUserShowAllInlineMedia, kn) { + currentKey = ffjtUserShowAllInlineMedia state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ScreenName, kn) { - currentKey = ffj_t_User_ScreenName + if fflib.EqualFoldRight(ffjKeyUserScreenName, kn) { + currentKey = ffjtUserScreenName state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_Protected, kn) { - currentKey = ffj_t_User_Protected + if fflib.SimpleLetterEqualFold(ffjKeyUserProtected, kn) { + currentKey = ffjtUserProtected state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileUseBackgroundImage, kn) { - currentKey = ffj_t_User_ProfileUseBackgroundImage + if fflib.EqualFoldRight(ffjKeyUserProfileUseBackgroundImage, kn) { + currentKey = ffjtUserProfileUseBackgroundImage state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_ProfileTextColor, kn) { - currentKey = ffj_t_User_ProfileTextColor + if fflib.AsciiEqualFold(ffjKeyUserProfileTextColor, kn) { + currentKey = ffjtUserProfileTextColor state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileSidebarFillColor, kn) { - currentKey = ffj_t_User_ProfileSidebarFillColor + if fflib.EqualFoldRight(ffjKeyUserProfileSidebarFillColor, kn) { + currentKey = ffjtUserProfileSidebarFillColor state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileSidebarBorderColor, kn) { - currentKey = ffj_t_User_ProfileSidebarBorderColor + if fflib.EqualFoldRight(ffjKeyUserProfileSidebarBorderColor, kn) { + currentKey = ffjtUserProfileSidebarBorderColor state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileLinkColor, kn) { - currentKey = ffj_t_User_ProfileLinkColor + if fflib.EqualFoldRight(ffjKeyUserProfileLinkColor, kn) { + currentKey = ffjtUserProfileLinkColor state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileImageURLHTTPS, kn) { - currentKey = ffj_t_User_ProfileImageURLHTTPS + if fflib.EqualFoldRight(ffjKeyUserProfileImageURLHTTPS, kn) { + currentKey = ffjtUserProfileImageURLHTTPS state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_ProfileImageURL, kn) { - currentKey = ffj_t_User_ProfileImageURL + if fflib.AsciiEqualFold(ffjKeyUserProfileImageURL, kn) { + currentKey = ffjtUserProfileImageURL state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileBackgroundTile, kn) { - currentKey = ffj_t_User_ProfileBackgroundTile + if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundTile, kn) { + currentKey = ffjtUserProfileBackgroundTile state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileBackgroundImageURLHTTPS, kn) { - currentKey = ffj_t_User_ProfileBackgroundImageURLHTTPS + if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundImageURLHTTPS, kn) { + currentKey = ffjtUserProfileBackgroundImageURLHTTPS state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileBackgroundImageURL, kn) { - currentKey = ffj_t_User_ProfileBackgroundImageURL + if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundImageURL, kn) { + currentKey = ffjtUserProfileBackgroundImageURL state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ProfileBackgroundColor, kn) { - currentKey = ffj_t_User_ProfileBackgroundColor + if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundColor, kn) { + currentKey = ffjtUserProfileBackgroundColor state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_Notifications, kn) { - currentKey = ffj_t_User_Notifications + if fflib.EqualFoldRight(ffjKeyUserNotifications, kn) { + currentKey = ffjtUserNotifications state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_Name, kn) { - currentKey = ffj_t_User_Name + if fflib.SimpleLetterEqualFold(ffjKeyUserName, kn) { + currentKey = ffjtUserName state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_Location, kn) { - currentKey = ffj_t_User_Location + if fflib.SimpleLetterEqualFold(ffjKeyUserLocation, kn) { + currentKey = ffjtUserLocation state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ListedCount, kn) { - currentKey = ffj_t_User_ListedCount + if fflib.EqualFoldRight(ffjKeyUserListedCount, kn) { + currentKey = ffjtUserListedCount state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_Lang, kn) { - currentKey = ffj_t_User_Lang + if fflib.SimpleLetterEqualFold(ffjKeyUserLang, kn) { + currentKey = ffjtUserLang state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_IsTranslator, kn) { - currentKey = ffj_t_User_IsTranslator + if fflib.EqualFoldRight(ffjKeyUserIsTranslator, kn) { + currentKey = ffjtUserIsTranslator state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_IDStr, kn) { - currentKey = ffj_t_User_IDStr + if fflib.EqualFoldRight(ffjKeyUserIDStr, kn) { + currentKey = ffjtUserIDStr state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_ID, kn) { - currentKey = ffj_t_User_ID + if fflib.SimpleLetterEqualFold(ffjKeyUserID, kn) { + currentKey = ffjtUserID state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_GeoEnabled, kn) { - currentKey = ffj_t_User_GeoEnabled + if fflib.AsciiEqualFold(ffjKeyUserGeoEnabled, kn) { + currentKey = ffjtUserGeoEnabled state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_FriendsCount, kn) { - currentKey = ffj_t_User_FriendsCount + if fflib.EqualFoldRight(ffjKeyUserFriendsCount, kn) { + currentKey = ffjtUserFriendsCount state = fflib.FFParse_want_colon goto mainparse } - if fflib.SimpleLetterEqualFold(ffj_key_User_Following, kn) { - currentKey = ffj_t_User_Following + if fflib.SimpleLetterEqualFold(ffjKeyUserFollowing, kn) { + currentKey = ffjtUserFollowing state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_FollowersCount, kn) { - currentKey = ffj_t_User_FollowersCount + if fflib.EqualFoldRight(ffjKeyUserFollowersCount, kn) { + currentKey = ffjtUserFollowersCount state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_FollowRequestSent, kn) { - currentKey = ffj_t_User_FollowRequestSent + if fflib.EqualFoldRight(ffjKeyUserFollowRequestSent, kn) { + currentKey = ffjtUserFollowRequestSent state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_FavouritesCount, kn) { - currentKey = ffj_t_User_FavouritesCount + if fflib.EqualFoldRight(ffjKeyUserFavouritesCount, kn) { + currentKey = ffjtUserFavouritesCount state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_Entities, kn) { - currentKey = ffj_t_User_Entities + if fflib.EqualFoldRight(ffjKeyUserEntities, kn) { + currentKey = ffjtUserEntities state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_Description, kn) { - currentKey = ffj_t_User_Description + if fflib.EqualFoldRight(ffjKeyUserDescription, kn) { + currentKey = ffjtUserDescription state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_DefaultProfileImage, kn) { - currentKey = ffj_t_User_DefaultProfileImage + if fflib.AsciiEqualFold(ffjKeyUserDefaultProfileImage, kn) { + currentKey = ffjtUserDefaultProfileImage state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_DefaultProfile, kn) { - currentKey = ffj_t_User_DefaultProfile + if fflib.AsciiEqualFold(ffjKeyUserDefaultProfile, kn) { + currentKey = ffjtUserDefaultProfile state = fflib.FFParse_want_colon goto mainparse } - if fflib.AsciiEqualFold(ffj_key_User_CreatedAt, kn) { - currentKey = ffj_t_User_CreatedAt + if fflib.AsciiEqualFold(ffjKeyUserCreatedAt, kn) { + currentKey = ffjtUserCreatedAt state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_User_ContributorsEnabled, kn) { - currentKey = ffj_t_User_ContributorsEnabled + if fflib.EqualFoldRight(ffjKeyUserContributorsEnabled, kn) { + currentKey = ffjtUserContributorsEnabled state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_Userno_such_key + currentKey = ffjtUsernosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -4422,124 +4469,124 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_User_ContributorsEnabled: + case ffjtUserContributorsEnabled: goto handle_ContributorsEnabled - case ffj_t_User_CreatedAt: + case ffjtUserCreatedAt: goto handle_CreatedAt - case ffj_t_User_DefaultProfile: + case ffjtUserDefaultProfile: goto handle_DefaultProfile - case ffj_t_User_DefaultProfileImage: + case ffjtUserDefaultProfileImage: goto handle_DefaultProfileImage - case ffj_t_User_Description: + case ffjtUserDescription: goto handle_Description - case ffj_t_User_Entities: + case ffjtUserEntities: goto handle_Entities - case ffj_t_User_FavouritesCount: + case ffjtUserFavouritesCount: goto handle_FavouritesCount - case ffj_t_User_FollowRequestSent: + case ffjtUserFollowRequestSent: goto handle_FollowRequestSent - case ffj_t_User_FollowersCount: + case ffjtUserFollowersCount: goto handle_FollowersCount - case ffj_t_User_Following: + case ffjtUserFollowing: goto handle_Following - case ffj_t_User_FriendsCount: + case ffjtUserFriendsCount: goto handle_FriendsCount - case ffj_t_User_GeoEnabled: + case ffjtUserGeoEnabled: goto handle_GeoEnabled - case ffj_t_User_ID: + case ffjtUserID: goto handle_ID - case ffj_t_User_IDStr: + case ffjtUserIDStr: goto handle_IDStr - case ffj_t_User_IsTranslator: + case ffjtUserIsTranslator: goto handle_IsTranslator - case ffj_t_User_Lang: + case ffjtUserLang: goto handle_Lang - case ffj_t_User_ListedCount: + case ffjtUserListedCount: goto handle_ListedCount - case ffj_t_User_Location: + case ffjtUserLocation: goto handle_Location - case ffj_t_User_Name: + case ffjtUserName: goto handle_Name - case ffj_t_User_Notifications: + case ffjtUserNotifications: goto handle_Notifications - case ffj_t_User_ProfileBackgroundColor: + case ffjtUserProfileBackgroundColor: goto handle_ProfileBackgroundColor - case ffj_t_User_ProfileBackgroundImageURL: + case ffjtUserProfileBackgroundImageURL: goto handle_ProfileBackgroundImageURL - case ffj_t_User_ProfileBackgroundImageURLHTTPS: + case ffjtUserProfileBackgroundImageURLHTTPS: goto handle_ProfileBackgroundImageURLHTTPS - case ffj_t_User_ProfileBackgroundTile: + case ffjtUserProfileBackgroundTile: goto handle_ProfileBackgroundTile - case ffj_t_User_ProfileImageURL: + case ffjtUserProfileImageURL: goto handle_ProfileImageURL - case ffj_t_User_ProfileImageURLHTTPS: + case ffjtUserProfileImageURLHTTPS: goto handle_ProfileImageURLHTTPS - case ffj_t_User_ProfileLinkColor: + case ffjtUserProfileLinkColor: goto handle_ProfileLinkColor - case ffj_t_User_ProfileSidebarBorderColor: + case ffjtUserProfileSidebarBorderColor: goto handle_ProfileSidebarBorderColor - case ffj_t_User_ProfileSidebarFillColor: + case ffjtUserProfileSidebarFillColor: goto handle_ProfileSidebarFillColor - case ffj_t_User_ProfileTextColor: + case ffjtUserProfileTextColor: goto handle_ProfileTextColor - case ffj_t_User_ProfileUseBackgroundImage: + case ffjtUserProfileUseBackgroundImage: goto handle_ProfileUseBackgroundImage - case ffj_t_User_Protected: + case ffjtUserProtected: goto handle_Protected - case ffj_t_User_ScreenName: + case ffjtUserScreenName: goto handle_ScreenName - case ffj_t_User_ShowAllInlineMedia: + case ffjtUserShowAllInlineMedia: goto handle_ShowAllInlineMedia - case ffj_t_User_StatusesCount: + case ffjtUserStatusesCount: goto handle_StatusesCount - case ffj_t_User_TimeZone: + case ffjtUserTimeZone: goto handle_TimeZone - case ffj_t_User_URL: + case ffjtUserURL: goto handle_URL - case ffj_t_User_UtcOffset: + case ffjtUserUtcOffset: goto handle_UtcOffset - case ffj_t_User_Verified: + case ffjtUserVerified: goto handle_Verified - case ffj_t_Userno_such_key: + case ffjtUsernosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -4555,7 +4602,7 @@ mainparse: handle_ContributorsEnabled: - /* handler: uj.ContributorsEnabled type=bool kind=bool quoted=false*/ + /* handler: j.ContributorsEnabled type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -4571,11 +4618,11 @@ handle_ContributorsEnabled: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.ContributorsEnabled = true + j.ContributorsEnabled = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.ContributorsEnabled = false + j.ContributorsEnabled = false } else { err = errors.New("unexpected bytes for true/false value") @@ -4590,7 +4637,7 @@ handle_ContributorsEnabled: handle_CreatedAt: - /* handler: uj.CreatedAt type=string kind=string quoted=false*/ + /* handler: j.CreatedAt type=string kind=string quoted=false*/ { @@ -4606,7 +4653,7 @@ handle_CreatedAt: outBuf := fs.Output.Bytes() - uj.CreatedAt = string(string(outBuf)) + j.CreatedAt = string(string(outBuf)) } } @@ -4616,7 +4663,7 @@ handle_CreatedAt: handle_DefaultProfile: - /* handler: uj.DefaultProfile type=bool kind=bool quoted=false*/ + /* handler: j.DefaultProfile type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -4632,11 +4679,11 @@ handle_DefaultProfile: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.DefaultProfile = true + j.DefaultProfile = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.DefaultProfile = false + j.DefaultProfile = false } else { err = errors.New("unexpected bytes for true/false value") @@ -4651,7 +4698,7 @@ handle_DefaultProfile: handle_DefaultProfileImage: - /* handler: uj.DefaultProfileImage type=bool kind=bool quoted=false*/ + /* handler: j.DefaultProfileImage type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -4667,11 +4714,11 @@ handle_DefaultProfileImage: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.DefaultProfileImage = true + j.DefaultProfileImage = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.DefaultProfileImage = false + j.DefaultProfileImage = false } else { err = errors.New("unexpected bytes for true/false value") @@ -4686,7 +4733,7 @@ handle_DefaultProfileImage: handle_Description: - /* handler: uj.Description type=string kind=string quoted=false*/ + /* handler: j.Description type=string kind=string quoted=false*/ { @@ -4702,7 +4749,7 @@ handle_Description: outBuf := fs.Output.Bytes() - uj.Description = string(string(outBuf)) + j.Description = string(string(outBuf)) } } @@ -4712,18 +4759,17 @@ handle_Description: handle_Entities: - /* handler: uj.Entities type=benchmark.UserEntities kind=struct quoted=false*/ + /* handler: j.Entities type=benchmark.UserEntities kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = uj.Entities.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = j.Entities.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } @@ -4733,7 +4779,7 @@ handle_Entities: handle_FavouritesCount: - /* handler: uj.FavouritesCount type=int kind=int quoted=false*/ + /* handler: j.FavouritesCount type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -4753,7 +4799,7 @@ handle_FavouritesCount: return fs.WrapErr(err) } - uj.FavouritesCount = int(tval) + j.FavouritesCount = int(tval) } } @@ -4763,7 +4809,7 @@ handle_FavouritesCount: handle_FollowRequestSent: - /* handler: uj.FollowRequestSent type=string kind=string quoted=false*/ + /* handler: j.FollowRequestSent type=string kind=string quoted=false*/ { @@ -4775,7 +4821,7 @@ handle_FollowRequestSent: if tok == fflib.FFTok_null { - uj.FollowRequestSent = nil + j.FollowRequestSent = nil } else { @@ -4783,7 +4829,7 @@ handle_FollowRequestSent: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.FollowRequestSent = &tval + j.FollowRequestSent = &tval } } @@ -4793,7 +4839,7 @@ handle_FollowRequestSent: handle_FollowersCount: - /* handler: uj.FollowersCount type=int kind=int quoted=false*/ + /* handler: j.FollowersCount type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -4813,7 +4859,7 @@ handle_FollowersCount: return fs.WrapErr(err) } - uj.FollowersCount = int(tval) + j.FollowersCount = int(tval) } } @@ -4823,7 +4869,7 @@ handle_FollowersCount: handle_Following: - /* handler: uj.Following type=string kind=string quoted=false*/ + /* handler: j.Following type=string kind=string quoted=false*/ { @@ -4835,7 +4881,7 @@ handle_Following: if tok == fflib.FFTok_null { - uj.Following = nil + j.Following = nil } else { @@ -4843,7 +4889,7 @@ handle_Following: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.Following = &tval + j.Following = &tval } } @@ -4853,7 +4899,7 @@ handle_Following: handle_FriendsCount: - /* handler: uj.FriendsCount type=int kind=int quoted=false*/ + /* handler: j.FriendsCount type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -4873,7 +4919,7 @@ handle_FriendsCount: return fs.WrapErr(err) } - uj.FriendsCount = int(tval) + j.FriendsCount = int(tval) } } @@ -4883,7 +4929,7 @@ handle_FriendsCount: handle_GeoEnabled: - /* handler: uj.GeoEnabled type=bool kind=bool quoted=false*/ + /* handler: j.GeoEnabled type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -4899,11 +4945,11 @@ handle_GeoEnabled: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.GeoEnabled = true + j.GeoEnabled = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.GeoEnabled = false + j.GeoEnabled = false } else { err = errors.New("unexpected bytes for true/false value") @@ -4918,7 +4964,7 @@ handle_GeoEnabled: handle_ID: - /* handler: uj.ID type=int kind=int quoted=false*/ + /* handler: j.ID type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -4938,7 +4984,7 @@ handle_ID: return fs.WrapErr(err) } - uj.ID = int(tval) + j.ID = int(tval) } } @@ -4948,7 +4994,7 @@ handle_ID: handle_IDStr: - /* handler: uj.IDStr type=string kind=string quoted=false*/ + /* handler: j.IDStr type=string kind=string quoted=false*/ { @@ -4964,7 +5010,7 @@ handle_IDStr: outBuf := fs.Output.Bytes() - uj.IDStr = string(string(outBuf)) + j.IDStr = string(string(outBuf)) } } @@ -4974,7 +5020,7 @@ handle_IDStr: handle_IsTranslator: - /* handler: uj.IsTranslator type=bool kind=bool quoted=false*/ + /* handler: j.IsTranslator type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -4990,11 +5036,11 @@ handle_IsTranslator: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.IsTranslator = true + j.IsTranslator = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.IsTranslator = false + j.IsTranslator = false } else { err = errors.New("unexpected bytes for true/false value") @@ -5009,7 +5055,7 @@ handle_IsTranslator: handle_Lang: - /* handler: uj.Lang type=string kind=string quoted=false*/ + /* handler: j.Lang type=string kind=string quoted=false*/ { @@ -5025,7 +5071,7 @@ handle_Lang: outBuf := fs.Output.Bytes() - uj.Lang = string(string(outBuf)) + j.Lang = string(string(outBuf)) } } @@ -5035,7 +5081,7 @@ handle_Lang: handle_ListedCount: - /* handler: uj.ListedCount type=int kind=int quoted=false*/ + /* handler: j.ListedCount type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -5055,7 +5101,7 @@ handle_ListedCount: return fs.WrapErr(err) } - uj.ListedCount = int(tval) + j.ListedCount = int(tval) } } @@ -5065,7 +5111,7 @@ handle_ListedCount: handle_Location: - /* handler: uj.Location type=string kind=string quoted=false*/ + /* handler: j.Location type=string kind=string quoted=false*/ { @@ -5081,7 +5127,7 @@ handle_Location: outBuf := fs.Output.Bytes() - uj.Location = string(string(outBuf)) + j.Location = string(string(outBuf)) } } @@ -5091,7 +5137,7 @@ handle_Location: handle_Name: - /* handler: uj.Name type=string kind=string quoted=false*/ + /* handler: j.Name type=string kind=string quoted=false*/ { @@ -5107,7 +5153,7 @@ handle_Name: outBuf := fs.Output.Bytes() - uj.Name = string(string(outBuf)) + j.Name = string(string(outBuf)) } } @@ -5117,7 +5163,7 @@ handle_Name: handle_Notifications: - /* handler: uj.Notifications type=string kind=string quoted=false*/ + /* handler: j.Notifications type=string kind=string quoted=false*/ { @@ -5129,7 +5175,7 @@ handle_Notifications: if tok == fflib.FFTok_null { - uj.Notifications = nil + j.Notifications = nil } else { @@ -5137,7 +5183,7 @@ handle_Notifications: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.Notifications = &tval + j.Notifications = &tval } } @@ -5147,7 +5193,7 @@ handle_Notifications: handle_ProfileBackgroundColor: - /* handler: uj.ProfileBackgroundColor type=string kind=string quoted=false*/ + /* handler: j.ProfileBackgroundColor type=string kind=string quoted=false*/ { @@ -5163,7 +5209,7 @@ handle_ProfileBackgroundColor: outBuf := fs.Output.Bytes() - uj.ProfileBackgroundColor = string(string(outBuf)) + j.ProfileBackgroundColor = string(string(outBuf)) } } @@ -5173,7 +5219,7 @@ handle_ProfileBackgroundColor: handle_ProfileBackgroundImageURL: - /* handler: uj.ProfileBackgroundImageURL type=string kind=string quoted=false*/ + /* handler: j.ProfileBackgroundImageURL type=string kind=string quoted=false*/ { @@ -5189,7 +5235,7 @@ handle_ProfileBackgroundImageURL: outBuf := fs.Output.Bytes() - uj.ProfileBackgroundImageURL = string(string(outBuf)) + j.ProfileBackgroundImageURL = string(string(outBuf)) } } @@ -5199,7 +5245,7 @@ handle_ProfileBackgroundImageURL: handle_ProfileBackgroundImageURLHTTPS: - /* handler: uj.ProfileBackgroundImageURLHTTPS type=string kind=string quoted=false*/ + /* handler: j.ProfileBackgroundImageURLHTTPS type=string kind=string quoted=false*/ { @@ -5215,7 +5261,7 @@ handle_ProfileBackgroundImageURLHTTPS: outBuf := fs.Output.Bytes() - uj.ProfileBackgroundImageURLHTTPS = string(string(outBuf)) + j.ProfileBackgroundImageURLHTTPS = string(string(outBuf)) } } @@ -5225,7 +5271,7 @@ handle_ProfileBackgroundImageURLHTTPS: handle_ProfileBackgroundTile: - /* handler: uj.ProfileBackgroundTile type=bool kind=bool quoted=false*/ + /* handler: j.ProfileBackgroundTile type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -5241,11 +5287,11 @@ handle_ProfileBackgroundTile: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.ProfileBackgroundTile = true + j.ProfileBackgroundTile = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.ProfileBackgroundTile = false + j.ProfileBackgroundTile = false } else { err = errors.New("unexpected bytes for true/false value") @@ -5260,7 +5306,7 @@ handle_ProfileBackgroundTile: handle_ProfileImageURL: - /* handler: uj.ProfileImageURL type=string kind=string quoted=false*/ + /* handler: j.ProfileImageURL type=string kind=string quoted=false*/ { @@ -5276,7 +5322,7 @@ handle_ProfileImageURL: outBuf := fs.Output.Bytes() - uj.ProfileImageURL = string(string(outBuf)) + j.ProfileImageURL = string(string(outBuf)) } } @@ -5286,7 +5332,7 @@ handle_ProfileImageURL: handle_ProfileImageURLHTTPS: - /* handler: uj.ProfileImageURLHTTPS type=string kind=string quoted=false*/ + /* handler: j.ProfileImageURLHTTPS type=string kind=string quoted=false*/ { @@ -5302,7 +5348,7 @@ handle_ProfileImageURLHTTPS: outBuf := fs.Output.Bytes() - uj.ProfileImageURLHTTPS = string(string(outBuf)) + j.ProfileImageURLHTTPS = string(string(outBuf)) } } @@ -5312,7 +5358,7 @@ handle_ProfileImageURLHTTPS: handle_ProfileLinkColor: - /* handler: uj.ProfileLinkColor type=string kind=string quoted=false*/ + /* handler: j.ProfileLinkColor type=string kind=string quoted=false*/ { @@ -5328,7 +5374,7 @@ handle_ProfileLinkColor: outBuf := fs.Output.Bytes() - uj.ProfileLinkColor = string(string(outBuf)) + j.ProfileLinkColor = string(string(outBuf)) } } @@ -5338,7 +5384,7 @@ handle_ProfileLinkColor: handle_ProfileSidebarBorderColor: - /* handler: uj.ProfileSidebarBorderColor type=string kind=string quoted=false*/ + /* handler: j.ProfileSidebarBorderColor type=string kind=string quoted=false*/ { @@ -5354,7 +5400,7 @@ handle_ProfileSidebarBorderColor: outBuf := fs.Output.Bytes() - uj.ProfileSidebarBorderColor = string(string(outBuf)) + j.ProfileSidebarBorderColor = string(string(outBuf)) } } @@ -5364,7 +5410,7 @@ handle_ProfileSidebarBorderColor: handle_ProfileSidebarFillColor: - /* handler: uj.ProfileSidebarFillColor type=string kind=string quoted=false*/ + /* handler: j.ProfileSidebarFillColor type=string kind=string quoted=false*/ { @@ -5380,7 +5426,7 @@ handle_ProfileSidebarFillColor: outBuf := fs.Output.Bytes() - uj.ProfileSidebarFillColor = string(string(outBuf)) + j.ProfileSidebarFillColor = string(string(outBuf)) } } @@ -5390,7 +5436,7 @@ handle_ProfileSidebarFillColor: handle_ProfileTextColor: - /* handler: uj.ProfileTextColor type=string kind=string quoted=false*/ + /* handler: j.ProfileTextColor type=string kind=string quoted=false*/ { @@ -5406,7 +5452,7 @@ handle_ProfileTextColor: outBuf := fs.Output.Bytes() - uj.ProfileTextColor = string(string(outBuf)) + j.ProfileTextColor = string(string(outBuf)) } } @@ -5416,7 +5462,7 @@ handle_ProfileTextColor: handle_ProfileUseBackgroundImage: - /* handler: uj.ProfileUseBackgroundImage type=bool kind=bool quoted=false*/ + /* handler: j.ProfileUseBackgroundImage type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -5432,11 +5478,11 @@ handle_ProfileUseBackgroundImage: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.ProfileUseBackgroundImage = true + j.ProfileUseBackgroundImage = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.ProfileUseBackgroundImage = false + j.ProfileUseBackgroundImage = false } else { err = errors.New("unexpected bytes for true/false value") @@ -5451,7 +5497,7 @@ handle_ProfileUseBackgroundImage: handle_Protected: - /* handler: uj.Protected type=bool kind=bool quoted=false*/ + /* handler: j.Protected type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -5467,11 +5513,11 @@ handle_Protected: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.Protected = true + j.Protected = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.Protected = false + j.Protected = false } else { err = errors.New("unexpected bytes for true/false value") @@ -5486,7 +5532,7 @@ handle_Protected: handle_ScreenName: - /* handler: uj.ScreenName type=string kind=string quoted=false*/ + /* handler: j.ScreenName type=string kind=string quoted=false*/ { @@ -5502,7 +5548,7 @@ handle_ScreenName: outBuf := fs.Output.Bytes() - uj.ScreenName = string(string(outBuf)) + j.ScreenName = string(string(outBuf)) } } @@ -5512,7 +5558,7 @@ handle_ScreenName: handle_ShowAllInlineMedia: - /* handler: uj.ShowAllInlineMedia type=bool kind=bool quoted=false*/ + /* handler: j.ShowAllInlineMedia type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -5528,11 +5574,11 @@ handle_ShowAllInlineMedia: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.ShowAllInlineMedia = true + j.ShowAllInlineMedia = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.ShowAllInlineMedia = false + j.ShowAllInlineMedia = false } else { err = errors.New("unexpected bytes for true/false value") @@ -5547,7 +5593,7 @@ handle_ShowAllInlineMedia: handle_StatusesCount: - /* handler: uj.StatusesCount type=int kind=int quoted=false*/ + /* handler: j.StatusesCount type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -5567,7 +5613,7 @@ handle_StatusesCount: return fs.WrapErr(err) } - uj.StatusesCount = int(tval) + j.StatusesCount = int(tval) } } @@ -5577,7 +5623,7 @@ handle_StatusesCount: handle_TimeZone: - /* handler: uj.TimeZone type=string kind=string quoted=false*/ + /* handler: j.TimeZone type=string kind=string quoted=false*/ { @@ -5593,7 +5639,7 @@ handle_TimeZone: outBuf := fs.Output.Bytes() - uj.TimeZone = string(string(outBuf)) + j.TimeZone = string(string(outBuf)) } } @@ -5603,7 +5649,7 @@ handle_TimeZone: handle_URL: - /* handler: uj.URL type=string kind=string quoted=false*/ + /* handler: j.URL type=string kind=string quoted=false*/ { @@ -5615,7 +5661,7 @@ handle_URL: if tok == fflib.FFTok_null { - uj.URL = nil + j.URL = nil } else { @@ -5623,7 +5669,7 @@ handle_URL: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - uj.URL = &tval + j.URL = &tval } } @@ -5633,7 +5679,7 @@ handle_URL: handle_UtcOffset: - /* handler: uj.UtcOffset type=int kind=int quoted=false*/ + /* handler: j.UtcOffset type=int kind=int quoted=false*/ { if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { @@ -5653,7 +5699,7 @@ handle_UtcOffset: return fs.WrapErr(err) } - uj.UtcOffset = int(tval) + j.UtcOffset = int(tval) } } @@ -5663,7 +5709,7 @@ handle_UtcOffset: handle_Verified: - /* handler: uj.Verified type=bool kind=bool quoted=false*/ + /* handler: j.Verified type=bool kind=bool quoted=false*/ { if tok != fflib.FFTok_bool && tok != fflib.FFTok_null { @@ -5679,11 +5725,11 @@ handle_Verified: if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 { - uj.Verified = true + j.Verified = true } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 { - uj.Verified = false + j.Verified = false } else { err = errors.New("unexpected bytes for true/false value") @@ -5710,23 +5756,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *UserEntities) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *UserEntities) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *UserEntities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *UserEntities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -5738,7 +5788,7 @@ func (mj *UserEntities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { { - err = mj.Description.MarshalJSONBuf(buf) + err = j.Description.MarshalJSONBuf(buf) if err != nil { return err } @@ -5748,7 +5798,7 @@ func (mj *UserEntities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { { - err = mj.URL.MarshalJSONBuf(buf) + err = j.URL.MarshalJSONBuf(buf) if err != nil { return err } @@ -5759,26 +5809,28 @@ func (mj *UserEntities) MarshalJSONBuf(buf fflib.EncodingBuffer) error { } const ( - ffj_t_UserEntitiesbase = iota - ffj_t_UserEntitiesno_such_key + ffjtUserEntitiesbase = iota + ffjtUserEntitiesnosuchkey - ffj_t_UserEntities_Description + ffjtUserEntitiesDescription - ffj_t_UserEntities_URL + ffjtUserEntitiesURL ) -var ffj_key_UserEntities_Description = []byte("description") +var ffjKeyUserEntitiesDescription = []byte("description") -var ffj_key_UserEntities_URL = []byte("url") +var ffjKeyUserEntitiesURL = []byte("url") -func (uj *UserEntities) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *UserEntities) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *UserEntities) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_UserEntitiesbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *UserEntities) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtUserEntitiesbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -5824,7 +5876,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_UserEntitiesno_such_key + currentKey = ffjtUserEntitiesnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -5832,35 +5884,35 @@ mainparse: case 'd': - if bytes.Equal(ffj_key_UserEntities_Description, kn) { - currentKey = ffj_t_UserEntities_Description + if bytes.Equal(ffjKeyUserEntitiesDescription, kn) { + currentKey = ffjtUserEntitiesDescription state = fflib.FFParse_want_colon goto mainparse } case 'u': - if bytes.Equal(ffj_key_UserEntities_URL, kn) { - currentKey = ffj_t_UserEntities_URL + if bytes.Equal(ffjKeyUserEntitiesURL, kn) { + currentKey = ffjtUserEntitiesURL state = fflib.FFParse_want_colon goto mainparse } } - if fflib.SimpleLetterEqualFold(ffj_key_UserEntities_URL, kn) { - currentKey = ffj_t_UserEntities_URL + if fflib.SimpleLetterEqualFold(ffjKeyUserEntitiesURL, kn) { + currentKey = ffjtUserEntitiesURL state = fflib.FFParse_want_colon goto mainparse } - if fflib.EqualFoldRight(ffj_key_UserEntities_Description, kn) { - currentKey = ffj_t_UserEntities_Description + if fflib.EqualFoldRight(ffjKeyUserEntitiesDescription, kn) { + currentKey = ffjtUserEntitiesDescription state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_UserEntitiesno_such_key + currentKey = ffjtUserEntitiesnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -5877,13 +5929,13 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_UserEntities_Description: + case ffjtUserEntitiesDescription: goto handle_Description - case ffj_t_UserEntities_URL: + case ffjtUserEntitiesURL: goto handle_URL - case ffj_t_UserEntitiesno_such_key: + case ffjtUserEntitiesnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -5899,18 +5951,17 @@ mainparse: handle_Description: - /* handler: uj.Description type=benchmark.UserEntityDescription kind=struct quoted=false*/ + /* handler: j.Description type=benchmark.UserEntityDescription kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = uj.Description.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = j.Description.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } @@ -5920,18 +5971,17 @@ handle_Description: handle_URL: - /* handler: uj.URL type=benchmark.UserEntityURL kind=struct quoted=false*/ + /* handler: j.URL type=benchmark.UserEntityURL kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = uj.URL.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = j.URL.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } @@ -5953,23 +6003,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *UserEntityDescription) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *UserEntityDescription) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *UserEntityDescription) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *UserEntityDescription) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -5978,9 +6032,9 @@ func (mj *UserEntityDescription) MarshalJSONBuf(buf fflib.EncodingBuffer) error _ = obj _ = err buf.WriteString(`{"urls":`) - if mj.Urls != nil { + if j.Urls != nil { buf.WriteString(`[`) - for i, v := range mj.Urls { + for i, v := range j.Urls { if i != 0 { buf.WriteString(`,`) } @@ -5999,22 +6053,24 @@ func (mj *UserEntityDescription) MarshalJSONBuf(buf fflib.EncodingBuffer) error } const ( - ffj_t_UserEntityDescriptionbase = iota - ffj_t_UserEntityDescriptionno_such_key + ffjtUserEntityDescriptionbase = iota + ffjtUserEntityDescriptionnosuchkey - ffj_t_UserEntityDescription_Urls + ffjtUserEntityDescriptionUrls ) -var ffj_key_UserEntityDescription_Urls = []byte("urls") +var ffjKeyUserEntityDescriptionUrls = []byte("urls") -func (uj *UserEntityDescription) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *UserEntityDescription) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *UserEntityDescription) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_UserEntityDescriptionbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *UserEntityDescription) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtUserEntityDescriptionbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -6060,7 +6116,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_UserEntityDescriptionno_such_key + currentKey = ffjtUserEntityDescriptionnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -6068,21 +6124,21 @@ mainparse: case 'u': - if bytes.Equal(ffj_key_UserEntityDescription_Urls, kn) { - currentKey = ffj_t_UserEntityDescription_Urls + if bytes.Equal(ffjKeyUserEntityDescriptionUrls, kn) { + currentKey = ffjtUserEntityDescriptionUrls state = fflib.FFParse_want_colon goto mainparse } } - if fflib.EqualFoldRight(ffj_key_UserEntityDescription_Urls, kn) { - currentKey = ffj_t_UserEntityDescription_Urls + if fflib.EqualFoldRight(ffjKeyUserEntityDescriptionUrls, kn) { + currentKey = ffjtUserEntityDescriptionUrls state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_UserEntityDescriptionno_such_key + currentKey = ffjtUserEntityDescriptionnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -6099,10 +6155,10 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_UserEntityDescription_Urls: + case ffjtUserEntityDescriptionUrls: goto handle_Urls - case ffj_t_UserEntityDescriptionno_such_key: + case ffjtUserEntityDescriptionnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -6118,7 +6174,7 @@ mainparse: handle_Urls: - /* handler: uj.Urls type=[]*string kind=slice quoted=false*/ + /* handler: j.Urls type=[]*string kind=slice quoted=false*/ { @@ -6129,16 +6185,16 @@ handle_Urls: } if tok == fflib.FFTok_null { - uj.Urls = nil + j.Urls = nil } else { - uj.Urls = make([]*string, 0) + j.Urls = []*string{} wantVal := true for { - var tmp_uj__Urls *string + var tmpJUrls *string tok = fs.Scan() if tok == fflib.FFTok_error { @@ -6159,18 +6215,18 @@ handle_Urls: wantVal = true } - /* handler: tmp_uj__Urls type=*string kind=ptr quoted=false*/ + /* handler: tmpJUrls type=*string kind=ptr quoted=false*/ { if tok == fflib.FFTok_null { - tmp_uj__Urls = nil + tmpJUrls = nil } else { - if tmp_uj__Urls == nil { - tmp_uj__Urls = new(string) + if tmpJUrls == nil { + tmpJUrls = new(string) } - /* handler: tmp_uj__Urls type=string kind=string quoted=false*/ + /* handler: tmpJUrls type=string kind=string quoted=false*/ { @@ -6182,7 +6238,7 @@ handle_Urls: if tok == fflib.FFTok_null { - tmp_uj__Urls = nil + tmpJUrls = nil } else { @@ -6190,7 +6246,7 @@ handle_Urls: outBuf := fs.Output.Bytes() tval = string(string(outBuf)) - tmp_uj__Urls = &tval + tmpJUrls = &tval } } @@ -6198,7 +6254,8 @@ handle_Urls: } } - uj.Urls = append(uj.Urls, tmp_uj__Urls) + j.Urls = append(j.Urls, tmpJUrls) + wantVal = false } } @@ -6221,23 +6278,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *UserEntityURL) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *UserEntityURL) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *UserEntityURL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *UserEntityURL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -6246,9 +6307,9 @@ func (mj *UserEntityURL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { _ = obj _ = err buf.WriteString(`{"urls":`) - if mj.Urls != nil { + if j.Urls != nil { buf.WriteString(`[`) - for i, v := range mj.Urls { + for i, v := range j.Urls { if i != 0 { buf.WriteString(`,`) } @@ -6271,22 +6332,24 @@ func (mj *UserEntityURL) MarshalJSONBuf(buf fflib.EncodingBuffer) error { } const ( - ffj_t_UserEntityURLbase = iota - ffj_t_UserEntityURLno_such_key + ffjtUserEntityURLbase = iota + ffjtUserEntityURLnosuchkey - ffj_t_UserEntityURL_Urls + ffjtUserEntityURLUrls ) -var ffj_key_UserEntityURL_Urls = []byte("urls") +var ffjKeyUserEntityURLUrls = []byte("urls") -func (uj *UserEntityURL) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *UserEntityURL) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *UserEntityURL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_UserEntityURLbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *UserEntityURL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtUserEntityURLbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -6332,7 +6395,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_UserEntityURLno_such_key + currentKey = ffjtUserEntityURLnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -6340,21 +6403,21 @@ mainparse: case 'u': - if bytes.Equal(ffj_key_UserEntityURL_Urls, kn) { - currentKey = ffj_t_UserEntityURL_Urls + if bytes.Equal(ffjKeyUserEntityURLUrls, kn) { + currentKey = ffjtUserEntityURLUrls state = fflib.FFParse_want_colon goto mainparse } } - if fflib.EqualFoldRight(ffj_key_UserEntityURL_Urls, kn) { - currentKey = ffj_t_UserEntityURL_Urls + if fflib.EqualFoldRight(ffjKeyUserEntityURLUrls, kn) { + currentKey = ffjtUserEntityURLUrls state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_UserEntityURLno_such_key + currentKey = ffjtUserEntityURLnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -6371,10 +6434,10 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_UserEntityURL_Urls: + case ffjtUserEntityURLUrls: goto handle_Urls - case ffj_t_UserEntityURLno_such_key: + case ffjtUserEntityURLnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -6390,7 +6453,7 @@ mainparse: handle_Urls: - /* handler: uj.Urls type=[]benchmark.URL kind=slice quoted=false*/ + /* handler: j.Urls type=[]benchmark.URL kind=slice quoted=false*/ { @@ -6401,16 +6464,16 @@ handle_Urls: } if tok == fflib.FFTok_null { - uj.Urls = nil + j.Urls = nil } else { - uj.Urls = make([]URL, 0) + j.Urls = []URL{} wantVal := true for { - var tmp_uj__Urls URL + var tmpJUrls URL tok = fs.Scan() if tok == fflib.FFTok_error { @@ -6431,23 +6494,23 @@ handle_Urls: wantVal = true } - /* handler: tmp_uj__Urls type=benchmark.URL kind=struct quoted=false*/ + /* handler: tmpJUrls type=benchmark.URL kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = tmp_uj__Urls.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = tmpJUrls.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } - uj.Urls = append(uj.Urls, tmp_uj__Urls) + j.Urls = append(j.Urls, tmpJUrls) + wantVal = false } } @@ -6470,23 +6533,27 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } -func (mj *XLStruct) MarshalJSON() ([]byte, error) { +// MarshalJSON marshal bytes to json - template +func (j *XLStruct) MarshalJSON() ([]byte, error) { var buf fflib.Buffer - if mj == nil { + if j == nil { buf.WriteString("null") return buf.Bytes(), nil } - err := mj.MarshalJSONBuf(&buf) + err := j.MarshalJSONBuf(&buf) if err != nil { return nil, err } return buf.Bytes(), nil } -func (mj *XLStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { - if mj == nil { + +// MarshalJSONBuf marshal buff to json - template +func (j *XLStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { + if j == nil { buf.WriteString("null") return nil } @@ -6495,9 +6562,9 @@ func (mj *XLStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { _ = obj _ = err buf.WriteString(`{"Data":`) - if mj.Data != nil { + if j.Data != nil { buf.WriteString(`[`) - for i, v := range mj.Data { + for i, v := range j.Data { if i != 0 { buf.WriteString(`,`) } @@ -6520,22 +6587,24 @@ func (mj *XLStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error { } const ( - ffj_t_XLStructbase = iota - ffj_t_XLStructno_such_key + ffjtXLStructbase = iota + ffjtXLStructnosuchkey - ffj_t_XLStruct_Data + ffjtXLStructData ) -var ffj_key_XLStruct_Data = []byte("Data") +var ffjKeyXLStructData = []byte("Data") -func (uj *XLStruct) UnmarshalJSON(input []byte) error { +// UnmarshalJSON umarshall json - template of ffjson +func (j *XLStruct) UnmarshalJSON(input []byte) error { fs := fflib.NewFFLexer(input) - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) + return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) } -func (uj *XLStruct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { - var err error = nil - currentKey := ffj_t_XLStructbase +// UnmarshalJSONFFLexer fast json unmarshall - template ffjson +func (j *XLStruct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { + var err error + currentKey := ffjtXLStructbase _ = currentKey tok := fflib.FFTok_init wantedTok := fflib.FFTok_init @@ -6581,7 +6650,7 @@ mainparse: kn := fs.Output.Bytes() if len(kn) <= 0 { // "" case. hrm. - currentKey = ffj_t_XLStructno_such_key + currentKey = ffjtXLStructnosuchkey state = fflib.FFParse_want_colon goto mainparse } else { @@ -6589,21 +6658,21 @@ mainparse: case 'D': - if bytes.Equal(ffj_key_XLStruct_Data, kn) { - currentKey = ffj_t_XLStruct_Data + if bytes.Equal(ffjKeyXLStructData, kn) { + currentKey = ffjtXLStructData state = fflib.FFParse_want_colon goto mainparse } } - if fflib.SimpleLetterEqualFold(ffj_key_XLStruct_Data, kn) { - currentKey = ffj_t_XLStruct_Data + if fflib.SimpleLetterEqualFold(ffjKeyXLStructData, kn) { + currentKey = ffjtXLStructData state = fflib.FFParse_want_colon goto mainparse } - currentKey = ffj_t_XLStructno_such_key + currentKey = ffjtXLStructnosuchkey state = fflib.FFParse_want_colon goto mainparse } @@ -6620,10 +6689,10 @@ mainparse: if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { switch currentKey { - case ffj_t_XLStruct_Data: + case ffjtXLStructData: goto handle_Data - case ffj_t_XLStructno_such_key: + case ffjtXLStructnosuchkey: err = fs.SkipField(tok) if err != nil { return fs.WrapErr(err) @@ -6639,7 +6708,7 @@ mainparse: handle_Data: - /* handler: uj.Data type=[]benchmark.LargeStruct kind=slice quoted=false*/ + /* handler: j.Data type=[]benchmark.LargeStruct kind=slice quoted=false*/ { @@ -6650,16 +6719,16 @@ handle_Data: } if tok == fflib.FFTok_null { - uj.Data = nil + j.Data = nil } else { - uj.Data = make([]LargeStruct, 0) + j.Data = []LargeStruct{} wantVal := true for { - var tmp_uj__Data LargeStruct + var tmpJData LargeStruct tok = fs.Scan() if tok == fflib.FFTok_error { @@ -6680,23 +6749,23 @@ handle_Data: wantVal = true } - /* handler: tmp_uj__Data type=benchmark.LargeStruct kind=struct quoted=false*/ + /* handler: tmpJData type=benchmark.LargeStruct kind=struct quoted=false*/ { if tok == fflib.FFTok_null { - state = fflib.FFParse_after_value - goto mainparse - } + } else { - err = tmp_uj__Data.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) - if err != nil { - return err + err = tmpJData.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) + if err != nil { + return err + } } state = fflib.FFParse_after_value } - uj.Data = append(uj.Data, tmp_uj__Data) + j.Data = append(j.Data, tmpJData) + wantVal = false } } @@ -6719,5 +6788,6 @@ tokerror: } panic("ffjson-generated: unreachable, please report bug.") done: + return nil } diff --git a/benchmark/go.mod b/benchmark/go.mod index 72e3fdf..014be9d 100644 --- a/benchmark/go.mod +++ b/benchmark/go.mod @@ -7,6 +7,8 @@ require ( github.com/mailru/easyjson v0.0.0 github.com/pquerna/ffjson v0.0.0-20190813045741-dac163c6c0a9 github.com/ugorji/go/codec v1.1.7 + github.com/ugorji/go/codec/codecgen v1.1.7 + golang.org/x/tools v0.0.0-20190829051458-42f498d34c4d // indirect ) replace github.com/mailru/easyjson => ../ diff --git a/benchmark/go.sum b/benchmark/go.sum index f2a0ff9..24d8af5 100644 --- a/benchmark/go.sum +++ b/benchmark/go.sum @@ -19,3 +19,13 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec/codecgen v1.1.7 h1:6BU4y9NIgvVMNetSGxkH9lOOa2UB5b8sCHC6+8m5lVc= +github.com/ugorji/go/codec/codecgen v1.1.7/go.mod h1:FMgcDIjFRtjQPUVM3GN592ic8epl2qsvfNPhezMgP8Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190829051458-42f498d34c4d h1:yqT69RdmShXXRtsT9jS6Iy0FFLWGLCe3IqGE0vsP0m4= +golang.org/x/tools v0.0.0-20190829051458-42f498d34c4d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/benchmark/tools.go b/benchmark/tools.go new file mode 100644 index 0000000..87cc421 --- /dev/null +++ b/benchmark/tools.go @@ -0,0 +1,7 @@ +//+build tools + +package benchmark + +import ( + _ "github.com/ugorji/go/codec/codecgen" +) From c786b9d3b6aee1f3283a40283fb5ca81aa49701f Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Thu, 29 Aug 2019 18:53:33 +0300 Subject: [PATCH 13/28] use bin dir instead of .root Seems like "bin" is more common for such things. --- Makefile | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index f484d04..7b9ac94 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,15 @@ all: test clean: - rm -rf .root + rm -rf bin rm -rf tests/*_easyjson.go rm -rf benchmark/*_easyjson.go build: - go build -i -o .root/bin/easyjson ./easyjson + go build -i -o ./bin/easyjson ./easyjson generate: build - .root/bin/easyjson -stubs \ + bin/easyjson -stubs \ ./tests/snake.go \ ./tests/data.go \ ./tests/omitempty.go \ @@ -19,19 +19,19 @@ generate: build ./tests/embedded_type.go \ ./tests/reference_to_pointer.go \ - .root/bin/easyjson -all ./tests/data.go - .root/bin/easyjson -all ./tests/nothing.go - .root/bin/easyjson -all ./tests/errors.go - .root/bin/easyjson -snake_case ./tests/snake.go - .root/bin/easyjson -omit_empty ./tests/omitempty.go - .root/bin/easyjson -build_tags=use_easyjson ./benchmark/data.go - .root/bin/easyjson ./tests/nested_easy.go - .root/bin/easyjson ./tests/named_type.go - .root/bin/easyjson ./tests/custom_map_key_type.go - .root/bin/easyjson ./tests/embedded_type.go - .root/bin/easyjson ./tests/reference_to_pointer.go - .root/bin/easyjson ./tests/key_marshaler_map.go - .root/bin/easyjson -disallow_unknown_fields ./tests/disallow_unknown.go + bin/easyjson -all ./tests/data.go + bin/easyjson -all ./tests/nothing.go + bin/easyjson -all ./tests/errors.go + bin/easyjson -snake_case ./tests/snake.go + bin/easyjson -omit_empty ./tests/omitempty.go + bin/easyjson -build_tags=use_easyjson ./benchmark/data.go + bin/easyjson ./tests/nested_easy.go + bin/easyjson ./tests/named_type.go + bin/easyjson ./tests/custom_map_key_type.go + bin/easyjson ./tests/embedded_type.go + bin/easyjson ./tests/reference_to_pointer.go + bin/easyjson ./tests/key_marshaler_map.go + bin/easyjson -disallow_unknown_fields ./tests/disallow_unknown.go test: generate go test \ From 81f2536554cdb7be3703929da4d7297acd4f5b50 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Fri, 30 Aug 2019 12:51:08 +0300 Subject: [PATCH 14/28] better track tool dependencies --- benchmark/tools.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/benchmark/tools.go b/benchmark/tools.go index 87cc421..a3c8dbe 100644 --- a/benchmark/tools.go +++ b/benchmark/tools.go @@ -1,6 +1,8 @@ //+build tools -package benchmark +// Package tools tracks dependencies on binaries not otherwise referenced in the codebase. +// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module +package tools import ( _ "github.com/ugorji/go/codec/codecgen" From baa893c8f6bc6c125ad965bdb052ff1bd310570b Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Thu, 3 Oct 2019 07:30:27 +0700 Subject: [PATCH 15/28] Fixes a concurrency issue with go module package path cache The `chromedp-gen` tool, which makes use of the raw code, always encounters issues with slow builds. This adds a simple `sync.RWMutex` to the Go module map package path cache variable that's causing problems. --- parser/pkgpath.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/parser/pkgpath.go b/parser/pkgpath.go index 155d168..b2fdea8 100644 --- a/parser/pkgpath.go +++ b/parser/pkgpath.go @@ -90,19 +90,27 @@ func getPkgPathFromGoMod(fname string, isDir bool, goModPath string) (string, er return path.Clean(rel), nil } -var ( - modulePrefix = []byte("\nmodule ") - pkgPathFromGoModCache = make(map[string]string) -) +var modulePrefix = []byte("\nmodule ") + +var pkgPathFromGoModCache = struct { + paths map[string]string + sync.RWMutex +}{ + paths: make(map[string]string), +} func getModulePath(goModPath string) string { - pkgPath, ok := pkgPathFromGoModCache[goModPath] + pkgPathFromGoModCache.RLock() + pkgPath, ok := pkgPathFromGoModCache.paths[goModPath] + pkgPathFromGoModCache.RUnlock() if ok { return pkgPath } defer func() { - pkgPathFromGoModCache[goModPath] = pkgPath + pkgPathFromGoModCache.Lock() + pkgPathFromGoModCache.paths[goModPath] = pkgPath + pkgPathFromGoModCache.Unlock() }() data, err := ioutil.ReadFile(goModPath) From 3b3f3665d3dcae0319bca4c4c80d693f31bdf9a9 Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Thu, 3 Oct 2019 07:44:02 +0700 Subject: [PATCH 16/28] Convert exec.Command for gofmt to standard go/format package Converts exec.Command call for formatting the generated Go code from the bootstrapper to use the standard `go/format` package for formatting. Fixes an issue / problem that the `cdproto-gen` tool is encountering. --- bootstrap/bootstrap.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index a461bf1..134244b 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -7,6 +7,7 @@ package bootstrap import ( "fmt" + "go/format" "io/ioutil" "os" "os/exec" @@ -176,18 +177,21 @@ func (g *Generator) Run() error { if err = cmd.Run(); err != nil { return err } - f.Close() - if !g.NoFormat { - cmd = exec.Command("gofmt", "-w", f.Name()) - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - - if err = cmd.Run(); err != nil { - return err - } + // move unformatted file to out path + if g.NoFormat { + return os.Rename(f.Name(), g.OutName) } - return os.Rename(f.Name(), g.OutName) + // format file and write to out path + in, err := ioutil.ReadFile(f.Name()) + if err != nil { + return err + } + out, err := format.Source(in) + if err != nil { + return err + } + return ioutil.WriteFile(g.OutName, out, 0644) } From e6347e1e0b410cb4150218d87c46aac343c19956 Mon Sep 17 00:00:00 2001 From: Alexandr Mayorskiy Date: Tue, 8 Oct 2019 22:47:07 +0300 Subject: [PATCH 17/28] optimize writer --- jwriter/writer.go | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/jwriter/writer.go b/jwriter/writer.go index b9ed7cc..eb8547c 100644 --- a/jwriter/writer.go +++ b/jwriter/writer.go @@ -270,16 +270,25 @@ func (w *Writer) Bool(v bool) { const chars = "0123456789abcdef" -func isNotEscapedSingleChar(c byte, escapeHTML bool) bool { - // Note: might make sense to use a table if there are more chars to escape. With 4 chars - // it benchmarks the same. - if escapeHTML { - return c != '<' && c != '>' && c != '&' && c != '\\' && c != '"' && c >= 0x20 && c < utf8.RuneSelf - } else { - return c != '\\' && c != '"' && c >= 0x20 && c < utf8.RuneSelf +func getTable(falseValues ...int) [128]bool { + table := [128]bool{} + + for i := 0; i < 128; i++ { + table[i] = true } + + for _, v := range falseValues { + table[v] = false + } + + return table } +var ( + htmlEscapeTable = getTable(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, '"', '&', '<', '>', '\\') + htmlNoEscapeTable = getTable(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, '"', '\\') +) + func (w *Writer) String(s string) { w.Buffer.AppendByte('"') @@ -288,15 +297,23 @@ func (w *Writer) String(s string) { p := 0 // last non-escape symbol + var escapeTable [128]bool + if w.NoEscapeHTML { + escapeTable = htmlNoEscapeTable + } else { + escapeTable = htmlEscapeTable + } + for i := 0; i < len(s); { c := s[i] - if isNotEscapedSingleChar(c, !w.NoEscapeHTML) { - // single-width character, no escaping is required - i++ - continue - } else if c < utf8.RuneSelf { - // single-with character, need to escape + if c < utf8.RuneSelf { + if escapeTable[c] { + // single-width character, no escaping is required + i++ + continue + } + w.Buffer.AppendString(s[p:i]) switch c { case '\t': From 39f83e2d0b2008f9c99a80eedcbc61bb0b836c3f Mon Sep 17 00:00:00 2001 From: Alexandr Mayorskiy Date: Wed, 9 Oct 2019 11:59:07 +0300 Subject: [PATCH 18/28] add tests for htmlescaping --- Makefile | 2 ++ tests/html.go | 5 +++++ tests/html_test.go | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 tests/html.go create mode 100644 tests/html_test.go diff --git a/Makefile b/Makefile index 7b9ac94..66cc402 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,12 @@ generate: build ./tests/custom_map_key_type.go \ ./tests/embedded_type.go \ ./tests/reference_to_pointer.go \ + ./tests/html.go \ bin/easyjson -all ./tests/data.go bin/easyjson -all ./tests/nothing.go bin/easyjson -all ./tests/errors.go + bin/easyjson -all ./tests/html.go bin/easyjson -snake_case ./tests/snake.go bin/easyjson -omit_empty ./tests/omitempty.go bin/easyjson -build_tags=use_easyjson ./benchmark/data.go diff --git a/tests/html.go b/tests/html.go new file mode 100644 index 0000000..575e760 --- /dev/null +++ b/tests/html.go @@ -0,0 +1,5 @@ +package tests + +type Struct struct { + Test string +} diff --git a/tests/html_test.go b/tests/html_test.go new file mode 100644 index 0000000..b579936 --- /dev/null +++ b/tests/html_test.go @@ -0,0 +1,33 @@ +package tests + +import ( + "testing" + + "github.com/mailru/easyjson/jwriter" +) + +func TestHTML(t *testing.T) { + s := Struct{ + Test: "test", + } + + j := jwriter.Writer{ + NoEscapeHTML: false, + } + s.MarshalEasyJSON(&j) + + data, _ := j.BuildBytes() + + if string(data) != `{"Test":"\u003cb\u003etest\u003c/b\u003e"}` { + t.Fatal("EscapeHTML error:", string(data)) + } + + j.NoEscapeHTML = true + s.MarshalEasyJSON(&j) + + data, _ = j.BuildBytes() + + if string(data) != `{"Test":"test"}` { + t.Fatal("NoEscapeHTML error:", string(data)) + } +} From 6892787366a955b9ce3eb5584a3bc8dd6419e721 Mon Sep 17 00:00:00 2001 From: ferhat elmas Date: Thu, 7 Nov 2019 13:21:23 +0100 Subject: [PATCH 19/28] fix some typos in readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3bdcf2d..95997ae 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Additional option notes: ## Generated Marshaler/Unmarshaler Funcs For Go struct types, easyjson generates the funcs `MarshalEasyJSON` / -`UnmarshalEasyJSON` for marshaling/unmarshaling JSON. In turn, these satisify +`UnmarshalEasyJSON` for marshaling/unmarshaling JSON. In turn, these satisfy the `easyjson.Marshaler` and `easyjson.Unmarshaler` interfaces and when used in conjunction with `easyjson.Marshal` / `easyjson.Unmarshal` avoid unnecessary reflection / type assertions during marshaling/unmarshaling to/from JSON for Go @@ -102,17 +102,17 @@ utility funcs that are available. ## Controlling easyjson Marshaling and Unmarshaling Behavior Go types can provide their own `MarshalEasyJSON` and `UnmarshalEasyJSON` funcs -that satisify the `easyjson.Marshaler` / `easyjson.Unmarshaler` interfaces. +that satisfy the `easyjson.Marshaler` / `easyjson.Unmarshaler` interfaces. These will be used by `easyjson.Marshal` and `easyjson.Unmarshal` when defined for a Go type. -Go types can also satisify the `easyjson.Optional` interface, which allows the +Go types can also satisfy the `easyjson.Optional` interface, which allows the type to define its own `omitempty` logic. ## Type Wrappers easyjson provides additional type wrappers defined in the `easyjson/opt` -package. These wrap the standard Go primitives and in turn satisify the +package. These wrap the standard Go primitives and in turn satisfy the easyjson interfaces. The `easyjson/opt` type wrappers are useful when needing to distinguish between @@ -174,7 +174,7 @@ for more information. needs to be known prior to sending the data. Currently this is not possible with easyjson's architecture. -* easyjson parser and codegen based on reflection, so it wont works on `package main` +* easyjson parser and codegen based on reflection, so it won't work on `package main` files, because they cant be imported by parser. ## Benchmarks @@ -239,7 +239,7 @@ since the memory is not freed between marshaling operations. ### easyjson vs 'ujson' python module [ujson](https://github.com/esnme/ultrajson) is using C code for parsing, so it -is interesting to see how plain golang compares to that. It is imporant to note +is interesting to see how plain golang compares to that. It is important to note that the resulting object for python is slower to access, since the library parses JSON object into dictionaries. From d6768890eced49d7982c7f412403df21b2e47997 Mon Sep 17 00:00:00 2001 From: Aravind Gopalan Date: Thu, 21 Nov 2019 18:03:16 -0800 Subject: [PATCH 20/28] Allow empty maps for required map fields (issue #256) As reported in issue #256, currently, an empty map is unmarshalled into nil by easyjson If a field is marked "required" or "!omitempty", then the empty map is a valid input and we should unmarshal it into an empty map. Similar logic for marshalling. This change is to fix the behavior --- .gitignore | 1 + gen/decoder.go | 13 +++++++++---- tests/data.go | 6 ++++++ tests/required_test.go | 23 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 26156fb..fbfaf7a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.iml .idea *.swp +bin/* diff --git a/gen/decoder.go b/gen/decoder.go index ab79869..cd8d42d 100644 --- a/gen/decoder.go +++ b/gen/decoder.go @@ -228,16 +228,21 @@ func (g *Generator) genTypeDecoderNoCheck(t reflect.Type, out string, tags field } // else assume the caller knows what they are doing and that the custom unmarshaler performs the translation from string or integer keys to the key type elem := t.Elem() tmpVar := g.uniqueVarName() + keepEmpty := tags.required || tags.noOmitEmpty || (!g.omitEmpty && !tags.omitEmpty) fmt.Fprintln(g.out, ws+"if in.IsNull() {") fmt.Fprintln(g.out, ws+" in.Skip()") fmt.Fprintln(g.out, ws+"} else {") fmt.Fprintln(g.out, ws+" in.Delim('{')") - fmt.Fprintln(g.out, ws+" if !in.IsDelim('}') {") + if !keepEmpty { + fmt.Fprintln(g.out, ws+" if !in.IsDelim('}') {") + } fmt.Fprintln(g.out, ws+" "+out+" = make("+g.getType(t)+")") - fmt.Fprintln(g.out, ws+" } else {") - fmt.Fprintln(g.out, ws+" "+out+" = nil") - fmt.Fprintln(g.out, ws+" }") + if !keepEmpty { + fmt.Fprintln(g.out, ws+" } else {") + fmt.Fprintln(g.out, ws+" "+out+" = nil") + fmt.Fprintln(g.out, ws+" }") + } fmt.Fprintln(g.out, ws+" for !in.IsDelim('}') {") // NOTE: extra check for TextUnmarshaler. It overrides default methods. diff --git a/tests/data.go b/tests/data.go index 6ae90a0..5e6c610 100644 --- a/tests/data.go +++ b/tests/data.go @@ -678,6 +678,12 @@ type RequiredOptionalStruct struct { Lastname string `json:"last_name"` } +type RequiredOptionalMap struct { + ReqMap map[int]string `json:"req_map,required"` + OmitEmptyMap map[int]string `json:"oe_map,omitempty"` + NoOmitEmptyMap map[int]string `json:"noe_map,!omitempty"` +} + //easyjson:json type EncodingFlagsTestMap struct { F map[string]string diff --git a/tests/required_test.go b/tests/required_test.go index 8cc743d..36a37c8 100644 --- a/tests/required_test.go +++ b/tests/required_test.go @@ -2,6 +2,7 @@ package tests import ( "fmt" + "reflect" "testing" ) @@ -26,3 +27,25 @@ func TestRequiredField(t *testing.T) { } } } + +func TestRequiredOptionalMap(t *testing.T) { + baseJson := `{"req_map":{}, "oe_map":{}, "noe_map":{}, "oe_slice":[]}` + wantDecoding := RequiredOptionalMap{MapIntString{}, nil, MapIntString{}} + + var v RequiredOptionalMap + if err := v.UnmarshalJSON([]byte(baseJson)); err != nil { + t.Errorf("%s. UnmarshalJSON didn't expect error: %v", baseJson, err) + } + if !reflect.DeepEqual(v, wantDecoding) { + t.Errorf("%s. UnmarshalJSON expected to gen: %v. got: %v", baseJson, wantDecoding, v) + } + + baseStruct := RequiredOptionalMap{MapIntString{}, MapIntString{}, MapIntString{}} + wantJson := `{"req_map":{},"noe_map":{}}` + data, err := baseStruct.MarshalJSON() + if err != nil { + t.Errorf("MarshalJSON didn't expect error: %v on %v", err, data) + } else if string(data) != wantJson { + t.Errorf("%v. MarshalJSON wanted: %s got %s", baseStruct, wantJson, string(data)) + } +} From 1c38a191cebc54803eb4d3f01dd0ebc4595804f7 Mon Sep 17 00:00:00 2001 From: Oleg Strokachuk Date: Thu, 30 Jan 2020 16:12:59 +0300 Subject: [PATCH 21/28] Windows only issue: Fix case when file is located in gopath but they have different volume letter. For example: Error parsing fast.go: file 'E:\!project\go\src\coursera\hw3_bench\fast.go' is not in GOPATH 'e:\!project\go\' 1) filepath.Rel takes care about that; 2) add gopath variable to error --- parser/pkgpath.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parser/pkgpath.go b/parser/pkgpath.go index 155d168..f977d29 100644 --- a/parser/pkgpath.go +++ b/parser/pkgpath.go @@ -154,7 +154,8 @@ func getPkgPathFromGOPATH(fname string, isDir bool) (string, error) { for _, p := range strings.Split(gopath, string(filepath.ListSeparator)) { prefix := filepath.Join(p, "src") + string(filepath.Separator) - if rel := strings.TrimPrefix(fname, prefix); rel != fname { + rel, err := filepath.Rel(prefix, fname) + if err == nil && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { if !isDir { return path.Dir(filePathToPackagePath(rel)), nil } else { @@ -163,7 +164,7 @@ func getPkgPathFromGOPATH(fname string, isDir bool) (string, error) { } } - return "", fmt.Errorf("file '%v' is not in GOPATH", fname) + return "", fmt.Errorf("file '%v' is not in GOPATH '%v'", fname, gopath) } func filePathToPackagePath(path string) string { From e17df41dc6bf789b2e0fb658a69e6ee27c540b0e Mon Sep 17 00:00:00 2001 From: Anton Sulaev Date: Mon, 17 Feb 2020 15:02:51 +0300 Subject: [PATCH 22/28] add interfaces to provide marshal/unmarshal logic for unknown fields in struct --- Makefile | 2 ++ gen/decoder.go | 12 ++++++++ gen/encoder.go | 8 ++++++ helpers.go | 10 +++++++ tests/unknown_fields.go | 17 ++++++++++++ tests/unknown_fields_test.go | 54 ++++++++++++++++++++++++++++++++++++ unknown_fields.go | 34 +++++++++++++++++++++++ 7 files changed, 137 insertions(+) create mode 100644 tests/unknown_fields.go create mode 100644 tests/unknown_fields_test.go create mode 100644 unknown_fields.go diff --git a/Makefile b/Makefile index 66cc402..80449f0 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ generate: build ./tests/embedded_type.go \ ./tests/reference_to_pointer.go \ ./tests/html.go \ + ./tests/unknown_fields.go \ bin/easyjson -all ./tests/data.go bin/easyjson -all ./tests/nothing.go @@ -34,6 +35,7 @@ generate: build bin/easyjson ./tests/reference_to_pointer.go bin/easyjson ./tests/key_marshaler_map.go bin/easyjson -disallow_unknown_fields ./tests/disallow_unknown.go + bin/easyjson ./tests/unknown_fields.go test: generate go test \ diff --git a/gen/decoder.go b/gen/decoder.go index cd8d42d..9438568 100644 --- a/gen/decoder.go +++ b/gen/decoder.go @@ -94,6 +94,16 @@ func hasCustomUnmarshaler(t reflect.Type) bool { t.Implements(reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()) } +func hasUnknownsUnmarshaler(t reflect.Type) bool { + t = reflect.PtrTo(t) + return t.Implements(reflect.TypeOf((*easyjson.UnknownsUnmarshaler)(nil)).Elem()) +} + +func hasUnknownsMarshaler(t reflect.Type) bool { + t = reflect.PtrTo(t) + return t.Implements(reflect.TypeOf((*easyjson.UnknownsMarshaler)(nil)).Elem()) +} + // genTypeDecoderNoCheck generates decoding code for the type t. func (g *Generator) genTypeDecoderNoCheck(t reflect.Type, out string, tags fieldTags, indent int) error { ws := strings.Repeat(" ", indent) @@ -485,6 +495,8 @@ func (g *Generator) genStructDecoder(t reflect.Type) error { Reason: "unknown field", Data: key, })`) + } else if hasUnknownsUnmarshaler(t) { + fmt.Fprintln(g.out, " out.UnmarshalUnknown(in, key)") } else { fmt.Fprintln(g.out, " in.SkipRecursive()") } diff --git a/gen/encoder.go b/gen/encoder.go index e86d531..6274d4f 100644 --- a/gen/encoder.go +++ b/gen/encoder.go @@ -393,6 +393,14 @@ func (g *Generator) genStructEncoder(t reflect.Type) error { } } + if hasUnknownsMarshaler(t) { + if !firstCondition { + fmt.Fprintln(g.out, " in.MarshalUnknowns(out, false)") + } else { + fmt.Fprintln(g.out, " in.MarshalUnknowns(out, first)") + } + } + fmt.Fprintln(g.out, " out.RawByte('}')") fmt.Fprintln(g.out, "}") diff --git a/helpers.go b/helpers.go index b86b87d..04ac635 100644 --- a/helpers.go +++ b/helpers.go @@ -26,6 +26,16 @@ type Optional interface { IsDefined() bool } +// UnknownsUnmarshaler provides a method to unmarshal unknown struct fileds and save them as you want +type UnknownsUnmarshaler interface { + UnmarshalUnknown(in *jlexer.Lexer, key string) +} + +// UnknownsMarshaler provides a method to write additional struct fields +type UnknownsMarshaler interface { + MarshalUnknowns(w *jwriter.Writer, first bool) +} + // Marshal returns data as a single byte slice. Method is suboptimal as the data is likely to be copied // from a chain of smaller chunks. func Marshal(v Marshaler) ([]byte, error) { diff --git a/tests/unknown_fields.go b/tests/unknown_fields.go new file mode 100644 index 0000000..3d1b089 --- /dev/null +++ b/tests/unknown_fields.go @@ -0,0 +1,17 @@ +package tests + +import "github.com/mailru/easyjson" + +//easyjson:json +type StructWithUnknownsProxy struct { + easyjson.UnknownFieldsProxy + + Field1 string +} + +//easyjson:json +type StructWithUnknownsProxyWithOmitempty struct { + easyjson.UnknownFieldsProxy + + Field1 string `json:",omitempty"` +} diff --git a/tests/unknown_fields_test.go b/tests/unknown_fields_test.go new file mode 100644 index 0000000..fd1114f --- /dev/null +++ b/tests/unknown_fields_test.go @@ -0,0 +1,54 @@ +package tests + +import ( + "reflect" + "testing" +) + +func TestUnknownFieldsProxy(t *testing.T) { + baseJson := `{"Field1":"123","Field2":"321"}` + + s := StructWithUnknownsProxy{} + + err := s.UnmarshalJSON([]byte(baseJson)) + if err != nil { + t.Errorf("UnmarshalJSON didn't expect error: %v", err) + } + + if s.Field1 != "123" { + t.Errorf("UnmarshalJSON expected to parse Field1 as \"123\". got: %v", s.Field1) + } + + data, err := s.MarshalJSON() + if err != nil { + t.Errorf("MarshalJSON didn't expect error: %v", err) + } + + if !reflect.DeepEqual(baseJson, string(data)) { + t.Errorf("MarshalJSON expected to gen: %v. got: %v", baseJson, string(data)) + } +} + +func TestUnknownFieldsProxyWithOmitempty(t *testing.T) { + baseJson := `{"Field1":"123","Field2":"321"}` + + s := StructWithUnknownsProxyWithOmitempty{} + + err := s.UnmarshalJSON([]byte(baseJson)) + if err != nil { + t.Errorf("UnmarshalJSON didn't expect error: %v", err) + } + + if s.Field1 != "123" { + t.Errorf("UnmarshalJSON expected to parse Field1 as \"123\". got: %v", s.Field1) + } + + data, err := s.MarshalJSON() + if err != nil { + t.Errorf("MarshalJSON didn't expect error: %v", err) + } + + if !reflect.DeepEqual(baseJson, string(data)) { + t.Errorf("MarshalJSON expected to gen: %v. got: %v", baseJson, string(data)) + } +} diff --git a/unknown_fields.go b/unknown_fields.go new file mode 100644 index 0000000..6cfdf83 --- /dev/null +++ b/unknown_fields.go @@ -0,0 +1,34 @@ +package easyjson + +import ( + json "encoding/json" + + jlexer "github.com/mailru/easyjson/jlexer" + "github.com/mailru/easyjson/jwriter" +) + +// UnknownFieldsProxy implemets UnknownsUnmarshaler and UnknownsMarshaler +// use it as embedded field in your structure to parse and then serialize unknown struct fields +type UnknownFieldsProxy struct { + unknownFields map[string]interface{} +} + +func (s *UnknownFieldsProxy) UnmarshalUnknown(in *jlexer.Lexer, key string) { + if s.unknownFields == nil { + s.unknownFields = make(map[string]interface{}, 1) + } + s.unknownFields[key] = in.Interface() +} + +func (s UnknownFieldsProxy) MarshalUnknowns(out *jwriter.Writer, first bool) { + for key, val := range s.unknownFields { + if first { + first = false + } else { + out.RawByte(',') + } + out.String(string(key)) + out.RawByte(':') + out.Raw(json.Marshal(val)) + } +} From 323cc237497f3e69d09df489328dae71316be11a Mon Sep 17 00:00:00 2001 From: Anton Sulaev Date: Tue, 18 Feb 2020 13:46:49 +0300 Subject: [PATCH 23/28] optimize deafult UnknownFieldsProxy realisations with []byte in place of interface{} --- unknown_fields.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/unknown_fields.go b/unknown_fields.go index 6cfdf83..55538ea 100644 --- a/unknown_fields.go +++ b/unknown_fields.go @@ -1,8 +1,6 @@ package easyjson import ( - json "encoding/json" - jlexer "github.com/mailru/easyjson/jlexer" "github.com/mailru/easyjson/jwriter" ) @@ -10,14 +8,14 @@ import ( // UnknownFieldsProxy implemets UnknownsUnmarshaler and UnknownsMarshaler // use it as embedded field in your structure to parse and then serialize unknown struct fields type UnknownFieldsProxy struct { - unknownFields map[string]interface{} + unknownFields map[string][]byte } func (s *UnknownFieldsProxy) UnmarshalUnknown(in *jlexer.Lexer, key string) { if s.unknownFields == nil { - s.unknownFields = make(map[string]interface{}, 1) + s.unknownFields = make(map[string][]byte, 1) } - s.unknownFields[key] = in.Interface() + s.unknownFields[key] = in.Raw() } func (s UnknownFieldsProxy) MarshalUnknowns(out *jwriter.Writer, first bool) { @@ -29,6 +27,6 @@ func (s UnknownFieldsProxy) MarshalUnknowns(out *jwriter.Writer, first bool) { } out.String(string(key)) out.RawByte(':') - out.Raw(json.Marshal(val)) + out.Raw(val, nil) } } From 52fd0e53caf3bba4f2dd5c69880f8bb6caecd03a Mon Sep 17 00:00:00 2001 From: Carlo Alberto Ferraris Date: Fri, 28 Feb 2020 19:04:54 +0900 Subject: [PATCH 24/28] Make Buffer.EnsureSpace inlineable Split the slow path into a separate function, so that the fast path in EnsureSpace becomes inlineable. This allows code in jwriter to inline the fast path. --- buffer/pool.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/buffer/pool.go b/buffer/pool.go index 07fb4bc..4c508f7 100644 --- a/buffer/pool.go +++ b/buffer/pool.go @@ -78,9 +78,12 @@ type Buffer struct { // EnsureSpace makes sure that the current chunk contains at least s free bytes, // possibly creating a new chunk. func (b *Buffer) EnsureSpace(s int) { - if cap(b.Buf)-len(b.Buf) >= s { - return + if cap(b.Buf)-len(b.Buf) < s { + b.ensureSpaceSlow(s) } +} + +func (b *Buffer) ensureSpaceSlow(s int) { l := len(b.Buf) if l > 0 { if cap(b.toPool) != cap(b.Buf) { @@ -105,18 +108,14 @@ func (b *Buffer) EnsureSpace(s int) { // AppendByte appends a single byte to buffer. func (b *Buffer) AppendByte(data byte) { - if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined. - b.EnsureSpace(1) - } + b.EnsureSpace(1) b.Buf = append(b.Buf, data) } // AppendBytes appends a byte slice to buffer. func (b *Buffer) AppendBytes(data []byte) { for len(data) > 0 { - if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined. - b.EnsureSpace(1) - } + b.EnsureSpace(1) sz := cap(b.Buf) - len(b.Buf) if sz > len(data) { @@ -131,9 +130,7 @@ func (b *Buffer) AppendBytes(data []byte) { // AppendBytes appends a string to buffer. func (b *Buffer) AppendString(data string) { for len(data) > 0 { - if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined. - b.EnsureSpace(1) - } + b.EnsureSpace(1) sz := cap(b.Buf) - len(b.Buf) if sz > len(data) { From 6f81292b372a4f63213763bca66a7211a26ec88b Mon Sep 17 00:00:00 2001 From: Carlo Alberto Ferraris Date: Fri, 28 Feb 2020 19:33:23 +0900 Subject: [PATCH 25/28] wip --- buffer/pool.go | 18 +++++++++++++++++- buffer/pool_test.go | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/buffer/pool.go b/buffer/pool.go index 07fb4bc..5e97991 100644 --- a/buffer/pool.go +++ b/buffer/pool.go @@ -113,6 +113,14 @@ func (b *Buffer) AppendByte(data byte) { // AppendBytes appends a byte slice to buffer. func (b *Buffer) AppendBytes(data []byte) { + if len(data) <= cap(b.Buf)-len(b.Buf) { + b.Buf = append(b.Buf, data...) // fast path + } else { + b.appendBytesSlow(data) + } +} + +func (b *Buffer) appendBytesSlow(data []byte) { for len(data) > 0 { if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined. b.EnsureSpace(1) @@ -128,8 +136,16 @@ func (b *Buffer) AppendBytes(data []byte) { } } -// AppendBytes appends a string to buffer. +// AppendString appends a string to buffer. func (b *Buffer) AppendString(data string) { + if len(data) <= cap(b.Buf)-len(b.Buf) { + b.Buf = append(b.Buf, data...) // fast path + } else { + b.appendStringSlow(data) + } +} + +func (b *Buffer) appendStringSlow(data string) { for len(data) > 0 { if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined. b.EnsureSpace(1) diff --git a/buffer/pool_test.go b/buffer/pool_test.go index 680623a..1f321d3 100644 --- a/buffer/pool_test.go +++ b/buffer/pool_test.go @@ -42,7 +42,7 @@ func TestAppendString(t *testing.T) { s := "test" for i := 0; i < 1000; i++ { - b.AppendBytes([]byte(s)) + b.AppendString(s) want = append(want, s...) } From 03e03cfa69bb3277cda8cb0c66c96c3c0b5edd9c Mon Sep 17 00:00:00 2001 From: Carlo Alberto Ferraris Date: Sat, 29 Feb 2020 16:28:16 +0900 Subject: [PATCH 26/28] Do not copy escape tables --- jwriter/writer.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jwriter/writer.go b/jwriter/writer.go index eb8547c..2c5b201 100644 --- a/jwriter/writer.go +++ b/jwriter/writer.go @@ -297,11 +297,9 @@ func (w *Writer) String(s string) { p := 0 // last non-escape symbol - var escapeTable [128]bool + escapeTable := &htmlEscapeTable if w.NoEscapeHTML { - escapeTable = htmlNoEscapeTable - } else { - escapeTable = htmlEscapeTable + escapeTable = &htmlNoEscapeTable } for i := 0; i < len(s); { From 237a09852687bcdc0a0f29944051f270a912e082 Mon Sep 17 00:00:00 2001 From: Ivan Boyarkin Date: Fri, 14 Feb 2020 09:31:50 +0100 Subject: [PATCH 27/28] parser: Fix go.mod endline comments parsing It's required because: - go.mod file can contain comments - easyjson should respect comments and be able to parse go.mod This commit replaces the logic of parsing go.mod file with the original one from golang.org/x/mod/modfile package. Tests have been introduced to check the behavior of `getModulePath` function. Ref: - https://golang.org/cmd/go/#hdr-The_go_mod_file --- parser/modulepath.go | 82 +++++++++++++++++++++++++++ parser/pkgpath.go | 33 +---------- parser/pkgpath_test.go | 39 +++++++++++++ parser/testdata/comments.go.mod | 4 ++ parser/testdata/comments_deps.go.mod | 8 +++ parser/testdata/default.go.mod | 3 + parser/testdata/missing_module.go.mod | 6 ++ 7 files changed, 143 insertions(+), 32 deletions(-) create mode 100644 parser/modulepath.go create mode 100644 parser/pkgpath_test.go create mode 100644 parser/testdata/comments.go.mod create mode 100644 parser/testdata/comments_deps.go.mod create mode 100644 parser/testdata/default.go.mod create mode 100644 parser/testdata/missing_module.go.mod diff --git a/parser/modulepath.go b/parser/modulepath.go new file mode 100644 index 0000000..3f8e7ca --- /dev/null +++ b/parser/modulepath.go @@ -0,0 +1,82 @@ +package parser + +import ( + "bytes" + "strconv" +) + +// Content of this file was copied from the package golang.org/x/mod/modfile +// https://github.com/golang/mod/blob/v0.2.0/modfile/read.go#L877 +// Under the BSD-3-Clause licence: +// golang.org/x/mod@v0.2.0/LICENSE +/* +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +var ( + slashSlash = []byte("//") + moduleStr = []byte("module") +) + +// modulePath returns the module path from the gomod file text. +// If it cannot find a module path, it returns an empty string. +// It is tolerant of unrelated problems in the go.mod file. +func modulePath(mod []byte) string { + for len(mod) > 0 { + line := mod + mod = nil + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, mod = line[:i], line[i+1:] + } + if i := bytes.Index(line, slashSlash); i >= 0 { + line = line[:i] + } + line = bytes.TrimSpace(line) + if !bytes.HasPrefix(line, moduleStr) { + continue + } + line = line[len(moduleStr):] + n := len(line) + line = bytes.TrimSpace(line) + if len(line) == n || len(line) == 0 { + continue + } + + if line[0] == '"' || line[0] == '`' { + p, err := strconv.Unquote(string(line)) + if err != nil { + return "" // malformed quoted string or multiline module path + } + return p + } + + return string(line) + } + return "" // missing module path +} diff --git a/parser/pkgpath.go b/parser/pkgpath.go index 155d168..49f6efd 100644 --- a/parser/pkgpath.go +++ b/parser/pkgpath.go @@ -8,7 +8,6 @@ import ( "os/exec" "path" "path/filepath" - "strconv" "strings" "sync" ) @@ -91,7 +90,6 @@ func getPkgPathFromGoMod(fname string, isDir bool, goModPath string) (string, er } var ( - modulePrefix = []byte("\nmodule ") pkgPathFromGoModCache = make(map[string]string) ) @@ -109,36 +107,7 @@ func getModulePath(goModPath string) string { if err != nil { return "" } - var i int - if bytes.HasPrefix(data, modulePrefix[1:]) { - i = 0 - } else { - i = bytes.Index(data, modulePrefix) - if i < 0 { - return "" - } - i++ - } - line := data[i:] - - // Cut line at \n, drop trailing \r if present. - if j := bytes.IndexByte(line, '\n'); j >= 0 { - line = line[:j] - } - if line[len(line)-1] == '\r' { - line = line[:len(line)-1] - } - line = line[len("module "):] - - // If quoted, unquote. - pkgPath = strings.TrimSpace(string(line)) - if pkgPath != "" && pkgPath[0] == '"' { - s, err := strconv.Unquote(pkgPath) - if err != nil { - return "" - } - pkgPath = s - } + pkgPath = modulePath(data) return pkgPath } diff --git a/parser/pkgpath_test.go b/parser/pkgpath_test.go new file mode 100644 index 0000000..740f3d7 --- /dev/null +++ b/parser/pkgpath_test.go @@ -0,0 +1,39 @@ +package parser + +import "testing" + +func Test_getModulePath(t *testing.T) { + tests := map[string]struct { + goModPath string + want string + }{ + "valid go.mod without comments and deps": { + goModPath: "./testdata/default.go.mod", + want: "example.com/user/project", + }, + "valid go.mod with comments and without deps": { + goModPath: "./testdata/comments.go.mod", + want: "example.com/user/project", + }, + "valid go.mod with comments and deps": { + goModPath: "./testdata/comments_deps.go.mod", + want: "example.com/user/project", + }, + "actual easyjson go.mod": { + goModPath: "../go.mod", + want: "github.com/mailru/easyjson", + }, + "invalid go.mod with missing module": { + goModPath: "./testdata/missing_module.go", + want: "", + }, + } + for name := range tests { + tt := tests[name] + t.Run(name, func(t *testing.T) { + if got := getModulePath(tt.goModPath); got != tt.want { + t.Errorf("getModulePath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/parser/testdata/comments.go.mod b/parser/testdata/comments.go.mod new file mode 100644 index 0000000..b42beb9 --- /dev/null +++ b/parser/testdata/comments.go.mod @@ -0,0 +1,4 @@ +// first-line comment which should bresk anything +module example.com/user/project // end-line comment which should not break anything + +go 1.13 diff --git a/parser/testdata/comments_deps.go.mod b/parser/testdata/comments_deps.go.mod new file mode 100644 index 0000000..6e2ea62 --- /dev/null +++ b/parser/testdata/comments_deps.go.mod @@ -0,0 +1,8 @@ +// first-line comment which should bresk anything +module example.com/user/project // end-line comment which should not break anything + +go 1.13 + +require ( + github.com/mailru/easyjson v0.7.0 +) diff --git a/parser/testdata/default.go.mod b/parser/testdata/default.go.mod new file mode 100644 index 0000000..77f4317 --- /dev/null +++ b/parser/testdata/default.go.mod @@ -0,0 +1,3 @@ +module example.com/user/project + +go 1.13 diff --git a/parser/testdata/missing_module.go.mod b/parser/testdata/missing_module.go.mod new file mode 100644 index 0000000..4e0332f --- /dev/null +++ b/parser/testdata/missing_module.go.mod @@ -0,0 +1,6 @@ + +go 1.13 + +require ( + github.com/mailru/easyjson v0.7.0 +) From 11e4deeba6402724c7fea2d096ffb6c8479d543c Mon Sep 17 00:00:00 2001 From: Carlo Alberto Ferraris Date: Fri, 28 Feb 2020 20:07:29 +0900 Subject: [PATCH 28/28] Use net.Buffers in Buffer.DumpTo --- buffer/pool.go | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/buffer/pool.go b/buffer/pool.go index 07fb4bc..57dcfd5 100644 --- a/buffer/pool.go +++ b/buffer/pool.go @@ -4,6 +4,7 @@ package buffer import ( "io" + "net" "sync" ) @@ -52,14 +53,12 @@ func putBuf(buf []byte) { // getBuf gets a chunk from reuse pool or creates a new one if reuse failed. func getBuf(size int) []byte { - if size < config.PooledSize { - return make([]byte, 0, size) - } - - if c := buffers[size]; c != nil { - v := c.Get() - if v != nil { - return v.([]byte) + if size >= config.PooledSize { + if c := buffers[size]; c != nil { + v := c.Get() + if v != nil { + return v.([]byte) + } } } return make([]byte, 0, size) @@ -156,18 +155,14 @@ func (b *Buffer) Size() int { // DumpTo outputs the contents of a buffer to a writer and resets the buffer. func (b *Buffer) DumpTo(w io.Writer) (written int, err error) { - var n int - for _, buf := range b.bufs { - if err == nil { - n, err = w.Write(buf) - written += n - } - putBuf(buf) + bufs := net.Buffers(b.bufs) + if len(b.Buf) > 0 { + bufs = append(bufs, b.Buf) } + n, err := bufs.WriteTo(w) - if err == nil { - n, err = w.Write(b.Buf) - written += n + for _, buf := range b.bufs { + putBuf(buf) } putBuf(b.toPool) @@ -175,7 +170,7 @@ func (b *Buffer) DumpTo(w io.Writer) (written int, err error) { b.Buf = nil b.toPool = nil - return + return int(n), err } // BuildBytes creates a single byte slice with all the contents of the buffer. Data is @@ -192,7 +187,7 @@ func (b *Buffer) BuildBytes(reuse ...[]byte) []byte { var ret []byte size := b.Size() - // If we got a buffer as argument and it is big enought, reuse it. + // If we got a buffer as argument and it is big enough, reuse it. if len(reuse) == 1 && cap(reuse[0]) >= size { ret = reuse[0][:0] } else {